-
Notifications
You must be signed in to change notification settings - Fork 6
71 lines (63 loc) · 1.78 KB
/
test_and_lint.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
on:
push:
branches: [ "main" ]
name: Test & Lint
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: stable
- run: go mod tidy
- run: go get
- run: go generate ./...
# https://blog.jetbrains.com/go/2019/04/03/profiling-go-applications-and-tests/
- run: go test -v -bench=^BenchmarkInBoundsChannels$ -cpuprofile=cpu.out -memprofile mem.out .
# 第一遍是冷启动,再进行一次测试
- run: go test -v . -count=1
- run: go test -v . -count=1
- run: go test -v . -count=1
- name: Upload
uses: actions/upload-artifact@v4
with:
name: cpu-profile
path: ./cpu.out
- name: Upload
uses: actions/upload-artifact@v4
with:
name: mem-profile
path: ./mem.out
lint:
runs-on: ubuntu-latest
steps:
- name: Code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.18'
- run: go mod tidy
- run: go get
- run: go generate ./...
- name: Go vet
run: go vet -unreachable=false ./...
- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v3
if: github.event.name == 'pull_request'
with:
go-version: '1.18'
version: 'v1.57.2'
args: '--timeout 9999s'
only-new-issues: true
skip-pkg-cache: true
skip-build-cache: true
- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v3
if: github.event.name != 'pull_request'
with:
version: 'v1.51.2'
args: '--timeout 9999s'