build.yml

 1name: build
 2on:
 3  push:
 4    branches: [main]
 5  pull_request:
 6
 7permissions:
 8  contents: read
 9
10concurrency:
11  group: build-${{ github.event.pull_request.number || github.ref }}
12  cancel-in-progress: true
13
14jobs:
15  build:
16    strategy:
17      matrix:
18        os: [ubuntu-latest, macos-latest, windows-latest]
19    runs-on: ${{ matrix.os }}
20    steps:
21      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22        with:
23          persist-credentials: false
24      - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
25        with:
26          go-version-file: go.mod
27      - run: go mod tidy
28      - run: git diff --exit-code
29      - run: go build -race ./...
30      - run: go test -race -failfast ./...