-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (77 loc) · 1.97 KB
/
ltb.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
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
82
83
84
85
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Lint | Test
on:
pull_request:
branches:
- "main"
push:
branches:
- 'main'
env:
GO_VER: '1.24.*'
permissions:
contents: read # allow read access to the content for analysis.
checks: write # allow write access to checks to allow the action to annotate code in the PR.
actions: read # to download code coverage results from "test" job
pull-requests: write # write permission needed to comment on PR
jobs:
lint:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v4
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VER }}
cache: false
-
name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.64.2
test:
strategy:
fail-fast: false
max-parallel: 4
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 3
steps:
-
uses: actions/checkout@v4
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VER }}
-
name: Run test suite
run: |
go test $(go list ./...)
-
name: Run Cover Profile
if: runner.os == 'Linux'
run: |
go test -cover -coverprofile=coverage.txt $(go list ./...)
-
name: Archive code coverage results
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.txt
code_coverage:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'pull_request'
steps:
-
name: Go Code Coverage
uses: fgrosse/[email protected]
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "coverage.txt"