Skip to content

Commit 8dd60ed

Browse files
committed
CI/CD - GitHub Actions
1 parent e6ee88d commit 8dd60ed

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

.github/workflows/bench.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Benchmark Performance
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- main
7+
push:
8+
branches:
9+
- master
10+
- main
11+
permissions:
12+
# deployments permission to deploy GitHub pages website
13+
deployments: write
14+
# contents permission to update benchmark contents in gh-pages branch
15+
contents: write
16+
17+
jobs:
18+
benchmark:
19+
name: Performance regression check
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-go@v4
24+
with:
25+
go-version: "stable"
26+
- name: Install dependencies
27+
run: go mod tidy
28+
- name: Run benchmark
29+
run: go test ./... -bench=. -benchmem -count 2 -timeout 1m | tee benchmarks.txt
30+
# Download previous benchmark result from cache (if exists)
31+
- name: Download previous benchmark data
32+
uses: actions/cache@v4
33+
with:
34+
path: ./cache
35+
key: ${{ runner.os }}-benchmark
36+
# Run `github-action-benchmark` action
37+
- name: Store benchmark result
38+
uses: benchmark-action/github-action-benchmark@v1
39+
with:
40+
name: Go Benchmark
41+
tool: 'go'
42+
output-file-path: benchmarks.txt
43+
github-token: ${{ secrets.GITHUB_TOKEN }}
44+
auto-push: true
45+
# Show alert with commit comment on detecting possible performance regression
46+
alert-threshold: '200%'
47+
comment-on-alert: true
48+
fail-on-alert: true
49+
alert-comment-cc-users: '@ndyakov'

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install dependencies
2020
run: go mod tidy
2121
- name: Run tests with coverage
22-
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
22+
run: go test ./... -coverprofile=./cover.out -covermode=atomic -race -count 2 -timeout 1m
2323
- name: Upload coverage
2424
uses: actions/upload-artifact@v4
2525
with:

0 commit comments

Comments
 (0)