Files
cole-maxwell1 2ff14e6221 ops(ci): automate testing and container image releases
Add PostgreSQL-backed Go validation for application changes and semantic-version release publishing to GHCR.

Default deployments to the public image and prevent host setup from starting the application before deployment.
2026-08-07 11:38:23 -05:00

56 lines
1.2 KiB
YAML

name: Go tests
on:
push:
branches: [main]
paths:
- 'app/**'
- '.github/workflows/go-tests.yml'
pull_request:
branches: [main]
paths:
- 'app/**'
- '.github/workflows/go-tests.yml'
permissions:
contents: read
jobs:
test:
name: Test Go app
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_DB: todo_test
POSTGRES_USER: todo_test
POSTGRES_PASSWORD: test-password
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U todo_test -d todo_test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
defaults:
run:
working-directory: app
env:
TEST_DATABASE_URL: postgres://todo_test:test-password@127.0.0.1:5432/todo_test?sslmode=disable
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: app/go.mod
cache-dependency-path: app/go.sum
- name: Run tests
run: go test ./...
- name: Run vet
run: go vet ./...