Skip to content

Commit

Permalink
Generate v1 and v2 format test data artifacts
Browse files Browse the repository at this point in the history
A significant change was made to the nature of GitHub Actions workflow artifacts starting from the 2.x release of the
`@actions/artifact` package, which was introduced in the 4.0.0 release of the "actions/upload-artifact" GitHub Actions
action.

It is necessary to provide integration test coverage for compatibility of the "arduino/report-size-deltas" action with
the v2 format artifacts produced by actions/upload-artifact@v4. It is also important to continue to cover compatibility
with the v1 format artifacts produced by actions/upload-artifact@v3, to support users who have not gotten around to
updating that action dependency in their sketch compilation workflows (especially since the breaking change introduced
by actions/upload-artifact@v4 will make it necessary to adjust the configuration of the workflow).

The chosen approach is to configure the "Upload test sketches report artifact" workflow to use
actions/upload-artifact@v3 when upload one of the test data artifacts and actions/upload-artifact@v4 when uploading the
other. Even though the produced test data would not occur under real world usage, it is the cleanest way (the
alternative being to create and maintain separate copies of the system implemented in the `report-target-pr` branch for
each major version of the actions/upload-artifact action) to provide effective integration test coverage.
  • Loading branch information
per1234 committed Jan 24, 2024
1 parent e99610b commit aa22d11
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/upload-report-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ jobs:
parameters:
# Coverage for pre-actions/upload-artifact@v4 approach where all reports are stored in a single artifact.
- artifact-name-suffix: multi
artifact-version: 1
reports-folder: multi-report-artifact
# Coverage for actions/upload-artifact@v4 approach where each report is stored in a separate artifact.
- artifact-name-suffix: arduino-samd-mkrzero
artifact-version: 2
reports-folder: per-report-artifact

steps:
Expand All @@ -45,9 +47,20 @@ jobs:
jq '.commit_hash = "${{ github.event.pull_request.head.sha }}"' "$reportFile" > "${SKETCHES_REPORTS_PATH}/$reportFile"
done
- name: Save sketches report as workflow artifact
- name: Save sketches report as v1 format workflow artifact
if: matrix.parameters.artifact-version == '1'
# actions/upload-artifact 3.x is the last version to produce v1 format artifacts:
# https://github.com/actions/upload-artifact/blob/main/README.md#v4---whats-new
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.ARTIFACT_NAME_PREFIX }}${{ matrix.parameters.artifact-name-suffix }}

- name: Save sketches report as v2 format workflow artifact
if: matrix.parameters.artifact-version == '2'
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.ARTIFACT_NAME_PREFIX }}${{ matrix.parameters.artifact-name-suffix }}

0 comments on commit aa22d11

Please sign in to comment.