-
Notifications
You must be signed in to change notification settings - Fork 188
82 lines (80 loc) · 2.28 KB
/
ci.yml
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
80
81
82
# Copyright (c) 2004-present Facebook All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
name: Continuous Integration
on:
pull_request:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Run linters
uses: golangci/[email protected]
with:
version: v1.55.2
test:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.20', '1.21']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run tests
run: go test -race ./...
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: arduino/setup-protoc@v1
with:
version: v3.19.4
- name: Install protoc plugins
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
- name: Install protoc-gen-entgrpc
working-directory: entproto/cmd/protoc-gen-entgrpc
run: go install
- name: Install protoc-gen-ent
working-directory: entproto/cmd/protoc-gen-ent
run: go install
- name: Run go generate
run: go generate ./...
- name: Go mod tidy
run: go mod tidy
- name: Check generated files
run: |
status=$(git status --porcelain | cat)
if [ -n "$status" ]; then
echo "you need to run 'go generate ./...' and commit the changes"
echo "$status"
git diff
exit 1
fi