-
Notifications
You must be signed in to change notification settings - Fork 12
81 lines (74 loc) · 2.59 KB
/
Copy pathcode.yaml
File metadata and controls
81 lines (74 loc) · 2.59 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
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v5.5.0
- uses: arnested/go-version-action@83df3d2be676ba748e3c243a7f996e76c28cff23 #v2.1.7
id: versions
Lint:
runs-on: ubuntu-latest
needs: GoVersions
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v5.5.0
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v5.5.0
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go }}
- run: go test -race -cover -coverprofile=coverage.out -covermode=atomic ./...
- run: go test -json 2>&1 | go -C .github/tools tool go-junit-report -parser gojson > junit.xml
if: always()
env:
# the tools module may require a newer Go than the matrix version;
# `go -C` (unlike `-modfile`) lets the toolchain switch automatically
GOTOOLCHAIN: auto
- name: Upload coverage reports to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.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