-
-
Notifications
You must be signed in to change notification settings - Fork 7
Add ability for libraries actions to report changes in memory usage #18
Conversation
…ntroduced by a PR Changes in the flash and dynamic memory for global variables usage of an example sketch are determined during the pull request build by the compile-examples action. The action displays the memory usage data in the log and also saves it to a JSON formatted file. The actions/upload-artifact action may be used to create a workflow artifact containing the memory usage data files. The newly added arduino/actions/libraries/report-size-deltas action may be used to provide a table summarizing the memory usage changes as a comment in the pull request thread.
Regarding this:
Before I discovered the issue with the access token permissions level downgrade, I wrote a version of the The most common development approach at Arduino seems to be to work from a branch of the target repository (rather than a fork), then submit a PR from that branch. With this approach, PRs to private repositories from forks will be rare. So the workaround for the problem of the scheduled
So when the action is used from a private repo, the user has the option of:
This wouldn't require any change to the action's API. It is purely determined by the user's GitHub Actions workflow configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @per1234 👋 Fantastic work you did here. I'm very impressed ;) I've broached the subject of creating a new release of ArduinoCore-samd
with the firmware team. This would save us on using the workaround you've developed for SAM/SAMD boards. I'd be willing to exclude the SAM boards from this feature as to my knowledge there will be no new SAM boards and there haven't been many old ones (anything except Arduino Due
?). What do you think?
Thanks! I appreciate your kind words.
Sounds good to me. It would be nice to eliminate the unnecessary extra complexity added by that workaround code. The action will still work for the flash reported in the arduino-cli output on the Due (though that doesn't include the data section). It will just report "N/A" for RAM. |
Here you go ... |
Hi @per1234 👋 Just wanted to ask if you got around to clean-up this PR after the SAMD core release? |
@aentinger I haven't done it yet, but I will get on it. |
I have now removed the workaround code in abcb285 |
@aentinger just a reminder that since this introduces the use of secrets, I would like to get a security review before the PR is merged. Before doing that, I'd appreciate if you'd take a look at abcb285 to see if you spot any problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the feature is enabled, memory usage data for a selected example sketch is published to a Google Sheets spreadsheet on every push to the repository's default branch.
… fully report sizes The issue of RAM use by global variables not being reported and flash being incorrectly reported by the Arduino SAMD Boards platform has been fixed in the 1.8.6 release. The issue remains for the Arduino SAM Boards platform, but it's not worth the added complexity just to improve size reporting for the Due.
Adding also @rsora as a reviewer as he spent quite some time on GitHub Actions. |
Hi @gvarisco, Here are the items of interest:
The newly added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've heard there have been further discussions. Leaving this to Luigi and Roberto for future review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @per1234 👍
Left various comment regarding how to improve dependency management.
Side notes for future submissions: Try to split as much as possible into smaller PRs representing self contained changes/additions, I understand that all this work is all related, but having smaller PRs makes easy to do reviews.
- Move the dependencies installations out of entrypoint.sh - Pin Python version to 3.8.2
Pin Python version to 3.8.2 Co-Authored-By: Roberto Sora <r.sora@arduino.cc>
reportsizedeltas.py -> /reportsizedeltas.py
Great work 👍 Looking forward to integrate with firmware repos ;) |
Memory usage deltas reporting
Update to the
compile-examples
actionIf the
enable-size-deltas-report
input is set totrue
, on every push to a pull request the change in memory usage of the example sketch specified via thecompile-examples
action'ssize-report-sketch
input between the PR's head and base branch will be:actions/upload-artifact
action (example).NOTE: Due to the current non-reporting of RAM usage, and misreporting of flash usage of Arduino SAMD Boards and Arduino SAM boards, I added a somewhat hacky workaround of using the compiler size tool to determine the memory usage when a board of one of those platforms is compiled for. This situation has already been resolved for Arduino SAMD Boards (arduino/ArduinoCore-samd#503), but there has not been a release since. For all other boards, arduino-cli's output is parsed for the memory usage data, which provides support for all boards without the need to add a lot of complexity to the action's script to reproduce arduino-cli's handling of tools.WORKAROUND CODE HAS NOW BEEN REMOVEDAddition of
report-size-deltas
actionThe newly added

report-size-deltas
action converts the data from the workflow artifact saved during thecompile-examples
workflow into a Markdown formatted table that is commented to the PR's thread:https://github.com/per1234/Arduino_ConnectionHandler/pull/1#issuecomment-605624787
The "N/A" shown in the table above for
adafruit:samd:adafruit_feather_m0
's RAM is because, like Arduino SAMD Boards, Adafruit SAMD Boards does not display RAM usage in the output. However, I didn't provide the workaround I noted above for Adafruit boards. I added that board to the demonstration to show how the action handles this situation.The "N/A" shown in the table above for the
arduino:samd:mkrgsm1400
's flash and RAM is because the example sketch didn't compile in the PR's base branch, but does compile in the PR's head branch. I set the demonstration up this way to show how the action handles this situation.This action is intended to be used in a scheduled workflow. The reason for this is that the automatically generated GitHub access token is downgraded to read-only when the pull request is submitted from a fork, making it impossible to comment on the PR thread from an action triggered by a
pull_request
event. There are three downsides to the scheduled event approach:Memory usage trends reporting with the
compile-examples
actionIf the
enable-size-trends-report
input is set totrue
, on every push to the default branch the memory usage of the example sketch is written to a Google Sheets spreadsheet (example). This can be used to track the changes in memory usage over time.