-
Notifications
You must be signed in to change notification settings - Fork 3
108 lines (101 loc) · 3.11 KB
/
ci.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: ci
on:
pull_request:
push:
branches:
- main
paths-ignore:
- README.md
- LICENSE
- '.github/**'
concurrency:
# For pull requests, cancel all currently-running jobs for this workflow
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install Golang pre-commit dependencies
run: |
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
go install -v github.com/go-critic/go-critic/cmd/gocritic@latest
- name: Setup Python v3
uses: actions/setup-python@v4
- name: Run pre-commit
uses: pre-commit/[email protected]
test:
name: Test Coverage
needs:
- pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Test
run: |
make test
- name: Generate Test Coverage
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Check Test Coverage
uses: vladopajic/go-test-coverage@v2
with:
config: ./.github/.testcoverage.yml
git-branch: badges
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
benchmark:
name: Performance Regression Check
if: github.ref_name == 'main'
runs-on: ubuntu-latest
needs:
- pre-commit
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: gobenchdata publish
run: go run go.bobheadxi.dev/gobenchdata@v1 action
env:
GITHUB_TOKEN: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
INPUT_PRUNE_COUNT: 30
INPUT_GO_TEST_FLAGS: -cpu 1,2
INPUT_PUBLISH: true
INPUT_PUBLISH_BRANCH: gh-pages
INPUT_BENCHMARKS_OUT: bench/results.json
release:
name: Semantic Release
if: github.ref_name == 'main'
needs:
- test
- benchmark
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Semantic Release
uses: go-semantic-release/action@v1
with:
github-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}