-
Notifications
You must be signed in to change notification settings - Fork 49
120 lines (114 loc) · 3.65 KB
/
test.yaml
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
111
112
113
114
115
116
117
118
119
120
name: Go
on:
push:
branches: ["main"]
pull_request:
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: 🛡️ Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
disable-sudo: true
policy: test
- name: 🚚 Check out the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: 🏗️ Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: stable
- name: 📡 Run `go telemetry on`
run: |
go telemetry on
- name: 🧪 Run `go test`
run: |
go test -coverpkg=$(go list ./... | grep -v 'internal/mocks' | tr '\n' ',') -coverprofile=coverage.txt -race -v ./...
- name: ☂️ Report coverage rates to Codecov
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
with:
fail_ci_if_error: true # default: false
file: ./coverage.txt
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
fuzz:
name: Fuzz
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
concurrency:
group: ${{ github.workflow }}-fuzz-${{ github.ref }}
cancel-in-progress: true
env:
FUZZTIME: "60s"
steps:
- name: 🛡️ Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
disable-sudo: true
policy: test.fuzz
- name: 🚚 Check out the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: 🏗️ Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: stable
- name: 🧪 Run `go test`
run: |
go test ./test/fuzzer -fuzztime ${{ env.FUZZTIME }} -fuzz FuzzParseList
go test ./test/fuzzer -fuzztime ${{ env.FUZZTIME }} -fuzz FuzzParseExpression
regenerate:
name: Regenerate
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: 🛡️ Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
disable-sudo: true
policy: test.regenerate
- name: 🚚 Check out the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: 🏗️ Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: stable
- name: 🧪 Run `go mod tidy`
run: |
go mod tidy
- name: 🔍 Check if any files are changed
run: |
if ! git diff --exit-code; then
echo "Please run 'go mod tidy'"
exit 1
fi
- name: 🎭 Install GoMock
run: go install go.uber.org/mock/[email protected]
- name: 🧪 Run `go generate`
run: |
rm ./internal/mocks -rf
go generate ./...
- name: 🔍 Check if any files are changed
run: |
if ! git diff --exit-code; then
echo "Please run 'go gonerate ./...'"
exit 1
fi