modernc.org/sqlite is C transpiled to Go against one version of modernc.org/libc, and its go.mod names that version exactly: v1.80.1 for v1.64.0, while libc's latest is v1.82.14. A newer libc breaks the driver without a compile error, and a routine go get -u would move it. The owner accepted holding libc there as the one exception to taking each dependency at its latest stable release; it moves only with the driver. tools/libcpin compares the libc that go list -m selects with the one go mod graph shows the selected modernc.org/sqlite requiring, and fails with the go get that restores it. It runs as go run ./tools/libcpin, so it works from PowerShell and in CI alike. test.yml and make check run it after go mod tidy -diff, CLAUDE.md lists it in the gate and records the exception beside the dependency rule, and design.md records it under the stack choices. Moving libc to v1.82.14 with go get made the check fail as it should; the change was not kept. Part of stage 1d of docs/plans/job-store.md (decision 13). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
98 lines
3.5 KiB
YAML
98 lines
3.5 KiB
YAML
name: Test
|
|
|
|
# Every branch push, and no pull_request trigger: branches are pushed
|
|
# directly, so each commit runs once. Branch pushes lint, test and
|
|
# cross-compile for ARM, but keep no binaries; release binaries are built
|
|
# only by release.yml, for tags on main.
|
|
on:
|
|
push:
|
|
branches: ['**']
|
|
|
|
jobs:
|
|
check:
|
|
name: Lint and test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
# setup-go@v5 installs the release named by go.mod's go line; with a
|
|
# toolchain line, the go command switches to that instead. Fail unless
|
|
# the running Go is the one go.mod names.
|
|
- name: Check the Go toolchain
|
|
run: |
|
|
want="$(sed -n 's/^toolchain //p' go.mod)"
|
|
[ -n "$want" ] || want="go$(sed -n 's/^go //p' go.mod)"
|
|
have="$(go env GOVERSION)"
|
|
echo "go.mod names: $want; running: $have"
|
|
[ "$have" = "$want" ]
|
|
|
|
# The gofmt on PATH is setup-go's; the one under GOROOT belongs to the
|
|
# toolchain the go command switched to.
|
|
- name: gofmt
|
|
run: |
|
|
unformatted="$("$(go env GOROOT)/bin/gofmt" -l .)"
|
|
if [ -n "$unformatted" ]; then
|
|
echo "These files need gofmt:"; echo "$unformatted"; exit 1
|
|
fi
|
|
|
|
- name: goimports
|
|
run: |
|
|
unformatted="$(go tool goimports -l .)"
|
|
if [ -n "$unformatted" ]; then
|
|
echo "These files need goimports:"; echo "$unformatted"; exit 1
|
|
fi
|
|
|
|
# Prints the change and fails, without writing, if go.mod or go.sum
|
|
# is not tidy.
|
|
- name: go mod tidy
|
|
run: go mod tidy -diff
|
|
|
|
# The SQLite driver works only with the exact modernc.org/libc its
|
|
# go.mod names, and a newer libc would break it without a compile
|
|
# error.
|
|
- name: libc matches the SQLite driver
|
|
run: go run ./tools/libcpin
|
|
|
|
- name: go vet
|
|
run: go vet ./...
|
|
|
|
- name: staticcheck
|
|
run: go tool staticcheck ./...
|
|
|
|
# docs/swagger.json is generated from the route table and its types,
|
|
# and THIRD-PARTY-LICENSES.md and its embedded copy from the modules
|
|
# linked into the binary. A change to any of those must come with the
|
|
# regenerated files.
|
|
- name: Generated files up to date
|
|
run: |
|
|
go generate ./...
|
|
git diff --exit-code -- docs/swagger.json THIRD-PARTY-LICENSES.md internal/app/uberbringer/licenses_embed.md
|
|
|
|
# The limit is per package: a hung test fails with every goroutine's
|
|
# stack instead of being killed by the runner.
|
|
- name: Test (race detector)
|
|
run: go test -race -timeout 5m ./...
|
|
|
|
# Release binaries are built for ARM without cgo, and the tests run on
|
|
# amd64 only, so code that builds there but not for 32-bit or 64-bit
|
|
# ARM fails here rather than on a tag. The binaries are discarded.
|
|
- name: Build for ARM
|
|
run: |
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o /dev/null ./cmd/uberbringer
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /dev/null ./cmd/uberbringer
|
|
|
|
# Validates .goreleaser.yaml without building anything, so a config
|
|
# error fails here rather than on a tag. Same pin as release.yml.
|
|
- name: GoReleaser config check
|
|
uses: goreleaser/goreleaser-action@v6
|
|
with:
|
|
distribution: goreleaser
|
|
version: '2.20.3'
|
|
args: check
|