Skip to content

Style

Style #57

Workflow file for this run

name: "go"
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
jobs:
quality-check:
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
- uses: "actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c" # v6.4.0
with:
go-version: "1.26"
- uses: "actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7" # v5.0.4
with:
path: "~/.cache/go-build"
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- run: "go vet ./..."
- run: "staticcheck ./..."
- run: "golangci-lint run ./..."
- run: |
diff=$(goimports -d .)
if [ -n "$diff" ]; then
echo "$diff"
exit 1
fi
test:
runs-on: "ubuntu-24.04"
services:
postgres:
image: "postgres:16"
env:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
- uses: "actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c" # v6.4.0
with:
go-version: "1.26"
- uses: "actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7" # v5.0.4
with:
path: "~/.cache/go-build"
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "Setup test database"
run: |
PGPASSWORD=postgres psql -h localhost -U postgres <<-EOF
CREATE USER kit WITH SUPERUSER PASSWORD 'kit';
CREATE DATABASE kit_test;
GRANT ALL PRIVILEGES ON DATABASE kit_test TO kit;
EOF
PGPASSWORD=kit psql -h localhost -U kit -d kit_test -c "ALTER SCHEMA public OWNER TO kit;"
- run: "go test -v -count=1 ./..."