-
Notifications
You must be signed in to change notification settings - Fork 22
93 lines (75 loc) · 1.98 KB
/
ci-build.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
86
87
88
89
90
91
92
93
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
report:
name: Refresh GoReportCard
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Trigger report refresh
uses: creekorful/[email protected]
lint:
name: Lint project
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Setup Go 1.20
uses: actions/setup-go@v4
with:
go-version: "^1.20"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Run vet
run: go vet ./...
- name: Run staticcheck
run: go run honnef.co/go/tools/cmd/staticcheck@latest ./...
build_gomanifest:
name: Build GoManifest on ${{ matrix.os }}
needs: [lint]
strategy:
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: gomanifest
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Setup Go 1.15
uses: actions/setup-go@v4
with:
go-version: 1.15
- name: Build tool
run: go build -o ${{ runner.temp }}/gomanifest
build_module:
name: Build module
needs: [lint]
strategy:
matrix:
version: ["1.18", "1.19", "1.20"]
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Setup Go ${{ matrix.version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.version }}
- name: Verify go.mod
run: |
go mod tidy
git diff --exit-code go.mod
- name: Unit Test
run: go test `go list ./... | grep -v acceptance-tests` -gcflags=-l -v -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}