File tree 1 file changed +33
-22
lines changed
1 file changed +33
-22
lines changed Original file line number Diff line number Diff line change 1
1
name : Go
2
2
3
- on : [push, pull_request]
3
+ on :
4
+ push :
5
+ branches : main
6
+ pull_request :
7
+ types : [opened, synchronize, ready_for_review]
4
8
5
9
jobs :
6
-
7
10
build :
8
11
runs-on : ubuntu-latest
12
+
9
13
steps :
10
- - uses : actions/checkout@v4
11
- - name : Set up Go
12
- uses : actions/setup-go@v5
13
- with :
14
- go-version : " 1.23"
15
- - name : Check Formatting
16
- run : |
17
- if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
18
- gofmt -s -l .
19
- echo "Please format Go code by running: go fmt ./..."
20
- exit 1
21
- fi
22
- - name : Build
23
- run : go build -v ./...
24
- - name : Test
25
- run : go test -v ./... -coverprofile=coverage.out -covermode=atomic
26
- - name : Codecov
27
- uses : codecov/codecov-action@v5
28
- env :
29
- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
14
+ - uses : actions/checkout@v4
15
+
16
+ - name : Set up Go
17
+ uses : actions/setup-go@v5
18
+ with :
19
+ go-version : " 1.23"
20
+
21
+ - name : Check Formatting
22
+ run : |
23
+ unformatted=$(gofmt -s -l .)
24
+ if [ -n "$unformatted" ]; then
25
+ echo "::error::The following files are not formatted properly:"
26
+ echo "$unformatted"
27
+ echo "Please run `gofmt -s -w .` to format your code."
28
+ exit 1
29
+ fi
30
+
31
+ - name : Build
32
+ run : go build -v ./...
33
+
34
+ - name : Test
35
+ run : go test -v ./... -coverprofile=coverage.out -covermode=atomic
36
+
37
+ - name : Codecov
38
+ uses : codecov/codecov-action@v5
39
+ env :
40
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
You can’t perform that action at this time.
0 commit comments