Skip to content

Commit

Permalink
Bshore/smre 177 node20 update (#54)
Browse files Browse the repository at this point in the history
* self-test-suite: make artifact names unique across self-test cases

* self-test-suite: set correct OS used in build artifact names

* self-test-suite-verify: use random ID to distinguish artifacts to upload
  • Loading branch information
shore committed May 8, 2024
1 parent 6026ec1 commit 9209078
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/self-test-suite-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ jobs:
- { assert: failure, file: corrupt, when: result file is corrupt }
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
# generate a random ID; GH doesn't provide a proper job ID (especially for matrix jobs)
- name: Generate random ID to distinguish build artifacts
run: echo "ARTIFACT_ID=$RANDOM" >> "$GITHUB_ENV"
- uses: ./verify/self-test
with:
assert: ${{ matrix.assert }}
when: ${{ matrix.when }}
result_file: verify/testdata/${{ matrix.file }}.buildresult.json
output_file: verification-result-${{ inputs.runner }}.json
output_file: verification-result-${{ inputs.runner }}-${{ env.ARTIFACT_ID }}.json
25 changes: 25 additions & 0 deletions .github/workflows/self-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
# with different sets of inputs, and assert that the action succeeds or
# fails correctly.

# Each test uses a distinct product_name that must account for both the job name
# and the variants introduced via job matrix in order to avoid duplicate artifact
# names (which cannot be uploaded as of actions/upload-artifact@v4.

# A single reproducible go binary.
ok-single-file:
runs-on: ${{ inputs.runner }}
Expand All @@ -29,8 +33,12 @@ jobs:
- { reproducible: nope, want: success }
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: select OS value
run: case "${{ runner.os }}" in macOS) echo "SELECTED_OS=darwin" >> "$GITHUB_ENV" ;; Linux) echo "SELECTED_OS=linux" >> "$GITHUB_ENV" ;; esac
- uses: ./self-test
with:
product_name: "example-app-${{ github.job }}-${{ matrix.reproducible }}"
os: ${{ env.SELECTED_OS }}
reproducible: ${{ matrix.reproducible }}
assert: ${{ matrix.want }}
when: "the binary files are identical and there are no other files in the zip"
Expand All @@ -50,8 +58,12 @@ jobs:
- { reproducible: nope, want: success }
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: select OS value
run: case "${{ runner.os }}" in macOS) echo "SELECTED_OS=darwin" >> "$GITHUB_ENV" ;; Linux) echo "SELECTED_OS=linux" >> "$GITHUB_ENV" ;; esac
- uses: ./self-test
with:
product_name: "example-app-${{ github.job }}-${{ matrix.reproducible }}"
os: ${{ env.SELECTED_OS }}
reproducible: ${{ matrix.reproducible }}
assert: ${{ matrix.want }}
when: "the binary files are identical and so are two other files in the zip"
Expand Down Expand Up @@ -84,6 +96,7 @@ jobs:
- uses: ./self-test
if: runner.os == 'macOS'
with:
product_name: "example-app-${{ github.job }}-${{ matrix.reproducible }}"
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
reproducible: ${{ matrix.reproducible }}
Expand All @@ -105,8 +118,12 @@ jobs:
- { reproducible: nope, want: success }
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: select OS value
run: case "${{ runner.os }}" in macOS) echo "SELECTED_OS=darwin" >> "$GITHUB_ENV" ;; Linux) echo "SELECTED_OS=linux" >> "$GITHUB_ENV" ;; esac
- uses: ./self-test
with:
product_name: "example-app-${{ github.job }}-${{ matrix.reproducible }}"
os: ${{ env.SELECTED_OS }}
reproducible: ${{ matrix.reproducible }}
assert: ${{ matrix.want }}
when: "the binary files reproduce but the zip files do not"
Expand All @@ -128,8 +145,12 @@ jobs:
- { reproducible: nope, want: success }
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: select OS value
run: case "${{ runner.os }}" in macOS) echo "SELECTED_OS=darwin" >> "$GITHUB_ENV" ;; Linux) echo "SELECTED_OS=linux" >> "$GITHUB_ENV" ;; esac
- uses: ./self-test
with:
product_name: "example-app-${{ github.job }}-${{ matrix.reproducible }}"
os: ${{ env.SELECTED_OS }}
reproducible: ${{ matrix.reproducible }}
assert: ${{ matrix.want }}
when: "neither the binary file not the zip file reproduce"
Expand All @@ -150,8 +171,12 @@ jobs:
- { reproducible: nope, want: failure }
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: select OS value
run: case "${{ runner.os }}" in macOS) echo "SELECTED_OS=darwin" >> "$GITHUB_ENV" ;; Linux) echo "SELECTED_OS=linux" >> "$GITHUB_ENV" ;; esac
- uses: ./self-test
with:
product_name: "example-app-${{ github.job }}-${{ matrix.reproducible }}"
os: ${{ env.SELECTED_OS }}
reproducible: ${{ matrix.reproducible }}
assert: ${{ matrix.want }}
when: "the binary file is not written to the correct path"
Expand Down
2 changes: 1 addition & 1 deletion self-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ runs:
id: build
uses: ./ # The action at the root of this repo.
with:
product_name: ${{ inputs.product_name }}_${{ github.job }}
product_name: ${{ inputs.product_name }}
product_version: ${{ inputs.product_version }}
go_version: ${{ inputs.go_version }}
os: ${{ inputs.os }}
Expand Down

0 comments on commit 9209078

Please sign in to comment.