-
-
Notifications
You must be signed in to change notification settings - Fork 627
218 lines (186 loc) · 5.81 KB
/
ci.yml
File metadata and controls
218 lines (186 loc) · 5.81 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Comprehensive CI
on:
pull_request:
branches: [ '*' ]
push:
branches: [ '*' ]
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run pre-commit hooks
run: |
pre-commit run --all-files --show-diff-on-failure
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu Qt Backend
- name: "Ubuntu Qt"
os: ubuntu-22.04
python-version: '3.8'
gui: qt
display: ":99"
qt_platform: "offscreen"
log_level: "error"
# Ubuntu GTK Backend
- name: "Ubuntu GTK"
os: ubuntu-22.04
python-version: '3.9'
gui: gtk
display: ":99"
log_level: "error"
# Windows EdgeChromium
- name: "Windows EdgeChromium"
os: windows-latest
python-version: '3.8'
gui: edgechromium
log_level: "error"
# Windows CEF
# - name: "Windows CEF"
# os: windows-latest
# python-version: '3.8'
# gui: cef
# log_level: "error"
# macOS
- name: "macOS"
os: macos-latest
python-version: '3.9'
log_level: "error"
env:
PYWEBVIEW_GUI: ${{ matrix.gui }}
PYWEBVIEW_LOG: ${{ matrix.log_level }}
DISPLAY: ${{ matrix.display }}
QT_QPA_PLATFORM: ${{ matrix.qt_platform }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.gui }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.gui }}-
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
# Ubuntu Qt specific setup
- name: Install Qt dependencies (Ubuntu Qt)
if: matrix.gui == 'qt'
run: |
sudo apt-get update -q --allow-releaseinfo-change
sudo apt-get install --no-install-recommends -y \
xvfb \
python3-pyqt5 \
python3-pyqt5.qtwebkit \
libqt5webkit5-dev \
- name: Start Xvfb (Ubuntu Qt)
if: matrix.gui == 'qt'
run: |
sudo /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid \
--make-pidfile --background --exec /usr/bin/Xvfb -- :99 \
-screen 0 1920x1200x24 -ac +extension GLX +render -noreset
sleep 3
# Ubuntu GTK specific setup
- name: Install GTK dependencies (Ubuntu GTK)
if: matrix.gui == 'gtk'
run: |
sudo apt-get update -q --allow-releaseinfo-change
sudo apt-get install --no-install-recommends -y \
xvfb \
gir1.2-gtk-3.0 \
gir1.2-webkit2-4.0 \
python3-gi \
python3-gi-cairo \
python3-pep8 \
pyflakes3 \
python3-pytest \
libgirepository1.0-dev
- name: Start Xvfb (Ubuntu GTK)
if: matrix.gui == 'gtk'
run: |
sudo /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid \
--make-pidfile --background --exec /usr/bin/Xvfb -- :99 \
-screen 0 1920x1200x24 -ac +extension GLX +render -noreset
sleep 3
# Windows specific setup
- name: Install WebView2 Runtime (Windows)
if: runner.os == 'Windows'
run: |
choco install webview2-runtime --ignore-checksums
# Install Python dependencies
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
pip install -e "."
pip install pytest
- name: Install Qt dependencies (Ubuntu Qt)
if: matrix.gui == 'qt'
run: |
python -m pip install --upgrade setuptools==70.0.0
pip install -e ".[qt5]"
pip install pytest
- name: Install GTK dependencies (Ubuntu GTK)
if: matrix.gui == 'gtk'
run: |
python -m pip install --upgrade setuptools==70.0.0
pip install -e ".[gtk]"
pip install pytest
- name: Install CEF dependencies (Windows CEF)
if: matrix.gui == 'cef'
run: |
pip install -e ".[cef]"
- name: Install macOS dependencies (macOS)
if: runner.os == 'macOS'
run: |
pip install -e "."
pip install pytest pillow
- name: Run tests
run: |
cd tests
python -m pytest -s
- name: Stop Xvfb (Linux)
if: matrix.gui == 'qt' || matrix.gui == 'gtk'
run: |
sudo killall Xvfb || true
- name: Upload screenshots (macOS)
if: runner.os == 'macOS' && failure()
uses: actions/upload-artifact@v4
with:
name: macos-screenshots
path: /tmp/screenshots
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Safety Check
run: |
pip install safety
safety check --json || true # Don't fail on safety issues for now