-
Notifications
You must be signed in to change notification settings - Fork 170
109 lines (92 loc) · 3.16 KB
/
app-tests.yml
File metadata and controls
109 lines (92 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: App Tests
on:
pull_request:
paths-ignore:
- ".github/workflows/**"
push:
branches:
- main
- dev
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
check-workflow-changes:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check for workflow modifications
uses: dorny/paths-filter@v4
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.12"]
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@v6
- name: Set up Python
uses: actions/setup-python@v6
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: Set environment variables from secrets
run: |
if [ -n "${{ secrets.SECRET }}" ]; then echo "SECRET=${{ secrets.SECRET }}" >> $GITHUB_ENV; fi
if [ -n "${{ secrets.TMDB_API }}" ]; then echo "TMDB_API=${{ secrets.TMDB_API }}" >> $GITHUB_ENV; fi
if [ -n "${{ secrets.MAL_API }}" ]; then echo "MAL_API=${{ secrets.MAL_API }}" >> $GITHUB_ENV; fi
if [ -n "${{ secrets.IGDB_ID }}" ]; then echo "IGDB_ID=${{ secrets.IGDB_ID }}" >> $GITHUB_ENV; fi
if [ -n "${{ secrets.IGDB_SECRET }}" ]; then echo "IGDB_SECRET=${{ secrets.IGDB_SECRET }}" >> $GITHUB_ENV; fi
if [ -n "${{ secrets.HARDCOVER_API }}" ]; then echo "HARDCOVER_API=${{ secrets.HARDCOVER_API }}" >> $GITHUB_ENV; fi
if [ -n "${{ secrets.COMICVINE_API }}" ]; then echo "COMICVINE_API=${{ secrets.COMICVINE_API }}" >> $GITHUB_ENV; fi
- name: Run Tests
run: |
coverage run src/manage.py test app users integrations lists events --parallel
- name: Build Coverage Report
run: |
coverage combine
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
nix-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Evaluate flake
run: nix flake check --no-build
- name: Build package
run: nix build .#default -L
- name: Run unit tests
run: nix build .#checks.x86_64-linux.yamtrack-unit-tests -L