slint/.github/workflows/python_test_reusable.yaml
Simon Hausmann d903afecef Python: Fix tests in the CI having difficulties connecting to Xvfb
Instead of connecting to the X server, let's run the Python tests with the testing backend, like we do for test-driver-rust, test-driver-cpp, etc.

When building the Python package, pass --features backend-testing to Cargo, to forward to enabling the backend-testing feature in i-slint-backend-selector. That consequently enables SLINT_BACKEND=testing.
2025-11-30 10:02:36 +01:00

59 lines
2.1 KiB
YAML

# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
name: Python Test (Reusable)
on:
workflow_call:
inputs:
name:
description: 'Name of the job'
required: true
type: string
os:
description: 'Operating system to run on'
required: true
type: string
env:
DYLD_FRAMEWORK_PATH: /Users/runner/work/slint/Qt/5.15.2/clang_64/lib
QT_QPA_PLATFORM: offscreen
RUSTFLAGS: -D warnings
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_INCREMENTAL: false
RUST_BACKTRACE: full
SLINT_BACKEND: testing
MATURIN_PEP517_ARGS: --features backend-testing
jobs:
python_test:
name: ${{ inputs.name }}
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/install-linux-dependencies
- uses: ./.github/actions/setup-rust
with:
key: x-python-v0-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory.
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build and sync environment
working-directory: api/python/slint
run: uv sync
- name: Run ty
working-directory: api/python/slint
run: uvx ty check
- name: Run ruff linter
working-directory: api/python/slint
run: uv tool run ruff check
- name: Run ruff linter
working-directory: api/python/briefcase
run: uv tool run ruff check
- name: Run python tests
working-directory: api/python/slint
run: uv run pytest -s -v
- name: Run python test driver
run: cargo test -p test-driver-python