1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
|
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-15']
python: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy3.10-v7.3.19', 'pypy3.11-v7.3.20']
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, 'alpha') }}
run: |
python -m pip install numpy scipy
- name: Configure
run: >
cmake -S . -B build -DNB_TEST_STABLE_ABI=ON -DNB_TEST_SHARED_BUILD="$(python -c 'import sys; print(int(sys.version_info.minor>=11))')"
- name: Build C++
run: cmake --build build -j 2
- name: Check ABI tag
if: ${{ !startsWith(matrix.os, 'windows') }}
run: >
cd build/tests;
python -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")'
- name: Check ABI tag
if: ${{ startsWith(matrix.os, 'windows') }}
run: >
cd build/tests/Debug;
python -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")'
- name: Run tests
run: >
cd build;
python -m pytest
nvcc-ubuntu:
runs-on: ubuntu-latest
container: nvidia/cuda:12.5.1-devel-ubuntu24.04
name: "Python 3 / NVCC (CUDA 12.6.1) / ubuntu-latest"
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-typing-extensions python3-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: Check ABI tag
run: >
cd build/tests;
python3 -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")'
- name: Run tests
run: >
cd build;
python3 -m pytest
free-threaded:
name: "Python 3.14-dev / ubuntu.latest [free-threaded]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: deadsnakes/action@v3.1.0
with:
python-version: 3.14-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: Check ABI tag
run: >
cd build/tests;
python -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")'
- name: Run tests
run: >
cd build;
python -m pytest
mingw:
runs-on: windows-2022
name: "Python ${{ matrix.python }} / MinGW-w64"
strategy:
fail-fast: false
matrix:
python: ['3.12']
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: Setup MSYS2 (MINGW64)
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-python
mingw-w64-x86_64-python-pip
mingw-w64-x86_64-python-pytest
- name: Install Python packages
shell: msys2 {0}
run: |
python -m pip install pytest-github-actions-annotate-failures typing_extensions
- name: Configure
shell: msys2 {0}
run: |
export PATH=/mingw64/bin:$PATH
export CC=gcc
export CXX=g++
PYEXE=/mingw64/bin/python3.exe
cmake -S . -B build -G Ninja \
-DPython_EXECUTABLE="$(cygpath -w "$PYEXE")" \
-DNB_TEST_FREE_THREADED=OFF
- name: Build C++
shell: msys2 {0}
run: cmake --build build -j 2
- name: Check ABI tag
shell: msys2 {0}
run: |
cd build/tests
python -c 'import test_functions_ext as t; print(f"ABI tag is \"{t.abi_tag()}\"")'
- name: Run tests
shell: msys2 {0}
run: |
cd build
python -m pytest
intel:
runs-on: ubuntu-22.04
name: "Python ${{ matrix.python }} / Intel ICX"
strategy:
fail-fast: false
matrix:
python: ['3.12']
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: Cache Intel oneAPI
id: cache-oneapi
uses: actions/cache@v4
with:
path: /opt/intel/oneapi
key: install-${{ runner.os }}-intel-oneapi-compiler-2025.2
- name: Add Intel repository
if: steps.cache-oneapi.outputs.cache-hit != 'true'
run: |
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
- name: Install Intel oneAPI compilers
if: steps.cache-oneapi.outputs.cache-hit != 'true'
run: |
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp
- name: Cleanup Intel oneAPI cache
if: steps.cache-oneapi.outputs.cache-hit != 'true'
run: |
sudo rm -rf /opt/intel/oneapi/compiler/*/linux/lib/ia32
sudo rm -rf /opt/intel/oneapi/compiler/*/linux/lib/emu
sudo rm -rf /opt/intel/oneapi/compiler/*/linux/lib/oclfpga
- name: Install the latest CMake
uses: lukka/get-cmake@latest
- name: Install PyTest
run: |
python -m pip install pytest pytest-github-actions-annotate-failures typing_extensions
- name: Configure
run: |
source /opt/intel/oneapi/setvars.sh
export CC=icx
export CXX=icpx
cmake -S . -B build
- name: Build C++
run: |
source /opt/intel/oneapi/setvars.sh
cmake --build build -j 2
- name: Check ABI tag
run: |
source /opt/intel/oneapi/setvars.sh
cd build/tests
python -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")'
- name: Run tests
run: |
source /opt/intel/oneapi/setvars.sh
cd build
python -m pytest
|