mirror of
https://github.com/FuzzyGrim/Yamtrack.git
synced 2026-06-28 06:45:58 +00:00
95 lines
2.5 KiB
YAML
95 lines
2.5 KiB
YAML
name: App Tests
|
|
|
|
# Change trigger to pull_request_target for handling fork PRs safely
|
|
on:
|
|
pull_request_target:
|
|
paths-ignore:
|
|
- '.github/workflows/**'
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
# Restrict permissions to minimum required
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
jobs:
|
|
check-workflow-changes:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request_target'
|
|
steps:
|
|
- name: Check for workflow modifications
|
|
uses: dorny/paths-filter@v3
|
|
id: changes
|
|
with:
|
|
filters: |
|
|
workflows:
|
|
- '.github/workflows/**'
|
|
|
|
- name: Fail if workflows were modified
|
|
if: steps.changes.outputs.workflows == 'true'
|
|
run: |
|
|
echo "::error::Workflow files were modified in this PR."
|
|
exit 1
|
|
|
|
test:
|
|
needs: check-workflow-changes
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
max-parallel: 4
|
|
matrix:
|
|
python-version: ["3.11"]
|
|
steps:
|
|
- name: Check workflow verification result
|
|
if: |
|
|
github.event_name == 'pull_request_target' &&
|
|
needs.check-workflow-changes.result == 'failure'
|
|
run: exit 1
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements-dev.txt
|
|
playwright install
|
|
|
|
- name: Ruff
|
|
run: |
|
|
ruff check src
|
|
|
|
- name: Run Tests
|
|
env:
|
|
SECRET: ${{ secrets.SECRET }}
|
|
TMDB_API: ${{ secrets.TMDB_API }}
|
|
MAL_API: ${{ secrets.MAL_API }}
|
|
IGDB_ID: ${{ secrets.IGDB_ID }}
|
|
IGDB_SECRET: ${{ secrets.IGDB_SECRET }}
|
|
run: |
|
|
coverage run --parallel-mode src/manage.py test app
|
|
coverage run --parallel-mode src/manage.py test users
|
|
coverage run --parallel-mode src/manage.py test integrations
|
|
coverage run --parallel-mode src/manage.py test lists
|
|
coverage run --parallel-mode src/manage.py test events
|
|
|
|
- name: Build Coverage Report
|
|
run: |
|
|
coverage combine
|
|
coverage report
|
|
coverage xml
|
|
|
|
- name: Upload coverage reports to Codecov with GitHub Action
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|