-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (49 loc) · 1.68 KB
/
main.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
name: Main
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x
cache: true
- name: Run golangci-lint
# run: |
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.30.0
# $(go env GOPATH)/bin/golangci-lint run --timeout=5m -c .golangci.yml
uses: golangci/golangci-lint-action@v3
### golangci-lint will take much time if loading multiple linters in .golangci.yml
with:
version: latest
args: --timeout 5m --verbose
skip-cache: false
skip-pkg-cache: false
skip-build-cache: false
only-new-issues: true
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go environment
uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Tidy go module
run: |
go mod tidy
if [[ $(git status --porcelain) ]]; then
git diff
echo
echo "go mod tidy made these changes, please run 'go mod tidy' and include those changes in a commit"
exit 1
fi
- name: Run Go test
run: go test -v -timeout=30m ./...
- name: Run Go test -race
if: github.ref == 'refs/heads/stage' || startsWith(github.ref, 'refs/heads/release')
run: go test -vet=off -timeout=30m -race ./... # note that -race can easily make the crypto stuff 10x slower