Move database name, user and password to the workflow matrix

This commit is contained in:
Erik C. Thauvin 2026-06-25 16:02:26 -07:00
parent c8dbd3179e
commit 95a219d540
No known key found for this signature in database
GPG key ID: 776702A6A2DA330E

View file

@ -4,10 +4,6 @@ on: [ push, pull_request, workflow_dispatch ]
env: env:
REPORTS_DIR: "build/test-results/test/" REPORTS_DIR: "build/test-results/test/"
DB_NAME: unittests
DB_USER: unittests
DB_PASSWORD: password
# Test flags for DB runs # Test flags for DB runs
DB_TEST_FLAGS: >- DB_TEST_FLAGS: >-
-Dtest.postgres=true -Dtest.postgres=true
@ -30,7 +26,10 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
run-db-tests: true run-db-tests: true
bld-cmd: ./bld bld-cmd: ./bld
# Only ubuntu gets DB services # DB config only for ubuntu jobs
DB_NAME: unittests
DB_USER: unittests
DB_PASSWORD: password
POSTGRES_IMAGE: "postgres:15" POSTGRES_IMAGE: "postgres:15"
MYSQL_IMAGE: "mysql:8" MYSQL_IMAGE: "mysql:8"
MARIADB_IMAGE: "mariadb:10.9" MARIADB_IMAGE: "mariadb:10.9"
@ -43,15 +42,13 @@ jobs:
run-db-tests: false run-db-tests: false
bld-cmd: .\bld.bat bld-cmd: .\bld.bat
# Only define services when run-db-tests is true
# GitHub skips this whole block if matrix doesn't define the images
services: services:
oracle: oracle:
image: ${{ matrix.ORACLE_XE_IMAGE }} image: ${{ matrix.ORACLE_XE_IMAGE }}
env: env:
ORACLE_RANDOM_PASSWORD: true ORACLE_RANDOM_PASSWORD: true
APP_USER: ${{ env.DB_USER }} APP_USER: ${{ matrix.DB_USER }}
APP_USER_PASSWORD: ${{ env.DB_PASSWORD }} APP_USER_PASSWORD: ${{ matrix.DB_PASSWORD }}
ports: ports:
- 1521:1521 - 1521:1521
options: >- options: >-
@ -64,8 +61,8 @@ jobs:
image: ${{ matrix.ORACLE_FREE_IMAGE }} image: ${{ matrix.ORACLE_FREE_IMAGE }}
env: env:
ORACLE_RANDOM_PASSWORD: true ORACLE_RANDOM_PASSWORD: true
APP_USER: ${{ env.DB_USER }} APP_USER: ${{ matrix.DB_USER }}
APP_USER_PASSWORD: ${{ env.DB_PASSWORD }} APP_USER_PASSWORD: ${{ matrix.DB_PASSWORD }}
ports: ports:
- 1522:1521 - 1522:1521
options: >- options: >-
@ -77,9 +74,9 @@ jobs:
mysql: mysql:
image: ${{ matrix.MYSQL_IMAGE }} image: ${{ matrix.MYSQL_IMAGE }}
env: env:
MYSQL_DATABASE: ${{ env.DB_NAME }} MYSQL_DATABASE: ${{ matrix.DB_NAME }}
MYSQL_USER: ${{ env.DB_USER }} MYSQL_USER: ${{ matrix.DB_USER }}
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }} MYSQL_PASSWORD: ${{ matrix.DB_PASSWORD }}
MYSQL_ROOT_PASSWORD: root MYSQL_ROOT_PASSWORD: root
ports: ports:
- 3306:3306 - 3306:3306
@ -92,9 +89,9 @@ jobs:
mariadb: mariadb:
image: ${{ matrix.MARIADB_IMAGE }} image: ${{ matrix.MARIADB_IMAGE }}
env: env:
MARIADB_DATABASE: ${{ env.DB_NAME }} MARIADB_DATABASE: ${{ matrix.DB_NAME }}
MARIADB_USER: ${{ env.DB_USER }} MARIADB_USER: ${{ matrix.DB_USER }}
MARIADB_PASSWORD: ${{ env.DB_PASSWORD }} MARIADB_PASSWORD: ${{ matrix.DB_PASSWORD }}
MARIADB_ROOT_PASSWORD: root MARIADB_ROOT_PASSWORD: root
ports: ports:
- 3307:3306 - 3307:3306
@ -107,22 +104,17 @@ jobs:
postgres: postgres:
image: ${{ matrix.POSTGRES_IMAGE }} image: ${{ matrix.POSTGRES_IMAGE }}
env: env:
POSTGRES_DB: ${{ env.DB_NAME }} POSTGRES_DB: ${{ matrix.DB_NAME }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} POSTGRES_PASSWORD: ${{ matrix.DB_PASSWORD }}
POSTGRES_USER: ${{ env.DB_USER }} POSTGRES_USER: ${{ matrix.DB_USER }}
options: >- options: >-
--health-cmd pg_isready --health-cmd pg_isready
--health-interval 10s --health-interval 10s
--health-timeout 5s --health-timeout 5s
--health-retries 5 --health-retries=5
ports: ports:
- 5432:5432 - 5432:5432
env:
MYSQL_DATABASE: ${{ env.DB_NAME }}
MYSQL_USER: root
MYSQL_PASSWORD: root
steps: steps:
- name: Configure git line endings for Windows - name: Configure git line endings for Windows
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -160,4 +152,4 @@ jobs:
- name: Run reporter - name: Run reporter
if: always() && steps.tests.outcome == 'failure' if: always() && steps.tests.outcome == 'failure'
run: ${{ matrix.bld-cmd }} --offline reporter --all run: ${{ matrix.bld-cmd }} --offline reporter --all