Skip to content

Commit 8441bd3

Browse files
per1234aentinger
authored andcommitted
Report changes in memory usage that would result from merging a PR
On creation or commit to a pull request, a report of the resulting change in memory usage of the examples will be commented to the PR thread. NOTE: this version of the workflow is designed for use in private repositories, as explained here: https://github.com/arduino/report-size-deltas#run-from-the-same-workflow-as-the-arduinocompile-sketches-action Once the repository is made public, it must be replaced by these workflows: - https://github.com/per1234/.github/blob/main/workflow-templates/compile-examples.md - https://github.com/per1234/.github/blob/main/workflow-templates/report-size-deltas.md The reason for this is the private repository version will fail on pull requests submitted from forks due to the automatic token permissions downgrade done by GitHub actions under those conditions for security purposes.
1 parent 12c8929 commit 8441bd3

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/compile-examples-private.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
workflow_dispatch:
2121
repository_dispatch:
2222

23+
env:
24+
SKETCHES_REPORTS_PATH: sketches-reports
25+
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
26+
2327
jobs:
2428
build:
2529
name: ${{ matrix.board.fqbn }}
@@ -53,3 +57,34 @@ jobs:
5357
# See: https://github.com/arduino/compile-sketches#libraries
5458
sketch-paths: |
5559
- examples
60+
enable-deltas-report: true
61+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
62+
63+
- name: Save sketches report as workflow artifact
64+
uses: actions/upload-artifact@v2
65+
with:
66+
if-no-files-found: error
67+
path: ${{ env.SKETCHES_REPORTS_PATH }}
68+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
69+
70+
report-size-deltas:
71+
needs: build
72+
# Run even if some compilations failed.
73+
if: always() && github.event_name == 'pull_request'
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Download sketches reports artifact
78+
id: download-artifact
79+
continue-on-error: true # If compilation failed for all boards then there are no artifacts
80+
uses: actions/download-artifact@v2
81+
with:
82+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
83+
path: ${{ env.SKETCHES_REPORTS_PATH }}
84+
85+
- name: Comment size deltas report to PR
86+
uses: arduino/report-size-deltas@v1
87+
# If actions/download-artifact failed, there are no artifacts to report from.
88+
if: steps.download-artifact.outcome == 'success'
89+
with:
90+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}

0 commit comments

Comments
 (0)