Skip to content

Commit 152e510

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 77a9c68 commit 152e510

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.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)