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.
This commit is contained in:
cole-maxwell1
2026-08-07 11:38:23 -05:00
parent d118f52387
commit 2ff14e6221
6 changed files with 229 additions and 8 deletions
+55
View File
@@ -0,0 +1,55 @@
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 ./...