-
Notifications
You must be signed in to change notification settings - Fork 5.5k
88 lines (86 loc) · 2.93 KB
/
Copy pathpython-test.yaml
File metadata and controls
88 lines (86 loc) · 2.93 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
name: Python check
on:
push:
branches: [ main ]
paths-ignore:
- "**.md"
- ".azdo/**"
- ".devcontainer/**"
- ".github/**"
pull_request:
branches: [ main ]
paths-ignore:
- "**.md"
- ".azdo/**"
- ".devcontainer/**"
- ".github/**"
workflow_call:
jobs:
test_package:
name: Test ${{ matrix.os }} Python ${{ matrix.python_version }} Node ${{ matrix.node_version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest"]
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
node_version: ["20.14", "22"]
steps:
- uses: actions/checkout@v6
with:
# Fetch full history so diff-cover can compute a merge base with origin/main
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
version: "0.9.5"
cache-dependency-glob: "requirements**.txt"
python-version: ${{ matrix.python_version }}
activate-environment: true
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node_version }}
- name: Build frontend
run: |
cd ./app/frontend
npm install
npm run build
- name: Check i18n translations
run: npx -y @lingual/i18n-check@0.8.12 --locales app/frontend/src/locales -s en -f i18next -r summary
- name: Install dependencies
run: |
uv pip install -r requirements-dev.txt
- name: Lint with ruff
run: ruff check .
- name: Check types with mypy
run: |
cd scripts/
mypy . --config-file=../pyproject.toml
cd ../app/backend/
mypy . --config-file=../../pyproject.toml
- name: Check formatting with black
run: black . --check --verbose
- name: Run Python tests
if: runner.os != 'Windows'
run: pytest -s -vv --cov --cov-report=xml --cov-fail-under=90
- name: Check diff coverage
if: runner.os != 'Windows'
run: |
BASE_REF="${{ github.base_ref }}"
if [ -z "$BASE_REF" ]; then BASE_REF="main"; fi
git fetch origin "$BASE_REF:refs/remotes/origin/$BASE_REF"
diff-cover coverage.xml --compare-branch="origin/$BASE_REF" --fail-under=90
- name: Run E2E tests with Playwright
id: e2e
if: runner.os != 'Windows'
run: |
playwright install chromium --with-deps
pytest tests/e2e.py --tracing=retain-on-failure
- name: Upload test artifacts
if: ${{ failure() && steps.e2e.conclusion == 'failure' }}
uses: actions/upload-artifact@v6
with:
name: playwright-traces${{ matrix.python_version }}
path: test-results