Skip to content

Commit

Permalink
feat: improve test with docker compose (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
hhow09 authored Mar 21, 2023
1 parent d8b48fc commit e2f3cff
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,19 @@ jobs:
name: Test
runs-on: ubuntu-latest

services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: secret
POSTGRES_DB: simple_bank
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
id: go
- name: Set up DB + Migrations
uses: isbang/[email protected]
with:
compose-file: "./docker-compose.infra.yaml"
down-flags: "--volumes"

- name: Install golang-migrate
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.14.1/migrate.linux-amd64.tar.gz | tar xvz
sudo mv migrate.linux-amd64 /usr/bin/migrate
which migrate
- name: Run migrations
run: make migrateup

- name: Test
- name: go test
run: make test

0 comments on commit e2f3cff

Please sign in to comment.