-
-
Notifications
You must be signed in to change notification settings - Fork 2
136 lines (119 loc) · 3.23 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
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: [ '!*' ]
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
cache-dependency-path: tools/go.sum
check-latest: true
- name: Set up environment
run: make tools
- name: Run linter
run: make lint
- name: Run fast check the state
run: make fast-check
test:
name: Testing
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go:
- 1.x
- 1.11.x
- 1.12.x
- 1.13.x
- 1.14.x
- 1.15.x
- 1.16.x
- 1.17.x
- 1.18.x
- 1.19.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]
if: matrix.go == '1.21.x'
with: { name: code-coverage-report, path: c.out }
report:
name: Reporting
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/[email protected]
with: { fetch-depth: 0 }
- name: Fetch code coverage report
uses: actions/[email protected]
with: { name: code-coverage-report }
- name: Send code coverage report to Codecov (codecov.io)
uses: codecov/[email protected]
with: { files: c.out }
notify:
name: Notifying
needs: [ lint, test ]
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') }}