The same changes as the Actions workflows: a release gate runs `task check dist` and the dist step only packages; canary and promote copy archied out of archied:edge instead of compiling it. The gate and the pull-request check keep Go's module, build and lint caches on the host, in separate directories so a pull request cannot write into the cache a release build reads. Fixes: notes wait for the signed release and carry the prerelease flag; the canary clones with tags, which its rollback needs to diff migrations; release puts HEAD on main before `task release`, which refuses anything else.
70 lines
3.1 KiB
YAML
70 lines
3.1 KiB
YAML
# Pull-request gate: the same `task check` the maintainer runs locally.
|
|
#
|
|
# One step, not one step per check: `task check` installs task, golangci-lint,
|
|
# gofumpt, buf and sqlc into the container it runs in, and a second step starts
|
|
# from an empty container and pays for that again.
|
|
|
|
when:
|
|
- event: [pull_request]
|
|
|
|
clone:
|
|
git:
|
|
image: woodpeckerci/plugin-git:2.8.0
|
|
settings:
|
|
# The gate compares the contracts against main and reads the release tags
|
|
# for the version a build reports, so a partial clone will not do.
|
|
tags: true
|
|
# A pull-request pipeline otherwise clones only the pull request's own
|
|
# ref, leaving no main for the contract baseline to compare against.
|
|
fetch_target_branch: true
|
|
|
|
steps:
|
|
- name: check
|
|
image: golang:1.27.3-bookworm
|
|
# Module, build and lint caches outlive the step's container. Pull requests
|
|
# get their own directory so they cannot write into the cache a release
|
|
# build reads.
|
|
volumes:
|
|
- /var/cache/woodpecker-archie-pr:/cache
|
|
environment:
|
|
GOCACHE: /cache/go-build
|
|
GOMODCACHE: /cache/go-mod
|
|
GOLANGCI_LINT_CACHE: /cache/golangci-lint
|
|
commands:
|
|
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
|
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version)
|
|
- go install mvdan.cc/gofumpt@v0.11.0
|
|
- bash tools/proto.sh install
|
|
# The gate builds and tests the dashboard, so Node and pnpm sit next to
|
|
# Go. Pinned tarball verified by digest, not a third-party setup script:
|
|
# the gate must not change under the repository.
|
|
- |
|
|
set -eu
|
|
apt-get update -qq
|
|
apt-get install -y -qq --no-install-recommends xz-utils
|
|
curl -fsSL -o /tmp/node.tar.xz https://nodejs.org/dist/v24.22.2/node-v24.22.2-linux-x64.tar.xz
|
|
echo "48cc0e21e048790e54c0cf5749c2725005313d652651c40b7a21feb9697aaf75 /tmp/node.tar.xz" | sha256sum -c -
|
|
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
|
# pnpm's version belongs to the lockfile; installing any other one makes
|
|
# `pnpm install --frozen-lockfile` reject the tree.
|
|
npm install -g "pnpm@$(node -p 'require("./ui/package.json").packageManager.split("@")[1]')"
|
|
node --version
|
|
pnpm --version
|
|
- |
|
|
set -eu
|
|
# The contract baseline is a local main. plugin-git fetches with an explicit
|
|
# refspec, so it creates no remote-tracking branch itself; only the target
|
|
# branch fetch above does, which is why this fails rather than comparing
|
|
# the pull request against its own tree.
|
|
if ! git show-ref --verify --quiet refs/heads/main; then
|
|
if ! git rev-parse --verify --quiet origin/main >/dev/null; then
|
|
echo "no main in this clone, so the contracts cannot be compared against a baseline" >&2
|
|
exit 1
|
|
fi
|
|
git branch main origin/main
|
|
fi
|
|
- task --concurrency 1 check
|
|
# The gate rewrites the tree (fmt, generated contracts and queries); a
|
|
# rewrite the author did not commit is a failure, not a side effect.
|
|
- git diff --exit-code
|