Debian Codegraph @

.github/workflows/validate.yaml

raw
1
2 name: Validate
3
4 on:
5 # Post-merge validation only. Feature branches are validated by their
6 # pull_request run, so a branch push with an open PR no longer triggers
7 # a duplicate (previously cancelled) push run.
8 push:
9 branches:
10 - master
11 # All pull requests.
12 pull_request:
13 branches:
14 - '**'
15
16 # Least-privilege token; the validate workflow only needs to read the repo.
17 permissions:
18 contents: read
19
20 # A push and its pull_request both trigger this workflow on the same
21 # branch. Group them so only one full matrix runs, and cancel runs that
22 # are superseded by a newer commit on the same branch/PR.
23 concurrency:
24 group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
25 cancel-in-progress: true
26
27 jobs:
28 build:
29 name: Validate on ${{ matrix.os }}
30 runs-on: ${{ matrix.os }}
31 strategy:
32 fail-fast: false
33 matrix:
34 os: [ ubuntu-latest, windows-latest, macos-latest ]
35
36 timeout-minutes: 10
37 steps:
38 - uses: actions/checkout@v6
39 - uses: actions/setup-go@v6
40 with:
41 go-version-file: go.mod
42
43 - run: go test ./...
44 - run: go build -o cmd/desync/ ./cmd/desync
45
46 - name: Race detector
47 if: runner.os == 'Linux'
48 run: go test -race ./...
49
50 - name: Static analysis
51 if: runner.os == 'Linux'
52 run: |
53 go vet ./...
54 test -z "$(gofmt -l .)" || { echo "Files need gofmt:"; gofmt -l .; exit 1; }
55 go mod tidy -diff