mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +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:
|
||||
contents: read
|
||||
|
||||
# -----------------
|
||||
# --- Triggers ----
|
||||
# -----------------
|
||||
# This section defines when the workflow will run.
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# -----------------
|
||||
# ------ Jobs -----
|
||||
# -----------------
|
||||
# A workflow is made up of one or more jobs that can run in parallel or sequentially.
|
||||
jobs:
|
||||
# A descriptive name for your job
|
||||
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
|
||||
|
||||
# 1) Start a MariaDB service container for tests
|
||||
services:
|
||||
# The label 'mariadb' becomes the hostname
|
||||
mariadb:
|
||||
image: mariadb:11.4
|
||||
env:
|
||||
MARIADB_ROOT_PASSWORD: rootpw
|
||||
# This DB name now matches what your app expects
|
||||
MARIADB_DATABASE: group_project
|
||||
MARIADB_USER: appuser
|
||||
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:
|
||||
# Use the service label 'mariadb' as the host
|
||||
MARIADB_HOST: mariadb
|
||||
MARIADB_PORT: "3306" # This is the internal port, which is correct
|
||||
# Match the database name from the service
|
||||
MARIADB_PORT: "3306"
|
||||
MARIADB_DB: group_project
|
||||
MARIADB_USER: appuser
|
||||
MARIADB_PASSWORD: apppass
|
||||
|
||||
Reference in New Issue
Block a user