Merge pull request #119 from tklauser/dependabot/github_actions/actio… #297
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
# Latest two supported releases. | |
go-version: ['1.23', '1.24'] | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-14, macos-15, windows-2019, windows-2022] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install Go | |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.0.2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Check formatting | |
if: ${{ matrix.go-version == '1.24' && matrix.os == 'ubuntu-24.04' }} | |
run: diff -u <(echo -n) <(gofmt -d .) | |
- name: Check Go modules | |
if: ${{ matrix.go-version == '1.24' && matrix.os == 'ubuntu-24.04' }} | |
run: | | |
go mod tidy | |
git diff --exit-code | |
- name: Build (cross-compile) | |
if: matrix.os == 'ubuntu-latest' | |
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 ./... |