-
Notifications
You must be signed in to change notification settings - Fork 126
80 lines (69 loc) · 1.88 KB
/
Copy pathgo.yml
File metadata and controls
80 lines (69 loc) · 1.88 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
name: Unit-Tests
on:
pull_request:
paths:
- "go.mod"
- "**.go"
- "**.yml"
push:
branches: # Only trigger branch pushes; tag pushes are ignored.
- "**"
paths:
- "go.mod"
- "**.go"
- "**.yml"
permissions:
contents: read
jobs:
test:
name: Test on go ${{ matrix.go_version }}
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [1.21, 1.22, 1.23, 1.24, 1.25, "stable"]
# os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Setup Go SDK
uses: actions/setup-go@v6
timeout-minutes: 3
with:
go-version: ${{ matrix.go_version }}
- name: Run unit tests
# run: go test -v -cover ./...
# must add " for profile.cov on Windows OS
run: go test -coverprofile="profile.cov" ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
flag-name: Go-${{ matrix.go_version }}
shallow: true
parallel: true
lint:
name: code linter
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Setup Go SDK
uses: actions/setup-go@v6
timeout-minutes: 3
with:
go-version: "stable"
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
args: --issues-exit-code=0
# notifies that all test jobs are finished.
finish:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
shallow: true
parallel-finished: true