Harden release script gates, cover them with tests #25
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Selftest | |
| # Exercises dkms-build.yml against the fixtures on this repo's | |
| # selftest/* branches and asserts the artifact sets: a plain version on | |
| # selftest/upstream + selftest/recipe, a semver pre-release on the | |
| # selftest/*-pre pair. Sign and publish have no selftest. | |
| # | |
| # Also replays dkms-version-guard.yml over scratch repo fixtures, see | |
| # tests/version-guard-cases.sh, and scripts/release-dkms.sh against a | |
| # scratch driver repo with curl and dch stubbed, see | |
| # tests/release-cases.sh | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/dkms-build.yml | |
| with: | |
| # Fixture branches pair like a caller's main and debian/latest. | |
| # Repos default to the caller, this repo, so the selftest depends | |
| # on no external state. | |
| recipe-ref: selftest/recipe | |
| upstream-ref: selftest/upstream | |
| # Pre-release form: hyphen semver in dkms.conf, tilde in the recipe. | |
| build-pre: | |
| uses: ./.github/workflows/dkms-build.yml | |
| with: | |
| recipe-ref: selftest/recipe-pre | |
| upstream-ref: selftest/upstream-pre | |
| version-guard: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Replay guard cases | |
| run: bash tests/version-guard-cases.sh | |
| release-script: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Replay release cases | |
| run: bash tests/release-cases.sh | |
| assert: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: ${{ needs.build.outputs.artifact }} | |
| path: artifacts/ | |
| - name: Check expected build products | |
| run: | | |
| set -euo pipefail | |
| cd artifacts | |
| ls -la | |
| ok=1 | |
| for pattern in '*.deb' '*.dsc' '*.orig.tar.gz' '*.changes' '*.buildinfo'; do | |
| # shellcheck disable=SC2086 | |
| set -- $pattern | |
| [ -e "$1" ] || { echo "::error::Missing ${pattern}."; ok=0; } | |
| done | |
| [ "$ok" -eq 1 ] | |
| echo "OK: full artifact set present." | |
| assert-pre: | |
| needs: build-pre | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: ${{ needs.build-pre.outputs.artifact }} | |
| path: artifacts/ | |
| - name: Check expected build products | |
| run: | | |
| set -euo pipefail | |
| cd artifacts | |
| ls -la | |
| ok=1 | |
| for pattern in '*~*.deb' '*.dsc' '*.orig.tar.gz' '*.changes' '*.buildinfo'; do | |
| # shellcheck disable=SC2086 | |
| set -- $pattern | |
| [ -e "$1" ] || { echo "::error::Missing ${pattern}."; ok=0; } | |
| done | |
| [ "$ok" -eq 1 ] | |
| echo "OK: full pre-release artifact set present, tilde in .deb name." |