|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + - stable |
| 10 | + - v* |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: test-${{ github.ref }} |
| 14 | + cancel-in-progress: false |
| 15 | + |
| 16 | +jobs: |
| 17 | + # This is the "main" test suite, which tests a large number of different |
| 18 | + # versions of default compilers and Python versions in GitHub Actions. |
| 19 | + standard: |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + os: ['ubuntu-latest', 'windows-2022', 'macos-13'] |
| 24 | + python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14.0-rc.2', 'pypy3.9-v7.3.16', 'pypy3.10-v7.3.17'] |
| 25 | + |
| 26 | + name: "Python ${{ matrix.python }} / ${{ matrix.os }}" |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + submodules: true |
| 33 | + |
| 34 | + - name: Setup Python ${{ matrix.python }} |
| 35 | + uses: actions/setup-python@v5 |
| 36 | + with: |
| 37 | + python-version: ${{ matrix.python }} |
| 38 | + cache: 'pip' |
| 39 | + |
| 40 | + - name: Install the latest CMake |
| 41 | + uses: lukka/get-cmake@latest |
| 42 | + |
| 43 | + - name: Install Eigen |
| 44 | + if: matrix.os == 'ubuntu-latest' |
| 45 | + run: sudo apt-get -y install libeigen3-dev |
| 46 | + |
| 47 | + - name: Install PyTest |
| 48 | + run: | |
| 49 | + python -m pip install pytest pytest-github-actions-annotate-failures typing_extensions |
| 50 | +
|
| 51 | + - name: Install NumPy |
| 52 | + if: ${{ !startsWith(matrix.python, 'pypy') && !contains(matrix.python, 'alpha') }} |
| 53 | + run: | |
| 54 | + python -m pip install numpy scipy |
| 55 | +
|
| 56 | + - name: Configure |
| 57 | + run: > |
| 58 | + cmake -S . -B build -DNB_TEST_STABLE_ABI=ON -DNB_TEST_SHARED_BUILD="$(python -c 'import sys; print(int(sys.version_info.minor>=11))')" |
| 59 | +
|
| 60 | + - name: Build C++ |
| 61 | + run: cmake --build build -j 2 |
| 62 | + |
| 63 | + - name: Check ABI tag |
| 64 | + if: ${{ !startsWith(matrix.os, 'windows') }} |
| 65 | + run: > |
| 66 | + cd build/tests; |
| 67 | + python -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")' |
| 68 | +
|
| 69 | + - name: Check ABI tag |
| 70 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 71 | + run: > |
| 72 | + cd build/tests/Debug; |
| 73 | + python -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")' |
| 74 | +
|
| 75 | + - name: Run tests |
| 76 | + run: > |
| 77 | + cd build; |
| 78 | + python -m pytest |
| 79 | +
|
| 80 | + nvcc-ubuntu: |
| 81 | + runs-on: ubuntu-latest |
| 82 | + container: nvidia/cuda:12.5.1-devel-ubuntu24.04 |
| 83 | + name: "Python 3 / NVCC (CUDA 12.6.1) / ubuntu-latest" |
| 84 | + |
| 85 | + steps: |
| 86 | + - name: Install dependencies |
| 87 | + 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 |
| 88 | + |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + with: |
| 91 | + submodules: true |
| 92 | + |
| 93 | + - name: Configure |
| 94 | + run: > |
| 95 | + cmake -S . -B build -DNB_TEST_CUDA=ON |
| 96 | +
|
| 97 | + - name: Build C++ |
| 98 | + run: cmake --build build -j 2 |
| 99 | + |
| 100 | + - name: Check ABI tag |
| 101 | + run: > |
| 102 | + cd build/tests; |
| 103 | + python3 -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")' |
| 104 | +
|
| 105 | + - name: Run tests |
| 106 | + run: > |
| 107 | + cd build; |
| 108 | + python3 -m pytest |
| 109 | +
|
| 110 | + old-compilers: |
| 111 | + if: false # Disable for now, the CI is glitchy |
| 112 | + strategy: |
| 113 | + fail-fast: false |
| 114 | + matrix: |
| 115 | + include: |
| 116 | + - cc: gcc-8 |
| 117 | + cxx: g++-8 |
| 118 | + apt: gcc-8 g++-8 |
| 119 | + - cc: gcc-9 |
| 120 | + cxx: g++-9 |
| 121 | + apt: gcc-9 |
| 122 | + - cc: clang-8 |
| 123 | + cxx: clang++-8 |
| 124 | + apt: clang-8 |
| 125 | + - cc: clang-9 |
| 126 | + cxx: clang++-9 |
| 127 | + apt: clang-9 |
| 128 | + - cc: clang-10 |
| 129 | + cxx: clang++-10 |
| 130 | + apt: clang-10 |
| 131 | + |
| 132 | + runs-on: ubuntu-latest |
| 133 | + container: ubuntu:20.04 |
| 134 | + name: "${{matrix.cc}} on Ubuntu 20.04" |
| 135 | + env: |
| 136 | + CC: ${{matrix.cc}} |
| 137 | + CXX: ${{matrix.cxx}} |
| 138 | + DEBIAN_FRONTEND: noninteractive |
| 139 | + |
| 140 | + steps: |
| 141 | + - name: Install dependencies |
| 142 | + run: | |
| 143 | + apt-get update |
| 144 | + apt-get install -y python3-numpy python3-pip python3-pytest libeigen3-dev cmake git ${{matrix.apt}} |
| 145 | + python3 -m pip install typing_extensions |
| 146 | +
|
| 147 | + - uses: actions/checkout@v4 |
| 148 | + with: |
| 149 | + submodules: true |
| 150 | + |
| 151 | + - name: Configure |
| 152 | + run: cmake -S . -B build |
| 153 | + |
| 154 | + - name: Build C++ |
| 155 | + run: cmake --build build -j 2 |
| 156 | + |
| 157 | + - name: Check ABI tag |
| 158 | + run: > |
| 159 | + cd build/tests; |
| 160 | + python3 -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")' |
| 161 | +
|
| 162 | + - name: Run tests |
| 163 | + run: > |
| 164 | + cd build; |
| 165 | + python3 -m pytest |
| 166 | +
|
| 167 | + free-threaded: |
| 168 | + name: "Python 3.14-dev / ubuntu.latest [free-threaded]" |
| 169 | + runs-on: ubuntu-latest |
| 170 | + |
| 171 | + steps: |
| 172 | + - uses: actions/checkout@v4 |
| 173 | + with: |
| 174 | + submodules: true |
| 175 | + |
| 176 | + - uses: deadsnakes/[email protected] |
| 177 | + with: |
| 178 | + python-version: 3.14-dev |
| 179 | + nogil: true |
| 180 | + |
| 181 | + - name: Install the latest CMake |
| 182 | + uses: lukka/get-cmake@latest |
| 183 | + |
| 184 | + - name: Install PyTest |
| 185 | + run: | |
| 186 | + python -m pip install pytest pytest-github-actions-annotate-failures |
| 187 | +
|
| 188 | + - name: Configure |
| 189 | + run: > |
| 190 | + cmake -S . -B build -DNB_TEST_FREE_THREADED=ON |
| 191 | +
|
| 192 | + - name: Build C++ |
| 193 | + run: > |
| 194 | + cmake --build build -j 2 |
| 195 | +
|
| 196 | + - name: Check ABI tag |
| 197 | + run: > |
| 198 | + cd build/tests; |
| 199 | + python -c 'import test_functions_ext as t; print(f"ABI tag is \"{ t.abi_tag() }\"")' |
| 200 | +
|
| 201 | + - name: Run tests |
| 202 | + run: > |
| 203 | + cd build; |
| 204 | + python -m pytest |
0 commit comments