-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (55 loc) · 2.13 KB
/
ci.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
name: CI
on: [push, pull_request]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: 'go.mod'
- name: Setup buf dependencies
run: |
go install github.com/bufbuild/buf/cmd/[email protected] && \
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected] && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc && \
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected] && \
go install google.golang.org/protobuf/cmd/[email protected]
- name: Cache go modules
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Make buf
run: |
make buf
- name: Check if Go code has changed
run: |
if git diff; then
echo "Generated Go code has not changed."
else
echo "Generated Go code has changed. Please make sure to commit the changes."
exit 1
fi
- name: Run go tests
run: make unit-tests
- name: Upload coverage to Coveralls
uses: shogo82148/actions-goveralls@e6875f831db61e6abffbd8df91a2eb6cd24b46c9 # v1.9.1
with:
path-to-profile: 'cov.out'
go-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: 'go.mod'
- name: go-lint
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0