Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix(ci): the Windows install test never ran on a release (#461)

KageBinaryb66e8a7b906c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 23cea901..6c136819 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -53,6 +53,50 @@ jobs:
fi
echo "checked $checked tracked sources"
exit $status
+ # ── Workflow wiring ─────────────────────────────────────────────────
+ #
+ # In this job, not in actions-lint.yml beside zizmor, and that placement
+ # is the point. The `main` ruleset requires exactly one status check,
+ # `CI Passed`, whose `needs` this job is in; a check in any other workflow
+ # reports and gates nothing. actions-lint.yml also carries
+ # `paths: ['.github/workflows/**']`, so it is absent from most PRs and
+ # could not be made required without hanging them.
+ #
+ # What it buys: release.yml calls windows-install.yml as a reusable
+ # workflow, and nothing runs that call until a tag is pushed, so a
+ # mistyped `uses:` path or a renamed input would surface for the first
+ # time on a production release — the same blind spot as the
+ # `release: published` trigger it replaces, which silently did nothing for
+ # a whole release. actionlint resolves local `uses:` targets and matches
+ # `with:` keys against the callee's declared inputs. It cannot see a
+ # reusable-workflow permission restriction; that is an org setting no
+ # linter reaches.
+ #
+ # shellcheck and pyflakes are off deliberately: actionlint shells out to
+ # them for `run:` blocks when they are on PATH, which they are on
+ # ubuntu-latest, so leaving them on makes a required check's verdict
+ # depend on the runner image's shellcheck version rather than on the repo.
+ #
+ # Pinned by version and checksum, like every action here is pinned by SHA,
+ # because this runs a downloaded binary. Dependabot's github-actions
+ # ecosystem updates `uses:` refs and not `run:` downloads, so the bump is
+ # manual — same as the `pipx install zizmor` next door, which pins nothing
+ # at all.
+ - name: Workflows are wired up (actionlint)
+ env:
+ ACTIONLINT_VERSION: 1.7.7
+ ACTIONLINT_SHA256: 023070a287cd8cccd71515fedc843f1985bf96c436b7effaecce67290e7e0757
+ run: |
+ set -euo pipefail
+ TARBALL="actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
+ # Retried: this repo has already had a red check that was a release
+ # asset download failing at the install step, reported as a workflow
+ # problem it was not.
+ curl -fsSL --retry 3 --retry-delay 2 --retry-all-errors -o "$TARBALL" \
+ "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/${TARBALL}"
+ echo "${ACTIONLINT_SHA256} ${TARBALL}" | sha256sum --check --strict -
+ tar -xzf "$TARBALL" actionlint
+ ./actionlint -shellcheck= -pyflakes=
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b769f2d8..deda4e39 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -404,6 +404,8 @@ jobs:
needs: build
if: ${{ !inputs.dry_run && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.version.outputs.version }}
permissions:
contents: write # create the release + push the brew branch
pull-requests: write # open the brew formula PR
@@ -581,3 +583,21 @@ jobs:
git commit -m "chore(brew): update formula for v${VERSION}" || exit 0
git push --force-with-lease origin "$BRANCH"
gh pr create --title "chore(brew): update formula for v${VERSION}" --body "Auto-generated: updates Homebrew formula SHA for v${VERSION}" --base main || true
+
+ # ── Verify the installer against the release it just made ────────────────
+ #
+ # The artifact was verified by packaging it; this verifies the script that
+ # unpacks it, which is where every Windows install bug has actually lived.
+ # Called rather than triggered by `release: published`: the release is created
+ # with `secrets.GITHUB_TOKEN`, and GitHub does not start new workflow runs
+ # from events created with that token, so the trigger never fired.
+ #
+ # Not a gate on the release — the assets are already published by the time it
+ # runs — but a failure here lands on the run that produced them, which is the
+ # difference between finding out now and finding out from a user.
+ verify-install:
+ needs: release
+ if: ${{ !inputs.dry_run && github.event_name != 'pull_request' }}
+ uses: ./.github/workflows/windows-install.yml
+ with:
+ version: ${{ needs.release.outputs.version }}
diff --git a/.github/workflows/windows-install.yml b/.github/workflows/windows-install.yml
index a3b06e66..7dadded9 100644
--- a/.github/workflows/windows-install.yml
+++ b/.github/workflows/windows-install.yml
@@ -11,6 +11,15 @@
# So this runs the real script, on a real Windows runner, and asserts the shape
# of what it leaves behind. Every check below is a bug that actually shipped.
#
+# It is *called* by the release workflow rather than triggered by
+# `release: published`, and that is not a style choice. The release is created
+# by `github-actions[bot]` with `secrets.GITHUB_TOKEN`, and GitHub does not start
+# new workflow runs from events created with that token — so a `release:`
+# trigger here never fires. It was written that way first and silently did
+# nothing for a release; being called keeps the check inside the run that
+# produced the artifact, where a failure is attached to the release that caused
+# it.
+#
# `IX_SKIP_BACKEND=1` is what makes it possible at all: the runner has no Linux
# Docker, and `Write-Err` exits, so without the skip the run dies at the Docker
# check having never unpacked the CLI — the part that keeps breaking.
@@ -23,10 +32,14 @@ on:
paths:
- "scripts/install/install.ps1"
- ".github/workflows/windows-install.yml"
- # A published release is the moment the installer's inputs change, and the
- # only moment a real user is about to run it against them.
- release:
- types: [published]
+ # Called by the release workflow once the assets are up — see below for why
+ # this is a call rather than a `release: published` trigger.
+ workflow_call:
+ inputs:
+ version:
+ description: "Version to install, without the leading v."
+ required: true
+ type: string
workflow_dispatch:
inputs:
version:
@@ -61,10 +74,14 @@ jobs:
shell: pwsh
env:
IX_SKIP_BACKEND: "1"
- IX_VERSION: ${{ inputs.version || (github.event_name == 'release' && github.event.release.tag_name) || '' }}
+ IX_VERSION: ${{ inputs.version || '' }}
run: |
$env:IX_HOME = Join-Path $env:RUNNER_TEMP 'ix home'
- # The tag carries a leading v; IX_VERSION does not.
+ # Tolerance for the hand-typed case, not a translation of the tag: the
+ # release workflow passes `${TAG#v}`, already stripped, so this is a
+ # no-op on that path. The one input a human fills in is
+ # workflow_dispatch's, where the release is called v0.10.0 everywhere
+ # it is named and typing the v back in is the obvious mistake.
if ($env:IX_VERSION) { $env:IX_VERSION = $env:IX_VERSION -replace '^v', '' }
Write-Host "IX_HOME=$env:IX_HOME IX_VERSION=$($env:IX_VERSION -replace '^$','(latest stable)')"
& .\scripts\install\install.ps1
@@ -94,6 +111,8 @@ jobs:
- name: Launcher runs
shell: pwsh
+ env:
+ IX_VERSION: ${{ inputs.version || '' }}
run: |
# By absolute path, not through PATH: a shim that resolves only because
# the session happens to have the right PATH is not a working install.
@@ -103,6 +122,26 @@ jobs:
if ($LASTEXITCODE -ne 0) { throw "ix --version exited $LASTEXITCODE`n$out" }
Write-Host $out.Trim()
+ # Assert *which* release we just installed, when one was named.
+ #
+ # The IX_VERSION expression above falls back to an empty string, which
+ # install.ps1 reads as "latest stable" -- and workflow_call accepts an
+ # empty string for a required input. So if needs.release.outputs.version
+ # ever resolves empty (a renamed step id, a reworked release job) this
+ # job installs an unrelated build and every check below passes against
+ # it, which is the same silent no-op the release-published trigger was.
+ #
+ # No expression syntax in this comment. zizmor reads a template
+ # expansion anywhere inside a run block as an injection site, comments
+ # included, and it is right that it cannot tell the difference.
+ if ($env:IX_VERSION) {
+ $want = $env:IX_VERSION -replace '^v', ''
+ if ($out -notmatch [regex]::Escape($want)) {
+ throw "installed $($out.Trim()) but the release under test is $want"
+ }
+ Write-Host "verified against release $want"
+ }
+
- name: Compass is present and stamped
shell: pwsh
run: |
@@ -126,8 +165,9 @@ jobs:
shell: pwsh
env:
IX_SKIP_BACKEND: "1"
- IX_VERSION: ${{ inputs.version || (github.event_name == 'release' && github.event.release.tag_name) || '' }}
+ IX_VERSION: ${{ inputs.version || '' }}
run: |
+ # Same hand-typed tolerance as the first install — see the note there.
if ($env:IX_VERSION) { $env:IX_VERSION = $env:IX_VERSION -replace '^v', '' }
& .\scripts\install\install.ps1
if ($LASTEXITCODE -ne 0) { throw "second install.ps1 exited $LASTEXITCODE" }
diff --git a/.github/zizmor.yml b/.github/zizmor.yml
index 533a2f91..c89ec2c9 100644
--- a/.github/zizmor.yml
+++ b/.github/zizmor.yml
@@ -13,10 +13,3 @@ rules:
# setup-node's npm cache for build speed; the cache key is lockfile-pinned.
# Accepted for the release workflow only.
- release.yml
- # windows-install.yml runs on `release: published`, which zizmor treats as
- # a privileged context, and the finding is raised against setup-node on
- # that basis alone. This one passes no `cache:` input, so setup-node
- # neither restores nor saves a cache — there is nothing to poison, and the
- # job publishes no artifact. It installs a already-published release and
- # asserts the layout. Reported by zizmor at low confidence.
- - windows-install.yml