From d0f6f275264422a3d562614cfd43b81027dc4ced Mon Sep 17 00:00:00 2001 From: LordMathis Date: Fri, 7 Mar 2025 22:31:00 +0100 Subject: [PATCH] Add PostgreSQL service to GitHub Actions workflow for integration tests --- .github/workflows/go-test.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 33bbbb6..aee2d5b 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -13,6 +13,21 @@ jobs: name: Run Tests runs-on: ubuntu-latest + services: + postgres: + image: postgres:17 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: lemma_test + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + defaults: run: working-directory: ./server @@ -29,6 +44,8 @@ jobs: - name: Run Tests run: go test -tags=test,integration ./... -v + env: + LEMMA_TEST_POSTGRES_URL: "postgres://postgres:postgres@localhost:5432/lemma_test?sslmode=disable" - name: Run Tests with Race Detector run: go test -tags=test,integration -race ./... -v