name: CI on: push: branches: [main] pull_request: # A second push to the same branch makes the first run's result irrelevant. concurrency: group: ci-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: go: name: Go runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.26" cache: true - name: Formatting run: | unformatted=$(gofmt -l .) if [ -n "$unformatted" ]; then echo "These files are not gofmt'd:" echo "$unformatted" exit 1 fi - name: Vet run: go vet ./... # -race is the whole point of running tests in CI for a server with a # WebSocket fan-out: a data race is exactly the bug that passes locally. - name: Test run: go test -race -count=1 ./... - name: Build run: CGO_ENABLED=0 go build ./... docker: name: Docker image builds runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 # Build only — publishing happens on a tag, in release.yml. This job exists # so a Dockerfile that no longer builds fails on the pull request rather # than at release time. - uses: docker/build-push-action@v6 with: context: . push: false cache-from: type=gha cache-to: type=gha,mode=max