-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (56 loc) · 1.43 KB
/
check.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
name: Check
on:
push:
branches:
- main
pull_request:
jobs:
mocks:
name: Check if all mocks are generated properly
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.20"]
steps:
- uses: actions/checkout@v2
- name: Set go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Install mockgen
run: |
go install github.com/golang/mock/[email protected]
- name: Check generated mocks
run: |
# add mockgen to PATH
export PATH=$PATH:~/go/bin
go generate ./...
if [ -n "$(git status --porcelain)" ]
then
git status --short; \
echo; \
echo "Did you remember to regenerate all sources? Run \`go generate ./...\` and commit the result."; \
exit 1; \
fi
mod:
name: Check if `go mod tidy` is ran
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.20"]
steps:
- uses: actions/checkout@v2
- name: Set go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Check generated mocks
run: |
go mod tidy
if [ -n "$(git status --porcelain)" ]
then
git status --short; \
echo; \
echo "Did you remember to run `go mod tidy`? Run `go mod tidy` and commit the result."; \
exit 1; \
fi