-
Notifications
You must be signed in to change notification settings - Fork 27
64 lines (54 loc) · 1.46 KB
/
Copy pathtest.yml
File metadata and controls
64 lines (54 loc) · 1.46 KB
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
name: Test
on:
push:
branches: ['**']
pull_request:
branches: ['**']
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Run tests with race detection
run: go test -v -race ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
- name: Generate coverage profile
run: go test -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.out
- name: Check coverage threshold
uses: vladopajic/go-test-coverage@v2
with:
config: ./.testcoverage.yml
profile: coverage.out
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
git-branch: badges
coverage-report:
name: Coverage report
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
actions: read
pull-requests: write
steps:
- uses: fgrosse/go-coverage-report@v1.1.1
with:
coverage-artifact-name: code-coverage
coverage-file-name: coverage.out