-
Notifications
You must be signed in to change notification settings - Fork 6
79 lines (68 loc) · 1.74 KB
/
pr.yaml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
name: Pull Request
on:
pull_request:
branches:
- main
- 'v*'
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
check-latest: true
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/cerbos-cloud-api/bin
key: generate-${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
generate-${{ runner.os }}-go-
- name: Test
run: make test
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
check-latest: true
- name: golangci-lint
uses: golangci/[email protected]
with:
version: latest
args: '--config=.golangci.yaml --fix'
- name: Check repo status
run: |-
make generate
REPO_STATUS="$(git status --porcelain)"
if [[ ! -z $REPO_STATUS ]]; then
echo "::error::Uncommitted changes detected"
echo "$REPO_STATUS"
git status -vv
exit 1
fi
buf:
name: Proto check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Buf
uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
- name: Lint protos
uses: bufbuild/[email protected]
- name: Check formatting
run: buf format --diff --exit-code