-
-
Notifications
You must be signed in to change notification settings - Fork 150
92 lines (89 loc) · 2.3 KB
/
go.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Go
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build on limited environment
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: build
run: docker-compose run go-json
test:
name: Test
strategy:
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
go-version: [ "1.19", "1.20", "1.21" ]
runs-on: ${{ matrix.os }}
steps:
- name: setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: checkout
uses: actions/checkout@v3
- name: simple test
run: go test -v ./... -count=1
- name: test with GC pressure
run: go test -v ./... -count=1
env:
GOGC: 1
- name: test with race detector
run: go test -v -race ./... -count=1
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: lint
run: |
make lint
bench:
name: Benchmark
runs-on: ubuntu-latest
steps:
- name: setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: checkout ( feature )
uses: actions/checkout@v3
- name: run benchmark ( feature )
run: cd benchmarks && go test -bench GoJson | tee $HOME/new.txt
- name: install benchstat
run: go install golang.org/x/perf/cmd/benchstat@latest
- name: checkout ( master )
uses: actions/checkout@v3
with:
ref: master
- name: run benchmark ( master )
run: cd benchmarks && go test -bench GoJson | tee $HOME/old.txt
- name: compare benchmark results
run: benchstat $HOME/old.txt $HOME/new.txt
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: measure coverage
run: make cover
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}