-
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (160 loc) · 6.11 KB
/
test.yml
File metadata and controls
179 lines (160 loc) · 6.11 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# SPDX-FileCopyrightText: 2026 The DMorph contributors.
# SPDX-License-Identifier: MPL-2.0
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
# Declare default permissions as read-only.
permissions: read-all
jobs:
FormatCheck:
strategy:
matrix:
go-version:
- "stable"
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{matrix.go-version}}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
- name: FormatCheck
run: if [ `go fmt ./... | wc -l` -gt 0 ] ; then echo "Found unformatted code" ; exit 1 ; else exit 0 ; fi
StaticCheck:
strategy:
matrix:
go-version:
- "stable"
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{matrix.go-version}}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
- name: StaticCheck
uses: dominikh/staticcheck-action@9716614d4101e79b4340dd97b10e54d68234e431 # v1.4.1
with:
version: latest
install-go: false
cache-key: ${{matrix.go-version}}
Test:
strategy:
matrix:
go-version:
- "stable"
platform:
#- macos-latest
- ubuntu-latest
#- windows-latest
runs-on: ${{matrix.platform}}
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{matrix.go-version}}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
- name: Test
run: go tool gotestsum --junitfile junit.xml -- -race -v `go list ./...` --covermode=atomic --coverpkg=./... --coverprofile=coverage.txt
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}
- name: Coverage
run: go tool cover -func=coverage.txt
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
# This action is mainly composed of snippets of github.com/jidicula/go-fuzz-action
# FuzzTest:
# strategy:
# matrix:
# go-version:
# - "stable"
# platform:
# #- macos-latest
# - ubuntu-latest
# #- windows-latest
# packages:
# - ./
# runs-on: ${{ matrix.platform }}
# steps:
# - name: Harden Runner
# uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
# with:
# egress-policy: audit
#
# - name: Install Go
# uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version: ${{matrix.go-version}}
#
# - name: Checkout
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# fetch-depth: 1
#
# - name: Run Fuzz Test
# shell: bash
# run: go test ${{ matrix.packages }} -fuzz="Fuzz" -fuzztime="30s" -fuzzminimizetime="10s"
#
# - name: Upload fuzz failure seed corpus as run artifact
# if: failure()
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
# with:
# name: testdata
# path: testdata
#
# - run: echo "EVENT NAME IS ${{ github.event_name }}"
# if: failure()
# shell: bash
#
# - name: Save PR head commit SHA
# if: failure() && github.event_name == 'pull_request'
# shell: bash
# run: |
# SHA="${{ github.event.pull_request.head.sha }}"
# echo "SHA=$SHA" >> $GITHUB_ENV
#
# - name: Save latest commit SHA if not PR
# if: failure() && github.event_name != 'pull_request'
# shell: bash
# run: echo "SHA=${{ github.sha }}" >> $GITHUB_ENV
#
# - name: Output message
# if: failure()
# shell: bash
# run: |
# MESSAGE='Fuzz test failed on commit ${{ env.SHA }}. To troubleshoot locally, use the [GitHub CLI](https://cli.github.com) to download the seed corpus with\n```\ngh run download ${{ github.run_id }} -n testdata\n```'
# DEEPLINK="https://github.com/${{ github.repository }}/commit/${{ env.SHA }}"
# echo -e "${MESSAGE/${{ env.SHA }}/$DEEPLINK}"
# echo -e "${MESSAGE/${{ env.SHA }}/[${GITHUB_SHA:0:8}]($DEEPLINK)}" >> $GITHUB_STEP_SUMMARY