-
-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (124 loc) · 3.31 KB
/
ci.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Continuous integration
on:
pull_request:
branches: [ main ]
paths:
- '.github/workflows/ci.yml'
- '.golangci.yml'
- '**.go'
- 'go.{mod,sum}'
- 'Makefile'
- 'Taskfile'
push:
branches: [ main ]
paths:
- '.github/workflows/ci.yml'
- '.golangci.yml'
- '**.go'
- 'go.{mod,sum}'
- 'Makefile'
- 'Taskfile'
tags: [ 'v*' ]
schedule:
- cron: 0 7 1 * * # at 07:00 on day-of-month 1, UTC
workflow_dispatch:
inputs:
reason:
description: The reason for dispatching it manually.
type: string
default: manual healthcheck
required: true
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/[email protected]
with: { fetch-depth: 0 }
- name: Set up Go environment
uses: actions/[email protected]
with:
go-version: 1.21.x
check-latest: true
- name: Run linter
uses: golangci/[email protected]
test:
name: Testing
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go:
- 1.x
- 1.20.x
- 1.21.x
steps:
- name: Checkout the repository
uses: actions/[email protected]
with: { fetch-depth: 0 }
- name: Set up Go environment
uses: actions/[email protected]
with:
go-version: '${{ matrix.go }}'
check-latest: true
- name: Set up environment
run: make env deps
- name: Run fast check source code
run: make go-check
- name: Run tests
run: make test
if: matrix.go != '1.21.x'
- name: Run tests with coverage report
run: make test-with-coverage
if: matrix.go == '1.21.x'
- name: Store code coverage report
uses: actions/[email protected]
with: { name: code-coverage-report, path: c.out }
if: matrix.go == '1.21.x'
- name: Check installation
run: |
make install
[ $(ls bin/linux/*/* | wc -l) = 1 ]
publish:
name: Documentation
needs: [ test ]
uses: ./.github/workflows/cd.docs.yml
permissions:
id-token: write
pages: write
if: true
release:
name: Distribution
needs: [ test ]
uses: ./.github/workflows/cd.dist.yml
secrets:
GORELEASER_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
if: startsWith(github.ref, 'refs/tags/v')
report:
name: Reporting
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Fetch code coverage report
uses: actions/[email protected]
with: { name: code-coverage-report }
- name: Send code coverage report to Codecov
uses: codecov/[email protected]
with: { files: c.out }
notify:
name: Notifying
needs: [ lint, report ]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
&& (failure() || success())
steps:
- name: Checkout the repository
uses: actions/[email protected]
with: { fetch-depth: 0 }
- name: Send notification
uses: ./.github/actions/notify
with:
emoji: ⚙️
channel: ${{ secrets.SLACK_WEBHOOK }}
success: ${{ ! contains(needs.*.result, 'failure') }}