mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
name: Run Python Tests
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
mariadb:
|
|
image: mariadb:11.4
|
|
env:
|
|
MARIADB_ROOT_PASSWORD: rootpw
|
|
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
|
|
|
|
env:
|
|
MARIADB_HOST: mariadb
|
|
MARIADB_PORT: "3306"
|
|
MARIADB_DB: group_project
|
|
MARIADB_USER: appuser
|
|
MARIADB_PASSWORD: apppass
|
|
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.11
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Add test dependencies to requirements
|
|
run: |
|
|
echo "pytest==8.4.2" >> ./7project/backend/requirements.txt
|
|
echo "pytest-asyncio==1.2.0" >> ./7project/backend/requirements.txt
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r ./7project/backend/requirements.txt
|
|
|
|
- name: Run Alembic migrations
|
|
run: |
|
|
alembic upgrade head
|
|
working-directory: ./7project/backend
|
|
|
|
- name: Run tests with pytest
|
|
run: pytest
|
|
working-directory: ./7project/backend |