-
Notifications
You must be signed in to change notification settings - Fork 43
63 lines (52 loc) · 1.68 KB
/
tests.yaml
File metadata and controls
63 lines (52 loc) · 1.68 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
name: Go Tests
on:
push:
# Cancel redundant jobs (if a new job is triggered for the same workflow and ref)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Go 1.x
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
with:
# https://github.com/golangci/golangci-lint/releases/tag/v2.11.4
version: v2.11.4
unitTest:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- name: Check out code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Go 1.x
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version-file: go.mod
- name: Install gotestsum
run: go install gotest.tools/gotestsum@v1.13.0
- name: Unit Tests
id: unit_tests
continue-on-error: true
run: |
gotestsum --junitfile=test-report.xml -- ./... -coverprofile=coverage.out
go tool cover -func=coverage.out
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3
if: always()
with:
name: Unit Test Results
path: test-report.xml
reporter: java-junit
- name: Fail job if tests failed
if: steps.unit_tests.outcome == 'failure'
run: exit 1