|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - ".github/workflows/type-checking.yml" |
| 11 | + - "setup.cfg" |
| 12 | + - "pyproject.toml" |
| 13 | + - "requirements.txt" |
| 14 | + - "**/*.py" |
| 15 | + |
| 16 | +jobs: |
| 17 | + mypy: |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + # mypy is os and python-version sensitive. Test on all supported combinations |
| 21 | + matrix: |
| 22 | + # Arm runners are faster (as long as the same wheels are available) |
| 23 | + os: [windows-11-arm, ubuntu-24.04-arm, macos-latest] |
| 24 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] |
| 25 | + # actions/setup-python doesn't support Python < 3.11 on ARM |
| 26 | + exclude: |
| 27 | + - python-version: "3.9" |
| 28 | + os: windows-11-arm |
| 29 | + - python-version: "3.10" |
| 30 | + os: windows-11-arm |
| 31 | + include: |
| 32 | + - python-version: "3.9" |
| 33 | + os: windows-latest |
| 34 | + - python-version: "3.10" |
| 35 | + os: windows-latest |
| 36 | + fail-fast: false |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v6 |
| 39 | + - uses: actions/setup-python@v6 |
| 40 | + with: |
| 41 | + python-version: ${{ matrix.python-version }} |
| 42 | + cache: "pip" |
| 43 | + - run: pip install -r "requirements.txt" |
| 44 | + - run: mypy . --python-version=${{ matrix.python-version }} |
| 45 | + |
| 46 | + tests: |
| 47 | + runs-on: ${{ matrix.os }} |
| 48 | + strategy: |
| 49 | + # Test on all supported runtime combinations |
| 50 | + matrix: |
| 51 | + # Arm runners are faster (as long as the same wheels are available) |
| 52 | + # PyWinCtl doesn't have any code that should act differently per architecture |
| 53 | + os: [windows-11-arm, ubuntu-24.04-arm, macos-latest] |
| 54 | + # TODO: Run tests in parallel on free-threaded python to catch free-threading issues |
| 55 | + # See: https://py-free-threading.github.io/testing/ |
| 56 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] |
| 57 | + # actions/setup-python doesn't support Python < 3.11 on ARM |
| 58 | + exclude: |
| 59 | + - python-version: "3.9" |
| 60 | + os: windows-11-arm |
| 61 | + - python-version: "3.10" |
| 62 | + os: windows-11-arm |
| 63 | + include: |
| 64 | + - python-version: "3.9" |
| 65 | + os: windows-latest |
| 66 | + - python-version: "3.10" |
| 67 | + os: windows-latest |
| 68 | + |
| 69 | + fail-fast: false |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v6 |
| 72 | + - uses: actions/setup-python@v6 |
| 73 | + with: |
| 74 | + python-version: ${{ matrix.python-version }} |
| 75 | + cache: "pip" |
| 76 | + - run: pip install -r "requirements.txt" |
| 77 | + - name: Run tests (Linux) |
| 78 | + if: ${{ startsWith(matrix.os, 'ubuntu') }} |
| 79 | + working-directory: tests |
| 80 | + run: | |
| 81 | + sudo apt update |
| 82 | + sudo apt install gedit xvfb x11-xserver-utils openbox dbus-x11 |
| 83 | + xvfb-run --server-args="-screen 0 1280x1024x24" bash -c "openbox & sleep 1 && dbus-launch --exit-with-session python test_pywinctl.py" |
| 84 | + - name: Run tests (Windows & macOS) |
| 85 | + run: python test_pywinctl.py |
| 86 | + if: ${{ !startsWith(matrix.os, 'ubuntu') }} |
| 87 | + working-directory: tests |
| 88 | + |
| 89 | + sphinx: |
| 90 | + runs-on: ubuntu-24.04-arm # Keep in sync with build.os in .readthedocs.yaml |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v6 |
| 93 | + - uses: actions/setup-python@v6 |
| 94 | + with: |
| 95 | + python-version: "3.11" # Keep in sync with build.tools.python in .readthedocs.yaml |
| 96 | + - run: pip install -r "requirements.txt" |
| 97 | + - name: Build docs |
| 98 | + # TODO: Add --fail-on-warning, but now still too many warnings |
| 99 | + run: sphinx-build --keep-going --builder html docs/source docs/_build/html |
0 commit comments