feat: Improves webhook CD #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------------------------------------------------------- | |
# Run Tests Workflow | |
# This workflow runs pytest on every push and pull request (targeting main). | |
# It sets up a MariaDB service container and configures environment | |
# variables for both the service and the test environment. | |
# ---------------------------------------------------------------------------- | |
name: Pytest | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
pytest: | |
runs-on: ubuntu-24.04 | |
# Global environment variables shared across services and steps | |
env: | |
MARIADB_ROOT_PASSWORD: uvlhub_root_password | |
MARIADB_DATABASE: uvlhubdb_test | |
MARIADB_TEST_DATABASE: uvlhubdb_test | |
MARIADB_USER: uvlhub_user | |
MARIADB_PASSWORD: uvlhub_password | |
MARIADB_HOSTNAME: 127.0.0.1 | |
MARIADB_PORT: 3306 | |
FLASK_ENV: testing | |
services: | |
# MariaDB service container for integration tests | |
mariadb: | |
image: mariadb:12.0.2 | |
env: | |
MARIADB_ROOT_PASSWORD: ${{ env.MARIADB_ROOT_PASSWORD }} | |
MARIADB_DATABASE: ${{ env.MARIADB_DATABASE }} | |
MARIADB_USER: ${{ env.MARIADB_USER }} | |
MARIADB_PASSWORD: ${{ env.MARIADB_PASSWORD }} | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mariadb-admin ping -u root -p$MARIADB_ROOT_PASSWORD" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
# Step 1: Checkout the repository code | |
- name: Checkout | |
uses: actions/checkout@v5 | |
# Step 2: Set up Python environment (version 3.12) | |
- name: Set up Python | |
uses: actions/setup-python@v6 | |
with: | |
python-version: '3.12' | |
# Step 3: Remove local editable mode for rosemary dependency (not CI-friendly) | |
- name: Delete rosemary editable mode | |
run: sed -i '/rosemary @ file:\/\/\/app/d' requirements.txt | |
# Step 4: Install Python dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# Step 5: Run the pytest test suite (ignoring Selenium tests) | |
- name: Run Tests | |
run: pytest app/modules/ --ignore-glob='*selenium*' |