...
1name: Tests
2
3on:
4 push:
5 branches:
6 - main
7 pull_request:
8 branches:
9 - main
10
11jobs:
12 build-and-test:
13 strategy:
14 matrix:
15 go-version: [1.17, 1.18, 1.19]
16 os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]
17 runs-on: ${{ matrix.os }}
18
19 steps:
20 - name: Install Go
21 uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
22 with:
23 go-version: ${{ matrix.go-version }}
24
25 - name: Check out code
26 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
27
28 - name: Check formatting
29 if: ${{ matrix.go-version == '1.19' && matrix.os == 'ubuntu-22.04' }}
30 run: diff -u <(echo -n) <(gofmt -d .)
31
32 - name: Check Go modules
33 if: ${{ matrix.go-version == '1.19' && matrix.os == 'ubuntu-22.04' }}
34 run: |
35 go mod tidy
36 git diff --exit-code
37
38 - name: Build (cross-compile)
39 if: matrix.os == 'ubuntu-22.04'
40 run: |
41 GOOS=darwin go build ./...
42 GOOS=dragonfly go build ./...
43 GOOS=freebsd go build ./...
44 GOOS=linux go build ./...
45 GOOS=netbsd go build ./...
46 GOOS=openbsd go build ./...
47 GOOS=solaris go build ./...
48 GOOS=windows go build ./...
49
50 - name: Test (native)
51 run: go test -v ./...
View as plain text