Skip to content

Commit f03a890

Browse files
committed
ci: add build workflow
1 parent 2665e93 commit f03a890

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/build.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
test:
13+
strategy:
14+
matrix:
15+
go-version: [ 1.19.x, 1.20.x, 1.21.x ]
16+
lint-and-coverage: [ false ]
17+
include:
18+
- go-version: 1.22.x
19+
lint-and-coverage: true
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Go ${{ matrix.go-version }}
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version: ${{ matrix.go-version }}
31+
32+
- name: Install dependencies
33+
run: go get ./...
34+
35+
- name: Build
36+
run: go build -v ./...
37+
38+
- name: Test with the Go CLI
39+
run: |
40+
go version
41+
if [ ${{ matrix.lint-and-coverage }} = true ]; then
42+
GO_TEST_OPTS="-covermode=atomic -coverprofile=coverage.out"
43+
fi
44+
export GORACE="halt_on_error=1"
45+
go test -race $GO_TEST_OPTS ./...
46+
47+
- name: Reporting coverage
48+
if: matrix.lint-and-coverage
49+
uses: shogo82148/actions-goveralls@v1
50+
with:
51+
path-to-profile: coverage.out

0 commit comments

Comments
 (0)