-
-
Notifications
You must be signed in to change notification settings - Fork 9
99 lines (94 loc) · 2.96 KB
/
push.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
94
95
96
97
98
99
# this workflow will run on all pushes.
on:
push:
name: "push"
jobs:
# run golangci-lint to lint the golang source code.
# the configuration is at /.golangci.yml.
linter:
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/[email protected]
-
name: Get go.mod details
uses: Eun/[email protected]
id: go-mod-details
-
name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ steps.go-mod-details.outputs.go_version }}
-
name: Lint
uses: golangci/[email protected]
with:
version: v1.42.1
# optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# use nancy to scan for vulnerabilities.
vulnerability_scanner:
name: Vulnerability scanner
runs-on: ubuntu-latest
steps:
-
uses: actions/[email protected]
-
uses: actions/setup-go@v5
# we cannot use nancy-github-action because it is outdated, so it's better to use the latest
# docker image for the validation
-
name: nancy
run: go list -json -m all | docker run -i sonatypecommunity/nancy:latest
# run golang test suite and collect their coverage.
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
-
name: Checkout code
uses: actions/[email protected]
-
name: Get go.mod details
uses: Eun/[email protected]
id: go-mod-details
-
name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ steps.go-mod-details.outputs.go_version }}
-
name: Test
run: go test -v -count=1 -coverprofile="coverage-${{ matrix.platform }}-${{ steps.go-mod-details.outputs.go_version }}.cov" -covermode=atomic ./...
-
name: Send coverage
uses: shogo82148/[email protected]
with:
path-to-profile: coverage-${{ matrix.platform }}-${{ steps.go-mod-details.outputs.go_version }}.cov
flag-name: ${{ matrix.platform }}-${{ steps.go-mod-details.outputs.go_version }}
parallel: true
# notifies that all test jobs are finished.
finish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: shogo82148/[email protected]
with:
parallel-finished: true
# draft your next release notes as pull requests are merged into "master"
# the configuration is at /.github/release-drafter.yml.
update_release_draft:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- uses: release-drafter/release-drafter@v6
if: github.ref_name == github.event.repository.default_branch
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}