pybind11 #94
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: pybind11 | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ main ] | |
paths: | |
- '.github/workflows/pybind11.yml' | |
schedule: | |
# ┌───────────── minute (0 - 59) | |
# │ ┌───────────── hour (0 - 23) | |
# │ │ ┌───────────── day of the month (1 - 31) | |
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
# │ │ │ │ │ | |
- cron: "0 2 * * 0" | |
concurrency: | |
group: test-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PIP_ONLY_BINARY: numpy | |
FORCE_COLOR: 3 | |
PYTEST_TIMEOUT: 300 | |
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: | |
runs-on: [ubuntu-latest, windows-2022, macos-latest] | |
python: | |
- 'pypy-3.10-nightly' | |
- 'pypy-3.9-nightly' | |
# Items in here will either be added to the build matrix (if not | |
# present), or add new keys to an existing matrix element if all the | |
# existing keys match. | |
# | |
# We support an optional key: args, for cmake args | |
include: | |
- runs-on: ubuntu-latest | |
python: 'pypy-3.9-nightly' | |
args: > | |
-DPYBIND11_FINDPYTHON=ON | |
name: "pybind11 ${{ matrix.python }} • ${{ matrix.runs-on }} x64 ${{ matrix.args }}" | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: pybind/pybind11 | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Setup Boost (Linux) | |
# Can't use boost + define _ | |
if: runner.os == 'Linux' | |
run: sudo apt-get install libboost-dev | |
- name: Setup Boost (macOS) | |
if: runner.os == 'macOS' | |
run: brew install boost | |
- name: Update CMake | |
uses: jwlawson/[email protected] | |
- name: Cache wheels | |
if: runner.os == 'macOS' | |
uses: actions/cache@v3 | |
with: | |
# This path is specific to macOS - we really only need it for PyPy NumPy wheels | |
# See https://github.com/actions/cache/blob/master/examples.md#python---pip | |
# for ways to do this more generally | |
path: ~/Library/Caches/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ matrix.python }}-x64-${{ hashFiles('tests/requirements.txt') }} | |
- name: Prepare env | |
run: | | |
python -m pip install -r tests/requirements.txt | |
- name: Setup annotations on Linux | |
if: runner.os == 'Linux' | |
run: python -m pip install pytest-github-actions-annotate-failures | |
# First build - C++11 mode and inplace | |
- name: Configure C++11 ${{ matrix.args }} | |
run: > | |
cmake -S . -B . | |
-DPYBIND11_WERROR=ON | |
-DDOWNLOAD_CATCH=ON | |
-DDOWNLOAD_EIGEN=ON | |
-DCMAKE_CXX_STANDARD=11 | |
${{ matrix.args }} | |
- name: Build C++11 | |
run: cmake --build . -j 2 | |
- name: Python tests C++11 | |
run: cmake --build . --target pytest -j 2 | |
- name: C++11 tests | |
# TODO: Figure out how to load the DLL on Python 3.8+ | |
if: "!(runner.os == 'Windows' && (matrix.python == 3.8 || matrix.python == 3.9 || matrix.python == '3.10' || matrix.python == '3.11-dev' || matrix.python == 'pypy-3.8'))" | |
run: cmake --build . --target cpptest -j 2 | |
- name: Interface test C++11 | |
run: cmake --build . --target test_cmake_build | |
- name: Clean directory | |
run: git clean -fdx | |
# Second build - C++17 mode and in a build directory | |
- name: Configure C++17 | |
run: > | |
cmake -S . -B build2 | |
-DPYBIND11_WERROR=ON | |
-DDOWNLOAD_CATCH=ON | |
-DDOWNLOAD_EIGEN=ON | |
-DCMAKE_CXX_STANDARD=17 | |
${{ matrix.args }} | |
- name: Build | |
run: cmake --build build2 -j 2 | |
- name: Python tests | |
run: cmake --build build2 --target pytest | |
- name: C++ tests | |
# TODO: Figure out how to load the DLL on Python 3.8+ | |
if: "!(runner.os == 'Windows' && (matrix.python == 3.8 || matrix.python == 3.9 || matrix.python == '3.10' || matrix.python == '3.11-dev' || matrix.python == 'pypy-3.8'))" | |
run: cmake --build build2 --target cpptest | |
# Third build - C++17 mode with unstable ABI | |
- name: Configure (unstable ABI) | |
run: > | |
cmake -S . -B build3 | |
-DPYBIND11_WERROR=ON | |
-DDOWNLOAD_CATCH=ON | |
-DDOWNLOAD_EIGEN=ON | |
-DCMAKE_CXX_STANDARD=17 | |
-DPYBIND11_INTERNALS_VERSION=10000000 | |
"-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp" | |
${{ matrix.args }} | |
- name: Build (unstable ABI) | |
run: cmake --build build3 -j 2 | |
- name: Python tests (unstable ABI) | |
run: cmake --build build3 --target pytest | |
- name: Interface test | |
run: cmake --build build2 --target test_cmake_build | |