mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 06:57:47 +01:00
fix(tests): fixed testing DB deployment v6
This commit is contained in:
23
.github/workflows/run-tests.yml
vendored
23
.github/workflows/run-tests.yml
vendored
@@ -2,41 +2,30 @@ name: Run Python Tests
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# --- Triggers ----
|
|
||||||
# -----------------
|
|
||||||
# This section defines when the workflow will run.
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# ------ Jobs -----
|
|
||||||
# -----------------
|
|
||||||
# A workflow is made up of one or more jobs that can run in parallel or sequentially.
|
|
||||||
jobs:
|
jobs:
|
||||||
# A descriptive name for your job
|
|
||||||
build-and-test:
|
build-and-test:
|
||||||
# Specifies the virtual machine to run the job on. 'ubuntu-latest' is a common and cost-effective choice.
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# 1) Start a MariaDB service container for tests
|
|
||||||
services:
|
services:
|
||||||
# The label 'mariadb' becomes the hostname
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:11.4
|
image: mariadb:11.4
|
||||||
env:
|
env:
|
||||||
MARIADB_ROOT_PASSWORD: rootpw
|
MARIADB_ROOT_PASSWORD: rootpw
|
||||||
# This DB name now matches what your app expects
|
|
||||||
MARIADB_DATABASE: group_project
|
MARIADB_DATABASE: group_project
|
||||||
MARIADB_USER: appuser
|
MARIADB_USER: appuser
|
||||||
MARIADB_PASSWORD: apppass
|
MARIADB_PASSWORD: apppass
|
||||||
|
options: >-
|
||||||
|
--health-cmd="mysqladmin ping -h 127.0.0.1 -u root -prootpw --silent"
|
||||||
|
--health-interval=5s
|
||||||
|
--health-timeout=2s
|
||||||
|
--health-retries=20
|
||||||
|
|
||||||
# 2) Expose DB connection settings to steps
|
|
||||||
env:
|
env:
|
||||||
# Use the service label 'mariadb' as the host
|
|
||||||
MARIADB_HOST: mariadb
|
MARIADB_HOST: mariadb
|
||||||
MARIADB_PORT: "3306" # This is the internal port, which is correct
|
MARIADB_PORT: "3306"
|
||||||
# Match the database name from the service
|
|
||||||
MARIADB_DB: group_project
|
MARIADB_DB: group_project
|
||||||
MARIADB_USER: appuser
|
MARIADB_USER: appuser
|
||||||
MARIADB_PASSWORD: apppass
|
MARIADB_PASSWORD: apppass
|
||||||
|
|||||||
Reference in New Issue
Block a user