From 7d536b647d4bea5dd27fe562bf6b5c158125082b Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 9 Oct 2024 02:47:17 -0700 Subject: [PATCH] Don't upload multiple times to same artifact in sketch compilation workflows The sketch compilation GitHub Actions workflows are configured to compile the sketches for each of a set of 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. --- workflow-templates/compile-examples-private.yml | 6 +++--- workflow-templates/compile-examples.yml | 4 +++- workflow-templates/compile-platform-examples-private.yml | 6 +++--- workflow-templates/compile-platform-examples.yml | 4 +++- workflow-templates/compile-sketches-private.yml | 6 +++--- workflow-templates/compile-sketches.yml | 4 +++- workflow-templates/report-size-deltas.yml | 4 ++-- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/workflow-templates/compile-examples-private.yml b/workflow-templates/compile-examples-private.yml index 975dcec..ea221f5 100644 --- a/workflow-templates/compile-examples-private.yml +++ b/workflow-templates/compile-examples-private.yml @@ -23,7 +23,6 @@ on: env: SKETCHES_REPORTS_PATH: sketches-reports - SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports jobs: build: @@ -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: | @@ -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 @@ -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 diff --git a/workflow-templates/compile-examples.yml b/workflow-templates/compile-examples.yml index 883eed7..0284904 100644 --- a/workflow-templates/compile-examples.yml +++ b/workflow-templates/compile-examples.yml @@ -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: | @@ -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 }} diff --git a/workflow-templates/compile-platform-examples-private.yml b/workflow-templates/compile-platform-examples-private.yml index 75f8e28..81cb774 100644 --- a/workflow-templates/compile-platform-examples-private.yml +++ b/workflow-templates/compile-platform-examples-private.yml @@ -27,7 +27,6 @@ on: env: SKETCHES_REPORTS_PATH: sketches-reports - SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports jobs: build: @@ -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 @@ -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 @@ -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 diff --git a/workflow-templates/compile-platform-examples.yml b/workflow-templates/compile-platform-examples.yml index 2f9c1ea..a06d399 100644 --- a/workflow-templates/compile-platform-examples.yml +++ b/workflow-templates/compile-platform-examples.yml @@ -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 @@ -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 }} diff --git a/workflow-templates/compile-sketches-private.yml b/workflow-templates/compile-sketches-private.yml index 7369224..2a416aa 100644 --- a/workflow-templates/compile-sketches-private.yml +++ b/workflow-templates/compile-sketches-private.yml @@ -29,7 +29,6 @@ on: env: SKETCHES_REPORTS_PATH: sketches-reports - SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports jobs: build: @@ -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: | @@ -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 @@ -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 diff --git a/workflow-templates/compile-sketches.yml b/workflow-templates/compile-sketches.yml index 13ae47d..ecc4b3f 100644 --- a/workflow-templates/compile-sketches.yml +++ b/workflow-templates/compile-sketches.yml @@ -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: | @@ -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 }} diff --git a/workflow-templates/report-size-deltas.yml b/workflow-templates/report-size-deltas.yml index 73727e7..a246571 100644 --- a/workflow-templates/report-size-deltas.yml +++ b/workflow-templates/report-size-deltas.yml @@ -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-.+