Repository navigation
50 lines (46 loc) · 1.45 KB
/
Copy pathci.yml
File metadata and controls
50 lines (46 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: gofmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "Files not formatted with gofmt:" && echo "$unformatted" && exit 1
fi
- run: go mod tidy -diff
- run: go vet ./...
- run: go test -race ./...
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: bufbuild/buf-action@v1
with:
# keep in sync with the local buf: the descriptor set differs across versions
version: 1.75.0
setup_only: true
- run: buf format --diff --exit-code
- run: buf lint
- name: buf breaking
if: github.event_name == 'pull_request'
run: buf breaking --against "https://github.com/${{ github.repository }}.git#branch=${{ github.base_ref }}"
- name: Generated Go code is up to date
run: |
buf generate --template ./proto/buf.gen.yaml ./proto
git diff --exit-code -- proto
- name: Test descriptor set is up to date
run: |
buf build -o ./testdata/descriptor.binpb
git diff --exit-code -- testdata/descriptor.binpb || (echo "Run 'task golden' and commit the result" && exit 1)