Skip to content

Instantly share code, notes, and snippets.

@alexedwards
Created December 5, 2021 11:39
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alexedwards/84e693ad73e46fc5f123346c75ca3ae3 to your computer and use it in GitHub Desktop.
Save alexedwards/84e693ad73e46fc5f123346c75ca3ae3 to your computer and use it in GitHub Desktop.
name: Audit
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-20.04
services:
postgres:
image: postgres
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DB_DSN: 'postgres://user:pass@localhost/db?sslmode=disable'
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Enable citext
run: psql 'postgres://user:pass@localhost/db?sslmode=disable' -tc "CREATE EXTENSION citext;"
- name: Install migrate
run: go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
- name: Run DB migrations
run: migrate -path ./migrations -database 'postgres://user:pass@localhost/db?sslmode=disable' up
- name: Run tests
run: go test ./...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment