...
1name: Go
2on:
3 push:
4 branches:
5 - master
6 pull_request:
7jobs:
8 build:
9 name: Build on limited environment
10 runs-on: ubuntu-latest
11 steps:
12 - name: checkout
13 uses: actions/checkout@v3
14 - name: build
15 run: docker-compose run go-json
16 test:
17 name: Test
18 strategy:
19 matrix:
20 os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
21 go-version: [ "1.18", "1.19", "1.20" ]
22 runs-on: ${{ matrix.os }}
23 steps:
24 - name: setup Go ${{ matrix.go-version }}
25 uses: actions/setup-go@v3
26 with:
27 go-version: ${{ matrix.go-version }}
28 - name: checkout
29 uses: actions/checkout@v3
30 - name: simple test
31 run: go test -v ./... -count=1
32 - name: test with GC pressure
33 run: go test -v ./... -count=1
34 env:
35 GOGC: 1
36 - name: test with race detector
37 run: go test -v -race ./... -count=1
38 bench:
39 name: Benchmark
40 runs-on: ubuntu-latest
41 steps:
42 - name: setup Go
43 uses: actions/setup-go@v3
44 with:
45 go-version: '1.20'
46 - name: checkout ( feature )
47 uses: actions/checkout@v3
48 - name: run benchmark ( feature )
49 run: cd benchmarks && go test -bench GoJson | tee $HOME/new.txt
50 - name: install benchstat
51 run: go install golang.org/x/perf/cmd/benchstat@latest
52 - name: checkout ( master )
53 uses: actions/checkout@v3
54 with:
55 ref: master
56 - name: run benchmark ( master )
57 run: cd benchmarks && go test -bench GoJson | tee $HOME/old.txt
58 - name: compare benchmark results
59 run: benchstat $HOME/old.txt $HOME/new.txt
60 coverage:
61 name: Coverage
62 runs-on: ubuntu-latest
63 steps:
64 - name: setup Go
65 uses: actions/setup-go@v3
66 with:
67 go-version: '1.20'
68 - name: checkout
69 uses: actions/checkout@v3
70 - name: measure coverage
71 run: make cover
72 - uses: codecov/codecov-action@v3
73 with:
74 fail_ci_if_error: true
75 verbose: true
View as plain text