Skip to content

Add CI, some staticcheck fixes #1

Add CI, some staticcheck fixes

Add CI, some staticcheck fixes #1

Workflow file for this run

name: 'test backend'

Check failure on line 1 in .github/workflows/test.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/test.yml

Invalid workflow file

`pr` is not a valid event name
on:
push:
paths: ['**.go', 'go.mod', '.github/workflows/*']
pr:
paths: ['**.go', 'go.mod', '.github/workflows/*']
jobs:
# Uncomment to get a debug shell.
# debug: {runs-on: 'ubuntu-latest', steps: [{uses: 'actions/checkout@v4'}, {uses: 'mxschmitt/action-tmate@v3'}]}
test:
name: 'test (linux)'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
- name: 'test (linux)'
run: |
# Quick exit on compile errors.
go build -race ./cmd/goatcounter || exit 1
# Make sure it at least compiles on macOS, Windows, and arm64
GOARCH=arm64 go build ./cmd/goatcounter
GOARCH=arm64 GOOS=darwin go build ./cmd/goatcounter
GOOS=windows go build ./cmd/goatcounter
go test -race -timeout=3m ./...
docker compose up -d --wait
export PGHOST=localhost
export PGPORT=5433
export PGDATABASE=goatcounter
export PGUSER=goatcounter
export PGPASSWORD=goatcounter
export PGSSLMODE=disable
go test -race -timeout=3m -tags pgsql ./...
staticcheck:
name: 'staticcheck'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
- uses: 'dominikh/[email protected]'
with: {version: '2024.1'}