-
Notifications
You must be signed in to change notification settings - Fork 29
54 lines (50 loc) · 1.38 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
name: CI
on:
pull_request:
push:
workflow_dispatch:
jobs:
test:
name: Run unit tests
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Ensure coverage is reported for every package
run: |
find pkg -type d -print0 | while IFS= read -r -d '' dir; do
go_file=$(ls -1 $dir | grep '\.go$' | grep -v '_test\.go$' | head -n1)
if [[ $go_file ]]; then
package_line=$(grep '^package' ${dir}/${go_file} | head -n1)
echo "${package_line}_test" >$dir/package_coverage_test.go
fi
done
- name: Run unit tests
run: make test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
name: golangci-lint
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- name: Run lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=10m
only-new-issues: true
typos:
name: Check typos
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
- uses: crate-ci/typos@master
with:
config: hack/typos.toml