-
Notifications
You must be signed in to change notification settings - Fork 27
52 lines (44 loc) · 1.36 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
strategy:
matrix:
# Oldest supported version is 1.18, plus the latest two releases.
go-version: ['1.18', '1.21', '1.22']
os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14, windows-2019, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Check formatting
if: ${{ matrix.go-version == '1.22' && matrix.os == 'ubuntu-22.04' }}
run: diff -u <(echo -n) <(gofmt -d .)
- name: Check Go modules
if: ${{ matrix.go-version == '1.22' && matrix.os == 'ubuntu-22.04' }}
run: |
go mod tidy
git diff --exit-code
- name: Build (cross-compile)
if: matrix.os == 'ubuntu-22.04'
run: |
GOOS=darwin go build ./...
GOOS=dragonfly go build ./...
GOOS=freebsd go build ./...
GOOS=linux go build ./...
GOOS=netbsd go build ./...
GOOS=openbsd go build ./...
GOOS=solaris go build ./...
GOOS=windows go build ./...
- name: Test (native)
run: go test -v ./...