-
Notifications
You must be signed in to change notification settings - Fork 9
75 lines (64 loc) · 1.87 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
name: Go
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: write
statuses: write
checks: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "stable"
- name: Build
run: go build -v ./...
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@latest
- name: Run Tests and Generate Test Report
run: |
mkdir -p reports
go test -v ./... 2>&1 | go-junit-report > reports/report.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: 'reports/report.xml'
check_name: 'Go Tests'
comment_title: 'Go Test Results'
commit: ${{ github.event.pull_request.head.sha || github.sha }}
github_token: ${{ secrets.GITHUB_TOKEN }}
hide_comments: 'all but latest'
deduplicate_classes_by_file_name: true
benchmark:
name: Run Go benchmarks
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.x'
- name: Run benchmarks
run: |
mkdir -p benchmarks
go test -bench . -benchmem -run=^$ ./... > benchmarks/benchmark.txt
- name: Post Benchmark Results
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'go'
output-file-path: 'benchmarks/benchmark.txt'
github-token: ${{ secrets.GITHUB_TOKEN }}
ref: 'main'
comment-on-alert: true
alert-threshold: '15%'
fail-on-alert: true
summary-always: true