PRWLR-4236: fix(CI): use postgres for unit tests (#19)

* fix(Config): use local postgres for unit tests

* fix(CI): use postgres for unit tests in GHA
This commit is contained in:
Jon Young
2024-07-25 04:00:58 -04:00
committed by GitHub
parent de97b9f298
commit 6a135cb47c
2 changed files with 35 additions and 3 deletions
+29
View File
@@ -8,6 +8,15 @@ on:
branches:
- "main"
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: prowler_db_test
jobs:
test:
runs-on: ubuntu-latest
@@ -15,6 +24,26 @@ jobs:
matrix:
python-version: ["3.12"]
# Service containers to run with `test`
services:
# Label used to access the service container
postgres:
image: postgres
env:
POSTGRES_HOST: ${{ env.POSTGRES_HOST }}
POSTGRES_PORT: ${{ env.POSTGRES_PORT }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
# Set health checks to wait until postgres has started
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Test if changes are in not ignored paths