Skip to content

Commit e1e6027

Browse files
committed
Don't upload multiple times to same artifact in integration test workflow
The `all-inputs` job of the "Run integration tests" GitHub Actions workflow is configured to generate multiple parallel jobs. A GitHub Actions workflow artifact was used to transfer the sketches report files generated by the "arduino/compile-sketches" action in each job to the subsequent job. The "actions/upload-artifact" and "actions/download-artifact" actions are used for this purpose. Previously, a single artifact was used for the transfer of all the sketches reports, with each of the parallel jobs uploading its own generated files to that 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 to use a dedicated artifact for each of the parallel jobs. These artifacts can be downloaded in aggregate by using the artifact name globbing and merging features which were introduced in version 4.1.0 of the "actions/download-artifact" action.
1 parent 968bd2e commit e1e6027

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

.github/workflows/sync-labels-npm.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env:
77
CONFIGURATIONS_FOLDER: .github/label-configuration-files
88
CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file-
99

10-
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
10+
# See: https://docs.github.com/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
1111
on:
1212
push:
1313
paths:
@@ -75,7 +75,6 @@ jobs:
7575
# Filenames of the shared configurations to apply to the repository in addition to the local configuration.
7676
# https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels
7777
- universal.yml
78-
- tooling.yml
7978

8079
steps:
8180
- name: Download
@@ -102,7 +101,7 @@ jobs:
102101
steps:
103102
- name: Set environment variables
104103
run: |
105-
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
104+
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
106105
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV"
107106
108107
- name: Determine whether to dry run

.github/workflows/test-integration.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
matrix:
9393
board:
9494
- fqbn: arduino:avr:uno
95+
artifact-name-suffix: arduino-avr-uno
9596
platforms: |
9697
- name: arduino:avr
9798
version: 1.8.3
@@ -100,6 +101,7 @@ jobs:
100101
version: 1.1.7
101102
# Board that requires Boards Manager URL
102103
- fqbn: esp8266:esp8266:huzzah
104+
artifact-name-suffix: esp8266-esp8266-huzzah
103105
platforms: |
104106
- name: esp8266:esp8266
105107
source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
@@ -140,18 +142,18 @@ jobs:
140142
[ -d ${{ env.TESTDATA_SKETCHES_PATH }}/BareMinimum/build ]
141143
142144
- name: Set report artifact name
143-
id: report-artifact-name
145+
id: report-artifact-prefix
144146
run: |
145-
echo "report-artifact-name=${{ github.job }}" >> "$GITHUB_OUTPUT"
147+
echo "report-artifact-prefix=${{ github.job }}" >> "$GITHUB_OUTPUT"
146148
147149
- name: Save sketches report as workflow artifact
148150
uses: actions/upload-artifact@v4
149151
with:
150152
path: sketches-reports
151-
name: ${{ steps.report-artifact-name.outputs.report-artifact-name }}
153+
name: ${{ steps.report-artifact-prefix.outputs.report-artifact-prefix }}-${{ matrix.board.artifact-name-suffix }}
152154

153155
outputs:
154-
report-artifact-name: ${{ steps.report-artifact-name.outputs.report-artifact-name }}
156+
report-artifact-prefix: ${{ steps.report-artifact-prefix.outputs.report-artifact-prefix }}
155157

156158
multiple-steps:
157159
name: multiple-steps (${{ matrix.board.source-type }})
@@ -322,8 +324,9 @@ jobs:
322324
- name: Download sketches reports artifact
323325
uses: actions/download-artifact@v4
324326
with:
325-
name: ${{ needs.all-inputs.outputs.report-artifact-name }}
327+
merge-multiple: true
326328
path: ${{ env.SKETCHES_REPORTS_PATH }}
329+
pattern: ${{ needs.all-inputs.outputs.report-artifact-prefix }}*
327330

328331
- name: Compare generated sketches report to golden report
329332
run: |
@@ -349,7 +352,7 @@ jobs:
349352
"$reportPath" \
350353
--slurpfile \
351354
golden \
352-
"${{ env.TESTDATA_REPORTS_PATH }}/${{ needs.all-inputs.outputs.report-artifact-name }}/$(basename "$reportPath")" \
355+
"${{ env.TESTDATA_REPORTS_PATH }}/${{ needs.all-inputs.outputs.report-artifact-prefix }}/$(basename "$reportPath")" \
353356
'($generated|.[0].boards) == ($golden|.[0].boards)'
354357
) && (
355358
# Check the commit_hash value

0 commit comments

Comments
 (0)