Test more platforms in CI #326
This file contains hidden or 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: 'test' | |
| on: | |
| pull_request: | |
| paths: ['**.go', 'go.mod', '.github/workflows/*'] | |
| push: | |
| branches: ['main'] | |
| jobs: | |
| # Uncomment to get a debug shell. | |
| # debug: {runs-on: 'ubuntu-latest', steps: [{uses: 'actions/checkout@v6'}, {uses: 'mxschmitt/action-tmate@v3'}]} | |
| # staticcheck | |
| staticcheck: | |
| name: 'staticcheck' | |
| runs-on: 'ubuntu-latest' | |
| steps: | |
| - uses: 'actions/checkout@v6' | |
| - uses: 'dominikh/[email protected]' | |
| with: {version: '2025.1.1'} | |
| # Linux, macOS, Windows SQLite | |
| test: | |
| strategy: | |
| matrix: | |
| os: ['ubuntu-latest', 'ubuntu-24.04-arm', 'macos-latest'] | |
| runs-on: "${{ matrix.os }}" | |
| name: "${{ matrix.os }} / sqlite" | |
| steps: | |
| - uses: 'actions/checkout@v6' | |
| - uses: 'actions/setup-go@v6' | |
| with: {go-version: 'stable'} | |
| - shell: 'bash' | |
| run: | | |
| # "-race is not supported on windows/arm64" | |
| race='-race' | |
| [ $RUNNER_OS = 'Windows' ] && [ $RUNNER_ARCH = 'ARM64' ] && race='' | |
| go test $race ./... | |
| # Linux PostgreSQL | |
| test_postgresql: | |
| name: 'test / ubuntu-latest / sqlite' | |
| runs-on: 'ubuntu-latest' | |
| steps: | |
| - uses: 'actions/checkout@v6' | |
| - name: 'test / ubuntu-latest / postgres' | |
| run: | | |
| go build -race ./cmd/goatcounter || exit 1 | |
| docker compose up -d --wait || exit 1 | |
| CGO_ENABLED=0 go test -timeout=3m -tags=testpg ./... | |
| # FreeBSD SQLite | |
| freebsd: | |
| runs-on: 'ubuntu-latest' | |
| name: 'test / freebsd / sqlite' | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: 'actions/checkout@v6' | |
| - name: 'test / freebsd / sqlite' | |
| id: 'freebsd' | |
| uses: 'vmactions/freebsd-vm@v1' | |
| with: | |
| prepare: 'pkg update -f && pkg install -y go' | |
| run: 'go test -race -timeout=3m ./...' | |
| # OpenBSD SQLite | |
| openbsd: | |
| runs-on: 'ubuntu-latest' | |
| name: 'test / openbsd / sqlite' | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: 'actions/checkout@v6' | |
| - name: 'test / openbsd / sqlite' | |
| id: 'openbsd' | |
| uses: 'vmactions/openbsd-vm@v1' | |
| with: | |
| prepare: 'pkg_add go' | |
| # "-race is not supported on openbsd/amd64" | |
| run: 'GOTOOLCHAIN=auto go test -timeout=3m ./...' | |
| # NetBSD SQlite | |
| netbsd: | |
| runs-on: 'ubuntu-latest' | |
| name: 'test / netbsd / sqlite' | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: 'actions/checkout@v6' | |
| - name: 'test / netbsd / sqlite' | |
| id: 'netbsd' | |
| uses: 'vmactions/netbsd-vm@v1' | |
| with: | |
| prepare: 'pkg_add go' | |
| run: '/usr/pkg/bin/go??? test -race -timeout=3m ./...' | |
| # illumos SQLite | |
| illumos: | |
| runs-on: 'ubuntu-latest' | |
| name: 'test / illumos / sqlite' | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: 'actions/checkout@v6' | |
| - name: 'test / illumos / sqlite' | |
| id: 'illumos' | |
| uses: 'vmactions/omnios-vm@v1' | |
| with: | |
| prepare: 'pkg install gcc14 go-125' | |
| # "-race is not supported on illumos/amd64" | |
| run: 'go test -timeout=3m ./...' |