-
Notifications
You must be signed in to change notification settings - Fork 11
77 lines (70 loc) · 2.41 KB
/
code.yaml
File metadata and controls
77 lines (70 loc) · 2.41 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
name: Code
on:
push:
tags:
- v*
branches:
- main
- v*
pull_request:
schedule:
- cron: '38 5 * * 3'
concurrency:
group: ${{ format('{0}-{1}', github.workflow, github.head_ref) }}
cancel-in-progress: true
permissions: read-all
jobs:
GoVersions:
name: Lookup Go versions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
latest: ${{ steps.versions.outputs.latest }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.5.0
- uses: arnested/go-version-action@1f4135a30a2498f919e428c81c342f9334b3a93d #v1.1.22
id: versions
Lint:
runs-on: ubuntu-latest
needs: GoVersions
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.5.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: ${{ needs.GoVersions.outputs.latest }}
- name: Verify Config
run: go tool -modfile=".github/tools/go.mod" golangci-lint config verify --verbose
- name: Run Linter
run: go tool -modfile=".github/tools/go.mod" golangci-lint run --verbose
UnitTestJob:
runs-on: ubuntu-latest
needs: GoVersions
strategy:
matrix:
go: ${{ fromJSON(needs.GoVersions.outputs.matrix) }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.5.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: ${{ matrix.go }}
- run: go test -race -cover -coverprofile=coverage.out -covermode=atomic ./...
- run: go test -json 2>&1 | go tool -modfile=".github/tools/go.mod" go-junit-report -parser gojson > junit.xml
if: always()
- name: Upload coverage reports to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
UnitTests:
if: ${{ always() }}
needs: UnitTestJob
runs-on: ubuntu-latest
steps:
- name: Check status
if: ${{ needs.UnitTestJob.result != 'success' }}
run: exit 1