Selftest #10
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. | |
| 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 | |
| assert: | |
| needs: build | |
| name: Assert artifact set | |
| 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 | |
| name: Assert pre-release artifact set | |
| 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." |