-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.15 KB
/
Copy pathtest.yml
File metadata and controls
47 lines (40 loc) · 1.15 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
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
test:
name: Test on Go ${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.25.11", "1.26"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Run tests
run: go test -v -race -coverprofile=coverage.txt -coverpkg=github.com/MimoJanra/confkit ./...
- name: Check coverage
run: |
coverage=$(go tool cover -func=coverage.txt | grep total | awk '{print $3}' | sed 's/%//')
echo "Coverage: ${coverage}%"
if (( $(echo "$coverage < 75" | bc -l) )); then
echo "Coverage is below 75%"
exit 1
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
flags: unittests
name: codecov-${{ matrix.go-version }}