Skip to content

Commit 35ccf02

Browse files
committed
release CI workflow
1 parent 5ee2cb1 commit 35ccf02

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
linting:
11+
name: Run Code Linters and Tests
12+
runs-on: ubuntu-latest
13+
14+
container:
15+
image: golang:alpine
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go environment
22+
run: |
23+
go mod download
24+
go install ./...
25+
26+
- name: Go vet
27+
run: go vet ./...
28+
29+
- name: Run tests and enforce coverage threshold
30+
run: |
31+
go test -v -coverprofile=coverage.out ./...
32+
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
33+
echo "Coverage - $COVERAGE"
34+
if [ $(echo "$COVERAGE < 95.0" | bc) -eq 1 ]; then
35+
echo "ERROR - Test coverage is below 95%: $COVERAGE"
36+
exit 1
37+
fi
38+
39+
- name: Upload coverage file
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: coverage
43+
path: coverage.out
44+

0 commit comments

Comments
 (0)