File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments