-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (60 loc) · 1.55 KB
/
golang-ci.yaml
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
name: "Golang CI"
on:
push: { }
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
matrix-prep:
runs-on: ubuntu-latest
outputs:
paths: '["configloader","pkg", "telemetry"]'
steps:
- run: echo "Preparing matrix"
golang-ci:
needs: matrix-prep
name: "Lint Modules"
runs-on: ubuntu-latest
strategy:
matrix:
path: ${{ fromJson(needs.matrix-prep.outputs.paths) }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60.3
working-directory: ${{ matrix.path }}
args: --out-format line-number --color never -v ./...
gotest:
needs: matrix-prep
name: "Test Modules"
runs-on: ubuntu-latest
strategy:
matrix:
path: ${{ fromJson(needs.matrix-prep.outputs.paths) }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Run tests with coverage
run: |
cd ${{ matrix.path }}
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
build:
needs:
- "golang-ci"
- "gotest"
if: always()
runs-on: ubuntu-latest
steps:
- run: exit 1
name: "Catch errors"
if: |
needs.golang-ci.result == 'failure' || contains(needs.*.result, 'failure')