From 9e24e2980dbd7ec3f3cc0e0551ee4437c5f6b30b Mon Sep 17 00:00:00 2001 From: blockmandev <194144408+blockmandev@users.noreply.github.com> Date: Fri, 23 Oct 2026 08:10:19 -0600 Subject: [PATCH] ci: install each published release the way users do, on every platform (refs #18) install.sh had never run anywhere, and install.ps1 only by hand: nothing checked that a published release can actually be installed, or that the installed programs report the release's version (the drift #58 fixed). install-check.yml installs a tag's release with the installers from that tag -- install.sh on ubuntu-22.04 (x86_64 and arm) and macOS, install.ps1 on Windows -- into a private folder, and fails unless `incode --version` and `sbx --version` name exactly the tag's version. release.yml calls it after publishing (a release published with the workflow's token starts no `on: release` workflow); it also runs by hand for an existing tag. --- .github/workflows/install-check.yml | 80 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 8 +++ 2 files changed, 88 insertions(+) create mode 100644 .github/workflows/install-check.yml diff --git a/.github/workflows/install-check.yml b/.github/workflows/install-check.yml new file mode 100644 index 0000000..35e34bf --- /dev/null +++ b/.github/workflows/install-check.yml @@ -0,0 +1,80 @@ +# Install a published release the way a user does, on every platform it +# ships for, and check that the installed programs report the release's +# version. +# +# release.yml calls this after it publishes (a release published with the +# workflow's own token starts no other workflow, so `on: release` would never +# fire). Run it by hand for an existing tag with: +# gh workflow run install-check.yml -f tag=v0.1.0-rc.2 +# +# The installers are taken from the tag itself, so what is checked is what +# that release's users were told to run. +name: install check + +on: + workflow_call: + inputs: + tag: + required: true + type: string + workflow_dispatch: + inputs: + tag: + description: The release tag to install, such as v0.1.0-rc.2. + required: true + type: string + +permissions: + contents: read + +jobs: + install: + name: install (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, ubuntu-22.04-arm, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + env: + TAG: ${{ inputs.tag }} + steps: + - name: Check the tag + shell: bash + run: | + set -euo pipefail + case "$TAG" in + v[0-9]*) ;; + *) echo "::error::install check: '$TAG' is not a version tag"; exit 1 ;; + esac + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + + - name: Install with install.sh + if: runner.os != 'Windows' + shell: bash + run: | + set -euo pipefail + INCODE_VERSION="$TAG" INCODE_INSTALL_DIR="$RUNNER_TEMP/incode-bin" sh scripts/install.sh + - name: Install with install.ps1 + if: runner.os == 'Windows' + shell: pwsh + run: | + $env:INCODE_VERSION = $env:TAG + $env:INCODE_INSTALL_DIR = Join-Path $env:RUNNER_TEMP 'incode-bin' + ./scripts/install.ps1 + + - name: The installed programs report the tag's version + shell: bash + run: | + set -euo pipefail + bin="$RUNNER_TEMP/incode-bin" + want="${TAG#v}" + for program in incode sbx; do + got="$("$bin/$program" --version)" + echo "$program --version: $got" + if [ "$got" != "$program $want" ]; then + echo "::error::$program reports '$got', expected '$program $want'" + exit 1 + fi + done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6770f0f..386da3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -143,3 +143,11 @@ jobs: # A tag with a hyphen (`v1.2.0-rc.1`) is a pre-release, which # GitHub's `releases/latest` — and so every installer — skips. prerelease: ${{ contains(github.ref_name, '-') }} + + # What was just published, installed the way a user installs it on each + # platform, and checked to report this tag's version. + install-check: + needs: release + uses: ./.github/workflows/install-check.yml + with: + tag: ${{ github.ref_name }}