Skip to content

ci: setup-golangci-lint, a cached and verified golangci-lint install - #14

Merged
kolkov merged 1 commit into
mainfrom
ci/setup-golangci-lint
Nov 8, 2026
Merged

kolkov merged 1 commit into
mainfrom
ci/setup-golangci-lint

Conversation

@kolkov

@kolkov kolkov commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

A shared composite action that installs a pinned golangci-lint for CI without depending on GitHub Releases being reachable on every job.

golangci-lint-action downloads the binary on every job, and the runner images don't ship golangci-lint. Today the v2.15.0 linux-amd64 archive returned HTTP 504 for at least 15 minutes while other assets of the same release downloaded fine, which failed the new lint legs on gogpu/gogpu main (gogpu/gogpu#525).

What the action does:

  • keeps the release archive in the Actions cache, keyed by version, platform and sha256, so a cache hit makes no network request;
  • checks the archive against the pinned sha256 on every run, hit or miss, so a corrupted or poisoned cache entry never reaches PATH;
  • on a miss, downloads with retries and runs gh attestation verify --repo golangci/golangci-lint against the build provenance golangci-lint publishes;
  • puts the binary on PATH, so golangci-lint-action runs with install-mode: none.

Every action it uses is pinned by commit SHA. The README covers usage and how to bump the version.

The test workflow runs the three cases that matter:

  • a cold cache on linux amd64, linux arm64 and macOS;
  • a warm cache with the download host set to an unreachable address, which must pass;
  • a cache entry under the right key with the wrong bytes and no reachable host, which must fail with nothing on PATH.

Each run deletes its own cache entries at the end. Also adds /tmp/ to .gitignore.

golangci-lint-action downloads the binary from GitHub Releases on every job,
and the runner images do not ship golangci-lint. On 2026-11-08 the v2.15.0
linux-amd64 archive returned HTTP 504 for at least 15 minutes while other
assets of the same release downloaded, which failed lint in gogpu/gogpu.

This composite action keeps the release archive in the Actions cache, keyed
by version, platform and sha256, so a cache hit makes no network request. The
archive is checked against the pinned sha256 on every run, hit or miss, and
on a miss it is downloaded with retries and checked with gh attestation
verify against golangci-lint's build provenance. Lint steps then run
golangci-lint-action with install-mode none.

The test workflow proves a cold install on linux amd64/arm64 and macOS, a
warm install with the download host unreachable, and that a poisoned cache
entry is rejected with nothing on PATH. Also ignore /tmp/.
@kolkov
kolkov force-pushed the ci/setup-golangci-lint branch from 9873a7c to 0fa9aad Compare November 8, 2026 09:10
@kolkov
kolkov merged commit cdb7bd4 into main Nov 8, 2026
6 checks passed
@kolkov
kolkov deleted the ci/setup-golangci-lint branch November 8, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant