-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (88 loc) · 2.64 KB
/
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
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
branches: [ main ]
env:
CGO_ENABLED: 0
GOMAXPROCS: 2
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# linter includes gosec scan
lint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up go
timeout-minutes: 10
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
token: ${{ secrets.GITHUB_TOKEN }}
cache: true
- name: Get dependencies
timeout-minutes: 10
run: make download
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
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: v1.60.2
args: ./...
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-cache: true
only-new-issues: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up go
timeout-minutes: 10
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
token: ${{ secrets.GITHUB_TOKEN }}
cache: true
- name: Get dependencies
timeout-minutes: 10
run: make download
- name: Build
timeout-minutes: 10
run: make build
- name: Gotestsum installer
uses: autero1/[email protected]
with:
gotestsum_version: 1.11.0
- name: Unit test
timeout-minutes: 10
run: |
gotestsum --format github-actions -- ./... -skip test -cover -coverprofile coverage.out -covermode count
go tool cover -func=coverage.out -o coverage-report.txt
bump-version:
if: github.event_name != 'pull_request' && github.event_name != 'release'
needs: [build, lint]
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: Bump-Version-'${{ github.workflow }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}