-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
224 lines (196 loc) · 7.94 KB
/
ci.yml
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
219
220
221
222
223
224
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events for develop and v4 branche.
on:
push:
branches:
- 'develop'
- 'v4'
pull_request:
branches:
- '**'
- '!master'
- '!pyup/**'
env:
# Colored pytest output on CI despite not having a tty
FORCE_COLOR: 1
# Enable strict unpack mode to catch file duplication problems in onefile builds (at executable run-time).
PYINSTALLER_STRICT_UNPACK_MODE: 1
# Enable strict collect mode to catch file duplication problems in PKG/Carchive (onefile builds) or COLLECT
# (onedir builds) at build time.
PYINSTALLER_STRICT_COLLECT_MODE: 1
# Enable strict handling of codesign errors for macOS bundles.
PYINSTALLER_STRICT_BUNDLE_CODESIGN_ERROR: 1
# Enable strict verification of macOS bundles w.r.t. the code-signing requirements.
PYINSTALLER_VERIFY_BUNDLE_SIGNATURE: 1
# Enable PEP 597 EncodingWarnings
PYTHONWARNDEFAULTENCODING: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
os: ['windows-latest', 'ubuntu-22.04', 'macos-12']
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install apt packages
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update -qq
sudo apt-get upgrade -qq
sudo apt-get install -qq --no-install-recommends \
libcmocka-dev \
libxml2-dev libxslt1-dev gfortran libatlas-base-dev \
libespeak1 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 \
libxkbcommon-x11-0 libxcb-icccm4 libxcb1 openssl \
libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
libxcb-shape0-dev libxcb-xkb-dev xvfb \
libopengl0 libegl1 \
libpulse0 libpulse-mainloop-glib0 \
gstreamer1.0-plugins-base libgstreamer-gl1.0-0 \
gir1.2-gtk-3.0 libgirepository1.0-dev \
libfuse2
# The following locales are required by test_basic::test_user_preferred_locale
# - en_US.UTF-8
# - en_US.ISO8859-1
# - sl_SI.UTF-8
# - sl_SI.ISO8859-2
#
# The following locale is used by test_basic::test_time_module_localized
# - cs_CZ.UTF-8
- name: Install and enable additional locales
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update -qq
sudo apt-get install -qq --no-install-recommends locales
sudo locale-gen \
en_US.UTF-8 \
en_US \
sl_SI.UTF-8 \
sl_SI \
cs_CZ.UTF-8
locale -a
- name: Download AppImage tool
if: startsWith(matrix.os, 'ubuntu')
run: |
wget \
https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage \
-O $HOME/appimagetool-x86_64.AppImage
chmod a+x $HOME/appimagetool-x86_64.AppImage
- name: Set cache dir
run: echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_ENV
shell: bash
- name: Fetch cache
id: cache-target
uses: actions/cache@v3
with:
path: ${{ env.pip_cache_dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}
- name: Check if bootloader code conforms to gnu90 C standard
if: startsWith(matrix.os, 'ubuntu')
run: |
# Compile bootloader
cd bootloader
CC="gcc -std=gnu90" python waf --tests all
- name: Check if bootloader is buildable with --static-zlib option
if: startsWith(matrix.os, 'ubuntu')
run: cd bootloader && python waf --static-zlib --tests all
- name: Check if bootloader is buildable for Windows ARM
if: startsWith(matrix.os, 'windows')
run: |
cd bootloader
python waf --tests --target-arch=64bit-arm all
ls ../PyInstaller/bootloader/Windows-64bit-arm
- name: Install PyInstaller
run: |
# Update pip.
python -m pip install --upgrade pip setuptools wheel
# Compile bootloader
cd bootloader
python waf --tests all
cd ..
# Install PyInstaller.
pip install --progress-bar=off .[completion]
# Make sure the help options print.
python -m PyInstaller -h
- name: Install test dependencies (base tools)
run: |
pip install --progress-bar=off --upgrade --requirement tests/requirements-base.txt
- name: Install test dependencies (tools and libraries)
if: ${{ !endsWith(matrix.python-version, '-dev') }}
run: |
pip install --progress-bar=off --upgrade --requirement tests/requirements-libraries.txt
- name: Set up extra environment variables (non-Windows)
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
# Run Qt-based tests with offscreen backend. This seems to break QtWebEngine tests on Windows, so
# apply it only here, in non-Windows path.
echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV
- name: Start display server
if: startsWith(matrix.os, 'ubuntu')
run: |
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV
# Required on macOS >= 11 by tests that register custom URL schema. This could also be achieved by passing
# --basetemp to pytest, but using environment variable allows us to have a unified "Run test" step for
# all OSes.
- name: Relocate temporary dir
if: startsWith(matrix.os, 'macos')
run: |
echo "PYTEST_DEBUG_TEMPROOT=$RUNNER_TEMP" >> $GITHUB_ENV
- name: Run tests
run: >
pytest
-n 3 --maxfail 3 --durations 10 tests/unit tests/functional
--force-flaky --no-flaky-report
# Install and test PyInstaller Hook Sample, to ensure that tests declared in
# entry-points are discovered.
- name: Install hooksample
run: pip install "https://github.com/pyinstaller/hooksample/archive/v4.0rc1.zip"
- name: Inject bogus hook
shell: python
run: |
from _pyinstaller_hooks_contrib.hooks.stdhooks import __path__ as path
with open(path[0] + "/hook-pyi_hooksample.py", "w") as f:
f.write('assert 0, "Wrong hook! Use the pyi_hooksample copy instead!"\n')
- name: Run hooksample tests
run: |
# The ``run_tests`` script is invoked with the ``-c`` option to
# specify a ``pytest.ini``, rather than allowing pytest to find
# something unexpected in the filesystem (it searches from the root
# dir all the way to the top of the filesystem per
# https://docs.pytest.org/en/latest/customize.html).
python -m PyInstaller.utils.run_tests -c PyInstaller/utils/pytest.ini --include_only=pyi_hooksample.
test-alpine:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker build -f alpine.dockerfile -t foo .
- run: >
docker run
foo
pytest
-n 3 --maxfail 3 --durations 10 tests/unit tests/functional
--force-flaky --no-flaky-report
# Verify that installing from sdist works. This is mostly just a verification that the MANIFEST.in contains
# all the extras needed to compile the bootloader.
- run: |
git clean -xfdq .
python setup.py -qqq sdist
docker build --target=wheel-factory -t bar -f alpine.dockerfile .
- run: |
sdist="$(ls dist)"
docker run -v "$PWD/dist:/io" bar ash -c "
pip install /io/$sdist
echo 'print(1 + 1)' > test.py
pyinstaller test.py
./dist/test/test
"