Support for free-threaded Python #1915
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
- stable | |
- v* | |
concurrency: | |
group: test-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
# This is the "main" test suite, which tests a large number of different | |
# versions of default compilers and Python versions in GitHub Actions. | |
standard: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'windows-2022', 'macos-13'] | |
python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13.0-rc.2', 'pypy3.9-v7.3.16', 'pypy3.10-v7.3.17'] | |
name: "Python ${{ matrix.python }} / ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: 'pip' | |
- name: Install the latest CMake | |
uses: lukka/get-cmake@latest | |
- name: Install Eigen | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get -y install libeigen3-dev | |
- name: Install PyTest | |
run: | | |
python -m pip install pytest pytest-github-actions-annotate-failures typing_extensions | |
- name: Install NumPy | |
if: ${{ !startsWith(matrix.python, 'pypy') && !contains(matrix.python, 'rc.2') }} | |
run: | | |
python -m pip install numpy scipy | |
- name: Configure | |
run: > | |
cmake -S . -B build -DNB_TEST_STABLE_ABI=ON -DNB_TEST_SHARED_BUILD="$(python3 -c 'import sys; print(int(sys.version_info.minor>=11))')" | |
- name: Build C++ | |
run: cmake --build build -j 2 | |
- name: Run tests | |
run: > | |
cd build; | |
python -m pytest | |
nvcc: | |
runs-on: ubuntu-latest | |
container: nvidia/cuda:12.2.0-devel-ubuntu22.04 | |
name: "Python 3 / NVCC (CUDA 12.2)" | |
steps: | |
- name: Install dependencies | |
run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-pip libeigen3-dev && python3 -m pip install typing_extensions numpy | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Configure | |
run: > | |
cmake -S . -B build -DNB_TEST_CUDA=ON | |
- name: Build C++ | |
run: cmake --build build -j 2 | |
- name: Run tests | |
run: > | |
cd build; | |
python3 -m pytest | |
old-compilers: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- cc: gcc-8 | |
cxx: g++-8 | |
apt: gcc-8 g++-8 | |
- cc: gcc-9 | |
cxx: g++-9 | |
apt: gcc-9 | |
- cc: clang-8 | |
cxx: clang++-8 | |
apt: clang-8 | |
- cc: clang-9 | |
cxx: clang++-9 | |
apt: clang-9 | |
- cc: clang-10 | |
cxx: clang++-10 | |
apt: clang-10 | |
runs-on: ubuntu-20.04 | |
name: "${{matrix.cc}} on Ubuntu 20.04" | |
env: | |
CC: ${{matrix.cc}} | |
CXX: ${{matrix.cxx}} | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install python3-numpy python3-pytest libeigen3-dev ${{matrix.apt}} | |
python3 -m pip install typing_extensions | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Configure | |
run: cmake -S . -B build | |
- name: Build C++ | |
run: cmake --build build -j 2 | |
- name: Run tests | |
run: > | |
cd build; | |
python -m pytest | |
free-threaded: | |
name: "Python 3.13-dev / ubuntu.latest [free-threaded]" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: deadsnakes/[email protected] | |
with: | |
python-version: 3.13-dev | |
nogil: true | |
- name: Install the latest CMake | |
uses: lukka/get-cmake@latest | |
- name: Install PyTest | |
run: | | |
python -m pip install pytest pytest-github-actions-annotate-failures | |
- name: Configure | |
run: > | |
cmake -S . -B build -DNB_TEST_FREE_THREADED=ON | |
- name: Build C++ | |
run: cmake --build build -j 2 | |
- name: Run tests | |
run: > | |
cd build; | |
python -m pytest |