...
1name: build
2
3on:
4 push:
5 branches:
6 - main
7 pull_request:
8 types: [opened, synchronize, reopened]
9
10jobs:
11 build:
12 runs-on: ubuntu-latest
13 strategy:
14 fail-fast: false
15 matrix:
16 go: ["1.19", "1.20", "1.21"]
17 steps:
18 - name: Checkout
19 uses: actions/checkout@v4
20 - name: Setup Go
21 uses: actions/setup-go@v5
22 with:
23 go-version: "${{ matrix.go }}"
24 check-latest: true
25 - name: Check Go code formatting
26 run: |
27 if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
28 gofmt -s -l .
29 echo "Please format Go code by running: go fmt ./..."
30 exit 1
31 fi
32 - name: Build
33 run: |
34 go install github.com/mfridman/tparse@latest
35 go vet ./...
36 go test -v -race -count=1 -json -cover ./... | tee output.json | tparse -follow -notests || true
37 tparse -format markdown -file output.json -all > $GITHUB_STEP_SUMMARY
38 go build ./...
39 coverage:
40 runs-on: ubuntu-latest
41 steps:
42 - name: Checkout
43 uses: actions/checkout@v4
44 - name: Setup Go
45 uses: actions/setup-go@v5
46 - name: Coverage
47 run: |
48 go test -v -covermode=count -coverprofile=coverage.cov ./...
49 - name: Coveralls
50 uses: coverallsapp/github-action@v2
51 with:
52 file: coverage.cov
53 format: golang
View as plain text