Skip to content

Commit 8d197d5

Browse files
committed
add postgres service to workflow for testing
1 parent a30aba0 commit 8d197d5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/test.yml

+24
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ jobs:
1616
name: Test
1717
runs-on: ubuntu-latest
1818

19+
services:
20+
postgres:
21+
image: postgres:12-alpine
22+
env:
23+
POSTGRES_USER: postgres
24+
POSTGRES_PASSWORD: postgres
25+
POSTGRES_DB: sandbox
26+
ports:
27+
- 5433:5432
28+
options: >-
29+
--health-cmd pg_isready
30+
--health-interval 10s
31+
--health-timeout 5s
32+
--health-retries 5
33+
1934
steps:
2035
- name: Checkout
2136
uses: actions/checkout@v2
@@ -25,5 +40,14 @@ jobs:
2540
with:
2641
go-version: 1.17
2742

43+
- name: Install golang-migrate
44+
run: |
45+
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.14.1/migrate.linux-amd64.tar.gz | tar xvz
46+
sudo mv migrate.linux-amd64 /usr/bin/migrate
47+
which migrate
48+
49+
- name: Run migrations
50+
run: make migrateup
51+
2852
- name: Test
2953
run: go test -v ./...

0 commit comments

Comments
 (0)