Skip to content

CI

CI #19

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- master
paths:
- ".github/workflows/ci.yml"
- "pyproject.toml"
- "mypy.ini"
- "**/*.py"
pull_request:
paths:
- ".github/workflows/ci.yml"
- "pyproject.toml"
- "mypy.ini"
- "**/*.py"
concurrency:
# Cancel previous runs for the same PR
# Don't cancel successive pushes to master
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
ruff:
runs-on: ubuntu-latest
timeout-minutes: &timeout-minutes 5
steps:
- uses: actions/checkout@v6
- uses: astral-sh/ruff-action@v4.0.0
mypy:
runs-on: ${{ matrix.os }}
timeout-minutes: *timeout-minutes
strategy:
# mypy is os and python-version sensitive. Test on all supported combinations
matrix:
# Arm runners are faster (as long as the same wheels are available)
os: [windows-11-arm, ubuntu-24.04-arm, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v8.2.0
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- run: uv sync --locked
- run: mypy . --python-version=${{ matrix.python-version }}
tests:
runs-on: ${{ matrix.os }}
timeout-minutes: *timeout-minutes
strategy:
# Test on all supported runtime combinations
matrix:
# Arm runners are faster (as long as the same wheels are available)
# This project doesn't have any code that should act differently per architecture
os: [windows-11-arm, ubuntu-24.04-arm, macos-latest]
# TODO: Run tests in parallel on free-threaded python to catch free-threading issues
# See: https://py-free-threading.github.io/testing/
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Install Linux Packages
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
# xvfb+openbox: headless X server and WM
# gedit: the test window (not preinstalled on GitHub runners)
# x11-xserver-utils (xrandr/xset): required by tests for window geometry
# dbus-x11: dbus-launch, so the GTK app (gedit) gets a session bus
sudo apt install -y xvfb openbox gedit x11-xserver-utils dbus-x11
- uses: astral-sh/setup-uv@v8.2.0
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- run: uv sync --locked
- name: Run tests (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
working-directory: tests
run: xvfb-run --server-args="-screen 0 1280x1024x24" bash -c "openbox & sleep 1 && dbus-launch --exit-with-session python test_pywinbox.py"
- name: Run tests (Windows & macOS)
if: ${{ !startsWith(matrix.os, 'ubuntu') }}
working-directory: tests
run: python test_pywinbox.py
- name: Run tests (MacNSBox)
if: ${{ startsWith(matrix.os, 'macos') }}
working-directory: tests
run: python test_MacNSBox.py
sphinx:
runs-on: ubuntu-24.04-arm # Keep in sync with build.os in .readthedocs.yaml
timeout-minutes: *timeout-minutes
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v8.2.0
with:
python-version: "3.14" # Keep in sync with build.tools.python in .readthedocs.yaml
activate-environment: true
- run: uv sync --locked --no-default-groups --group=docs
- name: Build docs
# TODO: Add --fail-on-warning, but still too many warnings right now
run: sphinx-build --keep-going --builder html docs/source docs/_build/html