-
Notifications
You must be signed in to change notification settings - Fork 6
110 lines (87 loc) · 2.67 KB
/
Copy pathqa.yml
File metadata and controls
110 lines (87 loc) · 2.67 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
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
109
110
---
name: Quality Assurance
"on":
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
# Cancel prior runs on the same branch when a new one starts
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
if: github.event.pull_request.draft == false
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run unit tests with race detector
if: runner.os != 'Windows'
run: |
go test -race -v -coverprofile=coverage.out -coverpkg=./... ./...
mkdir coverage
go tool cover -func coverage.out -o coverage/coverage.out
go tool cover -html coverage.out -o coverage/coverage.html
- name: Run unit tests without race detector
if: runner.os == 'Windows'
run: |
go test -v -cover -coverpkg=./... ./...
- name: Test examples output
run: go test -v -tags e2e -count=1 ./examples_test.go
- uses: actions/upload-artifact@v7
if: ${{ runner.os == 'Linux' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
name: coverage
path: coverage
overwrite: true
lint:
name: Lint
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run linters
uses: golangci/golangci-lint-action@v9
with:
version: v2.11.4
args: --tests=false --timeout=5m
update-coverage:
name: Update coverage report
needs: test
if: ${{ !cancelled() && needs.test.result == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v8
with:
name: coverage
path: coverage
- name: Generate badge and report
run: |
COVERAGE="$(grep total coverage/coverage.out | awk '{print $3}')"
rm coverage/coverage.out
curl -o coverage/coverage.svg "https://img.shields.io/badge/coverage-${COVERAGE}25-green"
- name: Upload
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: coverage