-
Notifications
You must be signed in to change notification settings - Fork 214
55 lines (50 loc) · 1.59 KB
/
test-and-build.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
name: Test and Build
on:
push:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: go.mod
- run: go mod download
- name: Check Formatting
run: |-
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
- name: Vet code
run: go vet ./...
go-test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- '1.13' # oldest supported; named in go.mod
- 'oldstable'
- 'stable'
env:
TEST_RESULTS_PATH: '/tmp/test-results'
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ matrix.go-version }}
- uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0
- run: mkdir -p "$TEST_RESULTS_PATH"
- name: Run go tests
run: |
gotestsum --format=short-verbose --junitfile "$TEST_RESULTS_PATH/gotestsum-report.xml" -- ./...
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
path: ${{ env.TEST_RESULTS_PATH }}
name: tests-linux