-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (135 loc) · 4.76 KB
/
Copy pathpython.yml
File metadata and controls
147 lines (135 loc) · 4.76 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: "Python · Regression (path-filtered)"
on:
pull_request:
branches:
- master
paths:
- stacks/python-playwright/**
- scenarios/**
- tools/**
- .github/workflows/python.yml
push:
branches:
- master
paths:
- stacks/python-playwright/**
- scenarios/**
- tools/**
- .github/workflows/python.yml
workflow_dispatch:
permissions:
contents: read
jobs:
python-regression:
name: "Python regression · ${{ matrix.project }} (${{ matrix.slice }})"
runs-on: ubuntu-24.04
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
include:
- project: chromium
browser: chromium
install_target: chromium
device: ''
slice: regression
marker_expr: not not_ci and not flaky_demo
artifact_slice: chromium
- project: firefox
browser: firefox
install_target: firefox
device: ''
slice: regression
marker_expr: not http and not not_ci and not flaky_demo
artifact_slice: firefox
- project: webkit
browser: webkit
install_target: webkit
device: ''
slice: regression
marker_expr: not http and not not_ci and not flaky_demo
artifact_slice: webkit
- project: Mobile Chrome
browser: chromium
install_target: chromium
device: Pixel 5
slice: mobile-emulation
marker_expr: mobile_emulation and not desktop and not not_ci and not flaky_demo
artifact_slice: mobile-chrome
- project: Mobile Safari
browser: webkit
install_target: webkit
device: iPhone 12
slice: mobile-emulation
marker_expr: mobile_emulation and not desktop and not not_ci and not flaky_demo
artifact_slice: mobile-safari
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Start test application
run: python3 tools/ci_containers.py start-website
- name: Set up Python 3.14
uses: actions/setup-python@v7
with:
python-version: '3.14'
cache: pip
cache-dependency-path: stacks/python-playwright/pyproject.toml
- name: Install Python stack dependencies
working-directory: stacks/python-playwright
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Plan Python Playwright slice
id: slice
working-directory: stacks/python-playwright
env:
PYTEST_BROWSER: ${{ matrix.browser }}
PYTEST_DEVICE: ${{ matrix.device }}
PYTEST_MARKERS: ${{ matrix.marker_expr }}
run: |
args=(--collect-only -q --browser "$PYTEST_BROWSER" -m "$PYTEST_MARKERS")
if [ -n "$PYTEST_DEVICE" ]; then
args+=(--device "$PYTEST_DEVICE")
fi
set +e
pytest "${args[@]}" | tee /tmp/pytest-list.txt
status=${PIPESTATUS[0]}
set -e
if [ "$status" -ne 0 ] && [ "$status" -ne 5 ]; then
exit "$status"
fi
count=$(grep -c '^tests/.*::' /tmp/pytest-list.txt || true)
echo "count=$count" >> "$GITHUB_OUTPUT"
- name: Install Playwright browser
if: steps.slice.outputs.count != '0'
working-directory: stacks/python-playwright
run: python -m playwright install --with-deps ${{ matrix.install_target }}
- name: Run Python Playwright slice
if: steps.slice.outputs.count != '0'
working-directory: stacks/python-playwright
env:
THE_INTERNET_BASE_URL: http://localhost:7080
PYTEST_BROWSER: ${{ matrix.browser }}
PYTEST_DEVICE: ${{ matrix.device }}
PYTEST_MARKERS: ${{ matrix.marker_expr }}
run: |
args=(
--browser "$PYTEST_BROWSER"
-m "$PYTEST_MARKERS"
--tracing "retain-on-failure"
--screenshot "only-on-failure"
--video "retain-on-failure"
--output "../../artifacts/py/${GITHUB_RUN_ID}/${{ matrix.artifact_slice }}/test-results"
--junitxml "../../artifacts/py/${GITHUB_RUN_ID}/${{ matrix.artifact_slice }}/junit.xml"
)
if [ -n "$PYTEST_DEVICE" ]; then
args+=(--device "$PYTEST_DEVICE")
fi
pytest "${args[@]}"
- name: Upload Playwright artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: py-${{ matrix.artifact_slice }}-${{ github.run_id }}-playwright
path: artifacts/py/${{ github.run_id }}/${{ matrix.artifact_slice }}/
if-no-files-found: ignore