Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
278 changes: 11 additions & 267 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,285 +34,29 @@ concurrency:
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
# GitHub Actions switched to macOS on amr64 by default. Keep
# a job running on macOS on x86-64 for a while longer.
- macos-15-intel
python:
- '3.9'
- '3.15'
meson:
-
dependencies:
-
include:
- os: ubuntu-latest
python: 'pypy-3.9'
- os: ubuntu-latest
python: 'pypy-3.11'
- os: ubuntu-latest
python: '3.10'
# Test with older supported Meson version. Meson up to
# version 1.2.3 requires distutils, which has been removed
# from the stdlib in Python 3.12, thus test with Pythn 3.11.
# To avoid having too many CI jobs, combine this with tests
# with the minimum version of other dependencies.
- os: ubuntu-latest
python: '3.11'
meson: '~=0.64.0'
- os: ubuntu-latest
python: '3.11'
meson: '~=1.0.0'
- os: ubuntu-latest
python: '3.11'
meson: '~=1.1.0'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.2.3'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.3.0'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.4.0'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.5.0'
dependencies: 'packaging==23.2 pyproject-metadata==0.9.0'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.6.0'
dependencies: 'pyproject-metadata==0.9.0'
- os: ubuntu-latest
python: '3.12'
meson: '~=1.7.0'
dependencies: 'packaging==23.2'
- os: ubuntu-latest
python: '3.13'
meson: '~=1.8.0'
# Test with Meson master branch.
- os: ubuntu-latest
python: '3.14'
meson: '@git+https://github.com/mesonbuild/meson.git'
- os: windows-latest
python: '3.14'
meson: '@git+https://github.com/mesonbuild/meson.git'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up target Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true

- name: Install Ninja
run: sudo apt-get install ninja-build
if: ${{ runner.os == 'Linux' }}

- name: Install Ninja
run: brew install ninja
if: ${{ runner.os == 'macOS' }}

- name: Install Ninja
run: python -m pip install ninja
if: ${{ runner.os == 'Windows' }}

- name: Install Meson
run: python -m pip install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}

- name: Install dependencies
run: python -m pip install ${{ matrix.dependencies }}
if: ${{ matrix.dependencies }}

- name: Install
run: python -m pip install . --group test

- name: Run tests
run: python -m pytest --showlocals -vv --cov --cov-report=xml

- name: Upload coverage report
uses: codecov/codecov-action@v4
if: ${{ always() }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

msvc:
debug:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python:
- '3.11'
meson:
-

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up target Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install Ninja
run: python -m pip install ninja
- run: python -m pip install ninja

- name: Setup MSVC
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
- uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: x64

- name: Install Meson
run: python -m pip install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}

- name: Install
run: python -m pip install . --group test

- name: Run tests
run: python -m pytest --showlocals -vv

cygwin:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python:
- '3.9'
meson:
-

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Cygwin
uses: cygwin/cygwin-install-action@v2
with:
packages: >-
python39
python39-devel
python39-pip
python39-setuptools
cmake
gcc-core
gcc-g++
git
make
ninja

- name: Fix git dubious ownership
# This addresses the "fatal: detected dubious ownership in
# repository" and "fatal: not in a git directory" errors
# encountered when trying to run Cygwin git in a directory not
# owned by the current user. This happens when the tests run
# Cygwin git in a directory outside the Cygwin filesystem.
run: git config --global --add safe.directory '*'
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Get pip cache path
id: pip-cache-path
run: echo "path=$(cygpath -w $(python -m pip cache dir))" >> $GITHUB_OUTPUT
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Restore cache
# Cygwin Python cannot use binary wheels from PyPI. Building
# some dependencies takes considerable time. Caching the built
# wheels speeds up the CI job quite a bit.
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-path.outputs.path }}
key: cygwin-pip-${{ github.sha }}
restore-keys: cygwin-pip-

- name: Install Meson
run: python -m pip install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Install
# Cygwin patches Python's ensurepip module to look for the
# wheels needed to initialize a new virtual environment in
# /usr/share/python-wheels/ but nothing in Cygwin actually
# puts the setuptools and pip wheels there. Fix this.
run: |
mkdir /usr/share/python-wheels/
pushd /usr/share/python-wheels/
python -m pip download setuptools pip
popd
python -m pip install . --group test
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

- name: Run tests
run: python -m pytest --showlocals -vv
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}

homebrew:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python:
- '3.9'
- '3.12'
meson:
-

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Homebrew Python
run: |
brew install --overwrite python@${{ matrix.python }}
echo /opt/homebrew/opt/python@${{ matrix.python }}/libexec/bin/ >> $GITHUB_PATH
python${{ matrix.python }} -m pip config set global.break-system-packages true

- name: Check Python version
run: python --version | grep ${{ matrix.python }}

- name: Install Ninja
run: brew install ninja

- name: Install Meson
run: python -m pip install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}

- name: Install
run: python -m pip install . --group test

- name: Run tests
run: python -m pytest --showlocals -vv

mypy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- run: python -m pip install "meson @git+https://github.com/mesonbuild/meson.git"

- name: Install dependencies
run: python -m pip install .
- run: rustup override set nightly

- name: Install mypy
run: python -m pip install mypy~=1.19
- run: meson setup tests/packages/rust-pyo3 _build_rust --vsenv -Dbuildtype=release
- run: meson compile -C _build_rust -v || true

- name: Run mypy
run: mypy -p mesonpy
- run: meson setup tests/packages/purelib-and-platlib _build_c -Dbuildtype=release
- run: meson compile -C _build_c -v
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ def __init__(self, source_dir, build_dir, meson_args=None, editable_verbose=None
# keeps working.
'link-against-local-lib',

# The ``rust-pyo3`` package bumps into this Meson
# warning: ``WARNING: Library entry portable_atomic
# has unexpected keys "doc-scrape-examples"``.
'rust-pyo3',
}:
if meson_args is None:
meson_args = {}
Expand Down
Loading
Loading