-
-
Notifications
You must be signed in to change notification settings - Fork 9
66 lines (54 loc) · 1.58 KB
/
ci.yml
File metadata and controls
66 lines (54 loc) · 1.58 KB
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
name: CI
on:
push:
permissions:
contents: write
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go-version: ['1.25.0']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies and tools
run: make deps
- name: Run tests
run: make test
- name: Run linter
run: make lint
- name: Test with coverage
run: make cover
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6.0.0
with:
fail_ci_if_error: true
file: ./coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Check coverage threshold
if: matrix.os == 'ubuntu-latest'
run: |
total=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
threshold=80.0
awk "BEGIN {exit !(total < threshold)}" && \
echo "Coverage $total% is below threshold $threshold%" && exit 1 || \
echo "Coverage $total% is above threshold $threshold%"
- name: Build
run: make build