From bb19b2bfea26127af1fd41e801961f4b3ae9c2f6 Mon Sep 17 00:00:00 2001 From: Josh Ghent Date: Tue, 8 Oct 2024 11:35:26 +0100 Subject: [PATCH] update the workflow so that it runs postgres --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec9ad35..1edebda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,19 @@ jobs: test: runs-on: ubuntu-latest + services: + postgres: + image: postgres:15 + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: - uses: actions/checkout@v4 @@ -21,5 +34,14 @@ jobs: - name: Install dependencies run: go mod download + - name: Run migrations and seed data + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable + run: | + make migrate + make seed + - name: Run tests + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable run: make test