Skip to content

Tests: Requirements: Scheduled weekly dependency update for week 18 (… #2601

Tests: Requirements: Scheduled weekly dependency update for week 18 (…

Tests: Requirements: Scheduled weekly dependency update for week 18 (… #2601

Workflow file for this run

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@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
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@v4
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
# 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@v4
- run: docker build -f alpine.dockerfile -t foo .
- run: >
docker run
foo
pytest
-n 3 --maxfail 3 --durations 10 tests/unit tests/functional
# 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
"