Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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