Skip to content

Commit

Permalink
Don't upload multiple times to same artifact in sketch compilation wo…
Browse files Browse the repository at this point in the history
…rkflows

The "Compile Examples" GitHub Actions workflow is configured to compile the example sketches for each of the supported
boards. This is done by using a job matrix in the GitHub Actions workflow to generate a parallel job for each board.

A GitHub Actions workflow artifact is used to transfer the sketches report files generated by the
"arduino/compile-sketches" action between this workflow's job and the "Report Size Deltas" workflow that uses the
"arduino/report-size-deltas" action to publish the data. The "actions/upload-artifact" action is used to upload the
sketches report files to the workflow artifact.

Previously, the sketches reports from all the boards were uploaded to a single artifact. However, support for uploading
multiple times to a single artifact was dropped in version 4.0.0 of the "actions/upload-artifact" action. So it is now
necessary for each of the jobs to use a separate artifact. The "arduino/report-size-deltas" action is configured to
recognize these multiple artifacts by a regular expression that matches against a standardized prefix on the artifact
names.
  • Loading branch information
per1234 committed Oct 9, 2024
1 parent ea5be64 commit 8f6e8a3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions workflow-templates/compile-examples-private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ on:

env:
SKETCHES_REPORTS_PATH: sketches-reports
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports

jobs:
build:
Expand All @@ -40,6 +39,8 @@ jobs:
board:
# TODO: Add list of boards to compile for here:
- fqbn: arduino:avr:uno
# TODO: Arbitrary suffix used to give the sketches report artifact a unique filename.
artifact-name-suffix: arduino-avr-uno
# TODO: Define the board's platform dependencies here.
# See: https://github.com/arduino/compile-sketches#platforms
platforms: |
Expand Down Expand Up @@ -70,7 +71,7 @@ jobs:
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}

report-size-deltas:
needs: build
Expand All @@ -86,7 +87,6 @@ jobs:
continue-on-error: true # If compilation failed for all boards then there are no artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Comment size deltas report to PR
Expand Down
4 changes: 3 additions & 1 deletion workflow-templates/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
board:
# TODO: Add list of boards to compile for here:
- fqbn: arduino:avr:uno
# TODO: Arbitrary suffix used to give the sketches report artifact a unique filename.
artifact-name-suffix: arduino-avr-uno
# TODO: Define the board's platform dependencies here.
# See: https://github.com/arduino/compile-sketches#platforms
platforms: |
Expand Down Expand Up @@ -67,4 +69,4 @@ jobs:
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_PATH }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}
6 changes: 3 additions & 3 deletions workflow-templates/compile-platform-examples-private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ on:

env:
SKETCHES_REPORTS_PATH: sketches-reports
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports

jobs:
build:
Expand All @@ -44,6 +43,8 @@ jobs:
board:
# TODO: Add list of boards to compile for here:
- fqbn: arduino:avr:uno
# TODO: Arbitrary suffix used to give the sketches report artifact a unique filename.
artifact-name-suffix: arduino-avr-uno

steps:
- name: Checkout repository
Expand Down Expand Up @@ -88,7 +89,7 @@ jobs:
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_PATH }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}

report-size-deltas:
needs: build
Expand All @@ -104,7 +105,6 @@ jobs:
continue-on-error: true # If compilation failed for all boards then there are no artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Comment size deltas report to PR
Expand Down
4 changes: 3 additions & 1 deletion workflow-templates/compile-platform-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
board:
# TODO: Add list of boards to compile for here:
- fqbn: arduino:avr:uno
# TODO: Arbitrary suffix used to give the sketches report artifact a unique filename.
artifact-name-suffix: arduino-avr-uno

steps:
- name: Checkout repository
Expand Down Expand Up @@ -85,4 +87,4 @@ jobs:
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_PATH }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}
6 changes: 3 additions & 3 deletions workflow-templates/compile-sketches-private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ on:

env:
SKETCHES_REPORTS_PATH: sketches-reports
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports

jobs:
build:
Expand All @@ -46,6 +45,8 @@ jobs:
board:
# TODO: Add list of boards to compile for here:
- fqbn: arduino:avr:uno
# TODO: Arbitrary suffix used to give the sketches report artifact a unique filename.
artifact-name-suffix: arduino-avr-uno
# TODO: Define the board's platform dependencies here.
# See: https://github.com/arduino/compile-sketches#platforms
platforms: |
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_PATH }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}

report-size-deltas:
needs: build
Expand All @@ -92,7 +93,6 @@ jobs:
continue-on-error: true # If compilation failed for all boards then there are no artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Comment size deltas report to PR
Expand Down
4 changes: 3 additions & 1 deletion workflow-templates/compile-sketches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
board:
# TODO: Add list of boards to compile for here:
- fqbn: arduino:avr:uno
# TODO: Arbitrary suffix used to give the sketches report artifact a unique filename.
artifact-name-suffix: arduino-avr-uno
# TODO: Define the board's platform dependencies here.
# See: https://github.com/arduino/compile-sketches#platforms
platforms: |
Expand Down Expand Up @@ -73,4 +75,4 @@ jobs:
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_PATH }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}
4 changes: 2 additions & 2 deletions workflow-templates/report-size-deltas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ jobs:
- name: Comment size deltas reports to PRs
uses: arduino/report-size-deltas@v1
with:
# The name of the workflow artifact created by the sketch compilation workflow
sketches-reports-source: sketches-reports
# Regex matching the names of the workflow artifacts created by the "Compile Examples" workflow
sketches-reports-source: ^sketches-report-.+

0 comments on commit 8f6e8a3

Please sign in to comment.