- Introduced unit tests for SQLite facade helpers, including schema validation, query building, and async operations. - Added integration tests for basic SQLite queries and transaction handling. - Implemented additional tests for metadata extraction functions, focusing on dimension handling, EXIF data, and video metadata. - Created tests for security core helpers, covering environment variable checks, IP validation, and CSRF protection. - Included compatibility tests for route exports to ensure proper functionality.
88 lines
2.3 KiB
YAML
88 lines
2.3 KiB
YAML
name: Python tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
|
|
jobs:
|
|
quality:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install quality tools
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install xenon radon flake8 flake8-cognitive-complexity
|
|
|
|
- name: Check Python files encoding (no UTF-8 BOM)
|
|
run: python scripts/check_no_bom.py mjr_am_backend mjr_am_shared tests __init__.py scripts
|
|
|
|
- name: Complexity gate (stage A)
|
|
run: python -m xenon -b F -m D -a C mjr_am_backend mjr_am_shared tests __init__.py
|
|
|
|
- name: Complexity gate (new files, CC <= 10)
|
|
run: python scripts/check_cc_changed.py
|
|
|
|
test:
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.10", "3.12", "3.13", "3.14"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install ExifTool and FFmpeg (includes ffprobe)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libimage-exiftool-perl ffmpeg
|
|
|
|
- name: Verify ExifTool and ffprobe
|
|
run: |
|
|
echo "ExifTool version:"
|
|
exiftool -ver || true
|
|
echo "ffprobe version:"
|
|
ffprobe -version || true
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install pytest pytest-asyncio
|
|
|
|
- name: Run pytest
|
|
run: python -m pytest -q
|
|
|
|
typecheck:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install mypy
|
|
|
|
- name: Run mypy
|
|
run: python -m mypy --config-file mypy.ini
|