Repository navigation
105 lines (100 loc) · 3.56 KB
/
Copy pathci.yml
File metadata and controls
105 lines (100 loc) · 3.56 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
# CI: lint first, then the API tests, then the UI + hybrid tests on three browser engines.
# Every test job keeps its HTML report (and Playwright traces of failures) as an artifact
# and writes a pass/fail table to the run's summary page.
name: CI
on:
push:
pull_request:
# Nightly run, to notice when the public demo site changes
schedule:
- cron: "0 5 * * *"
# Manual run; can also run the report demo (fails and skips on purpose)
workflow_dispatch:
inputs:
markers:
description: pytest -m expression
type: choice
options: ["not demo", "demo"]
default: "not demo"
env:
PYTHON_VERSION: "3.12"
# How hard CI may hit the shared public demo site. All jobs together used to keep 13 sessions
# open at once (API -n 4, plus three browsers at -n 3), and in Nov 2026 those runs kept timing
# out against it. Now: 2 API workers, 2 UI workers, and one browser job at a time (max-parallel).
API_WORKERS: 2
UI_WORKERS: 2
jobs:
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- run: pip install -r requirements.txt
- name: ruff check
run: ruff check .
- name: ruff format --check
run: ruff format --check .
api:
name: API tests
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- run: pip install -r requirements.txt
# API tests need no browser; every test has its own user, so workers never collide
- name: pytest -m api
run: pytest -m "api and (${{ inputs.markers || 'not demo' }})" -n ${{ env.API_WORKERS }} --junitxml=reports/junit.xml
- name: Summary
if: always()
run: python .github/scripts/summary.py "API tests" reports/junit.xml >> "$GITHUB_STEP_SUMMARY"
- name: Keep the report
if: always()
uses: actions/upload-artifact@v7
with:
name: report-api
path: reports/
if-no-files-found: ignore
ui:
name: UI + hybrid tests (${{ matrix.browser }})
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
# One browser at a time, so the demo site never serves three browser jobs at once
max-parallel: 1
matrix:
browser: [chromium, firefox, webkit]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- run: pip install -r requirements.txt
# Only the browser of this job, with the Linux libraries it needs
- name: Install ${{ matrix.browser }}
run: playwright install --with-deps ${{ matrix.browser }}
- name: pytest -m "ui or e2e" on ${{ matrix.browser }}
run: >
pytest -m "(ui or e2e) and (${{ inputs.markers || 'not demo' }})"
--browser ${{ matrix.browser }} -n ${{ env.UI_WORKERS }} --junitxml=reports/junit.xml
- name: Summary
if: always()
run: python .github/scripts/summary.py "UI + hybrid tests on ${{ matrix.browser }}" reports/junit.xml >> "$GITHUB_STEP_SUMMARY"
- name: Keep the report and traces
if: always()
uses: actions/upload-artifact@v7
with:
name: report-${{ matrix.browser }}
path: |
reports/
test-results/
if-no-files-found: ignore