-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (43 loc) · 1.43 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
on: [push, pull_request]
name: CI
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Go 1.23.2
uses: actions/setup-go@v4
with:
go-version: "1.23.2"
check-latest: true
- name: Checkout repository
uses: actions/checkout@v3
- name: Install gomock
run: go install go.uber.org/mock/mockgen@latest
# Test
- name: Test
run: go test -v -race ./...
- name: Calculate coverage
run: go test -v -covermode=count -coverprofile=coverage.out
- name: Convert coverage.out to coverage.lcov
uses: jandelgado/gcov2lcov-action@v1.0.9
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage.lcov
- name: Run go vet
continue-on-error: true
run: go vet ./...
# Make sure go generate was executed before commit
- name: Go generate
run: go generate
- name: Check file changes after running go generate
run: |
git diff --exit-code
id: diff_files_after_go_generate
continue-on-error: true
- name: Fail if changes are detected
if: steps.diff_files_after_go_generate.outcome == 'failure'
run: |
echo "Detected uncommitted changes after running go generate." \
"Please run go generate and commit changes." && exit 1