-
Notifications
You must be signed in to change notification settings - Fork 0
25 lines (25 loc) · 738 Bytes
/
ci.yaml
File metadata and controls
25 lines (25 loc) · 738 Bytes
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
name: Continuous Integration
on: push
jobs:
run_code_checks:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Run linting
run: |
go fmt ./...
go vet ./...
- name: Run tests
run: go test -covermode=count -coverprofile=coverage.out ./...
- name: Check code coverage > 80%
run: |
total=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
if (( $(echo "$total <= 80" | bc -l) )) ; then
echo "code coverage $total% < 80%"
exit 1
fi