-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (69 loc) · 1.71 KB
/
Copy pathpr-checks.yml
File metadata and controls
74 lines (69 loc) · 1.71 KB
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
name: Pull Request checks
on:
push:
branches:
- main
- master
pull_request:
permissions:
contents: read
jobs:
lint:
name: Verify linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: stable
- name: Run go vet
run: go vet ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.5
mod-tidy:
name: Check if go mod tidy is needed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: stable
- run: |
go mod tidy
if [ -n "$(git status --porcelain)" ]; then
echo "go mod tidy failed"
git diff
exit 1
fi
go-generate:
name: Check if generated files are up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: stable
- run: |
go generate ./...
if [ -n "$(git status --porcelain)" ]; then
echo "Generated files are out of date. Please run 'go generate ./...' and commit the changes."
git diff
exit 1
fi
test:
name: Run Go Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: stable
- run: go test ./... -v -coverprofile=profile.cov
- uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
- uses: codecov/codecov-action@v5
with:
files: profile.cov