From 338272927e765be674390dcae9eb5bff57a92e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Burkard?= <22095555+JeromeBu@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:32:34 +0200 Subject: [PATCH] =?UTF-8?q?add=20pg=20service=20in=20CI=20to=20run=20tests?= =?UTF-8?q?=20in=20CI=20against=20a=20PG=C2=A0db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 13 +++++++++++++ .../dbApi/kysely/pgDbApi.integration.test.ts | 2 +- docker-compose.resources.yml | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ebe91923..9b5dfbd8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,17 @@ on: jobs: validations: runs-on: ubuntu-latest + env: + DATABASE_URL: postgresql://sill:pg_password@localhost:5432/sill + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_USER: sill + POSTGRES_PASSWORD: pg_password + POSTGRES_DB: sill + ports: + - 5432:5432 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -18,6 +29,8 @@ jobs: - uses: bahmutov/npm-install@v1 - name: Build back run: cd api && yarn build + - name: Migrate db + run: yarn migrate latest - name: Fullcheck run: yarn fullcheck # diff --git a/api/src/core/adapters/dbApi/kysely/pgDbApi.integration.test.ts b/api/src/core/adapters/dbApi/kysely/pgDbApi.integration.test.ts index 8de6b431..3f73e313 100644 --- a/api/src/core/adapters/dbApi/kysely/pgDbApi.integration.test.ts +++ b/api/src/core/adapters/dbApi/kysely/pgDbApi.integration.test.ts @@ -70,7 +70,7 @@ const similarSoftwareExternalData: SoftwareExternalData = { license: "MIT" }; -const db = new Kysely({ dialect: createPgDialect("postgresql://sill:pg_password@localhost:5433/sill") }); +const db = new Kysely({ dialect: createPgDialect("postgresql://sill:pg_password@localhost:5432/sill") }); describe("pgDbApi", () => { let dbApi: DbApiV2; diff --git a/docker-compose.resources.yml b/docker-compose.resources.yml index 0ecb990a..97d0952e 100644 --- a/docker-compose.resources.yml +++ b/docker-compose.resources.yml @@ -6,7 +6,7 @@ services: image: postgres:16 shm_size: 256m ports: - - "5433:5432" + - "5432:5432" environment: POSTGRES_LOG_STATEMENTS: all POSTGRES_DB: sill