name: CI # Fast feedback on every pull request and on every push to main. # NOTE: this workflow deliberately has NO workflow_dispatch trigger — the rickub # dispatch API fires *every* dispatchable workflow on a ref, so only # release.yml may declare workflow_dispatch. See RELEASING.md. on: push: branches: - main pull_request: permissions: contents: read concurrency: group: ci-${{ github.ref }} cancel-in-progress: true jobs: check: name: fmt / vet / test / build 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 cache: true - name: gofmt run: | set -euo pipefail unformatted="$(gofmt -l .)" if [ -n "${unformatted}" ]; then echo "::error::The following files are not gofmt-formatted:" echo "${unformatted}" echo echo "Run: gofmt -w ." gofmt -d . exit 1 fi echo "gofmt: all files formatted" - name: go vet run: go vet ./... - name: go test run: go test ./... -count=1 - name: go build run: | set -euo pipefail go build ./... CGO_ENABLED=0 go build -trimpath -o "${RUNNER_TEMP}/rickub" . - name: Cross-compilation smoke test # The runner fleet is Linux/amd64 only, so releases cross-compile every # target. Catch a break here rather than in rc.yml/release.yml. run: | set -euo pipefail for target in linux/arm64 darwin/amd64 darwin/arm64; do echo "==> ${target}" CGO_ENABLED=0 GOOS="${target%%/*}" GOARCH="${target##*/}" \ go build -trimpath -o /dev/null . done