From e7e585ce6cc13914be8972f6c412387bc4f17de1 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 8 Nov 2022 11:40:19 -0800 Subject: [PATCH 01/26] Clear out all appveyor and GHA .yml files --- .appveyor.yml | 35 -- .github/dependabot.yml | 7 - .github/labeler.yml | 8 - .github/labeler_merged.yml | 3 - .github/workflows/ci.yml | 969 -------------------------------- .github/workflows/configure.yml | 80 --- .github/workflows/format.yml | 55 -- .github/workflows/labeler.yml | 20 - .github/workflows/pip.yml | 110 ---- .github/workflows/upstream.yml | 112 ---- 10 files changed, 1399 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 .github/dependabot.yml delete mode 100644 .github/labeler.yml delete mode 100644 .github/labeler_merged.yml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/configure.yml delete mode 100644 .github/workflows/format.yml delete mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/pip.yml delete mode 100644 .github/workflows/upstream.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 360760ac8d..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: 1.0.{build} -image: -- Visual Studio 2017 -test: off -skip_branch_with_pr: true -build: - parallel: true -platform: -- x86 -environment: - matrix: - - PYTHON: 36 - CONFIG: Debug -install: -- ps: | - $env:CMAKE_GENERATOR = "Visual Studio 15 2017" - if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" } - $env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH" - python -W ignore -m pip install --upgrade pip wheel - python -W ignore -m pip install pytest numpy --no-warn-script-location pytest-timeout -- ps: | - Start-FileDownload 'https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip' - 7z x eigen-3.3.7.zip -y > $null - $env:CMAKE_INCLUDE_PATH = "eigen-3.3.7;$env:CMAKE_INCLUDE_PATH" -build_script: -- cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_ARCH%" - -DCMAKE_CXX_STANDARD=14 - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DCMAKE_SUPPRESS_REGENERATION=1 - . -- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" -- cmake --build . --config %CONFIG% --target pytest -- /m /v:m /logger:%MSBuildLogger% -- cmake --build . --config %CONFIG% --target cpptest -- /m /v:m /logger:%MSBuildLogger% -on_failure: if exist "tests\test_cmake_build" type tests\test_cmake_build\*.log* diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 2c7d170839..0000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -updates: - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index abb0d05aaa..0000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,8 +0,0 @@ -docs: -- any: - - 'docs/**/*.rst' - - '!docs/changelog.rst' - - '!docs/upgrade.rst' - -ci: -- '.github/workflows/*.yml' diff --git a/.github/labeler_merged.yml b/.github/labeler_merged.yml deleted file mode 100644 index 2374ad42e4..0000000000 --- a/.github/labeler_merged.yml +++ /dev/null @@ -1,3 +0,0 @@ -needs changelog: -- all: - - '!docs/changelog.rst' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index a11cae1ab0..0000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,969 +0,0 @@ -name: CI - -on: - workflow_dispatch: - pull_request: - push: - branches: - - master - - stable - - v* - -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: - - '3.6' - - '3.9' - - '3.10' - - '3.11' - - 'pypy-3.7' - - 'pypy-3.8' - - 'pypy-3.9' - - # 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: - # Just add a key - - runs-on: ubuntu-latest - python: '3.6' - args: > - -DPYBIND11_FINDPYTHON=ON - -DCMAKE_CXX_FLAGS="-D_=1" - - runs-on: ubuntu-latest - python: 'pypy-3.8' - args: > - -DPYBIND11_FINDPYTHON=ON - - runs-on: windows-2019 - python: '3.6' - args: > - -DPYBIND11_FINDPYTHON=ON - # Inject a couple Windows 2019 runs - - runs-on: windows-2019 - python: '3.9' - - name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}" - runs-on: ${{ matrix.runs-on }} - - steps: - - uses: actions/checkout@v3 - - - 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' && matrix.python != '3.6' - run: sudo apt-get install libboost-dev - - - name: Setup Boost (macOS) - if: runner.os == 'macOS' - run: brew install boost - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v1.13 - - - 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 - # More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON here. - - name: Configure C++11 ${{ matrix.args }} - run: > - cmake -S . -B . - -DPYBIND11_WERROR=ON - -DPYBIND11_SIMPLE_GIL_MANAGEMENT=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' || 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 - # More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF here. - - name: Configure C++17 - run: > - cmake -S . -B build2 - -DPYBIND11_WERROR=ON - -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF - -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' || 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 - - # This makes sure the setup_helpers module can build packages using - # setuptools - - name: Setuptools helpers test - run: pytest tests/extra_setuptools - if: "!(matrix.runs-on == 'windows-2022')" - - - deadsnakes: - strategy: - fail-fast: false - matrix: - include: - # TODO: Fails on 3.10, investigate - - python-version: "3.9" - python-debug: true - valgrind: true - - python-version: "3.11" - python-debug: false - - name: "🐍 ${{ matrix.python-version }}${{ matrix.python-debug && '-dbg' || '' }} (deadsnakes)${{ matrix.valgrind && ' • Valgrind' || '' }} • x64" - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python ${{ matrix.python-version }} (deadsnakes) - uses: deadsnakes/action@v2.1.1 - with: - python-version: ${{ matrix.python-version }} - debug: ${{ matrix.python-debug }} - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v1.13 - - - name: Valgrind cache - if: matrix.valgrind - uses: actions/cache@v3 - id: cache-valgrind - with: - path: valgrind - key: 3.16.1 # Valgrind version - - - name: Compile Valgrind - if: matrix.valgrind && steps.cache-valgrind.outputs.cache-hit != 'true' - run: | - VALGRIND_VERSION=3.16.1 - curl https://sourceware.org/pub/valgrind/valgrind-$VALGRIND_VERSION.tar.bz2 -o - | tar xj - mv valgrind-$VALGRIND_VERSION valgrind - cd valgrind - ./configure - make -j 2 > /dev/null - - - name: Install Valgrind - if: matrix.valgrind - working-directory: valgrind - run: | - sudo make install - sudo apt-get update - sudo apt-get install libc6-dbg # Needed by Valgrind - - - name: Prepare env - run: | - python -m pip install -r tests/requirements.txt - - - name: Configure - env: - SETUPTOOLS_USE_DISTUTILS: stdlib - run: > - cmake -S . -B build - -DCMAKE_BUILD_TYPE=Debug - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - -DCMAKE_CXX_STANDARD=17 - - - name: Build - run: cmake --build build -j 2 - - - name: Python tests - run: cmake --build build --target pytest - - - name: C++ tests - run: cmake --build build --target cpptest - - - name: Run Valgrind on Python tests - if: matrix.valgrind - run: cmake --build build --target memcheck - - - # Testing on clang using the excellent silkeh clang docker images - clang: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - clang: - - 3.6 - - 3.7 - - 3.9 - - 7 - - 9 - - dev - std: - - 11 - include: - - clang: 5 - std: 14 - - clang: 10 - std: 20 - - clang: 10 - std: 17 - - clang: 11 - std: 20 - - clang: 12 - std: 20 - - clang: 13 - std: 20 - - clang: 14 - std: 20 - - name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64" - container: "silkeh/clang:${{ matrix.clang }}" - - steps: - - uses: actions/checkout@v3 - - - name: Add wget and python3 - run: apt-get update && apt-get install -y python3-dev python3-numpy python3-pytest libeigen3-dev - - - name: Configure - shell: bash - run: > - cmake -S . -B build - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DCMAKE_CXX_STANDARD=${{ matrix.std }} - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Build - run: cmake --build build -j 2 - - - name: Python tests - run: cmake --build build --target pytest - - - name: C++ tests - run: cmake --build build --target cpptest - - - name: Interface test - run: cmake --build build --target test_cmake_build - - - # Testing NVCC; forces sources to behave like .cu files - cuda: - runs-on: ubuntu-latest - name: "🐍 3.10 • CUDA 11.7 • Ubuntu 22.04" - container: nvidia/cuda:11.7.0-devel-ubuntu22.04 - - steps: - - uses: actions/checkout@v3 - - # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND - - name: Install 🐍 3 - run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy - - - name: Configure - run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON - - - name: Build - run: cmake --build build -j2 --verbose - - - name: Python tests - run: cmake --build build --target pytest - - -# TODO: Internal compiler error - report to NVidia -# # Testing CentOS 8 + PGI compilers -# centos-nvhpc8: -# runs-on: ubuntu-latest -# name: "🐍 3 • CentOS8 / PGI 20.11 • x64" -# container: centos:8 -# -# steps: -# - uses: actions/checkout@v3 -# -# - name: Add Python 3 and a few requirements -# run: yum update -y && yum install -y git python3-devel python3-numpy python3-pytest make environment-modules -# -# - name: Install CMake with pip -# run: | -# python3 -m pip install --upgrade pip -# python3 -m pip install cmake --prefer-binary -# -# - name: Install NVidia HPC SDK -# run: > -# yum -y install -# https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc-20-11-20.11-1.x86_64.rpm -# https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc-2020-20.11-1.x86_64.rpm -# -# - name: Configure -# shell: bash -# run: | -# source /etc/profile.d/modules.sh -# module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.11 -# cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") -# -# - name: Build -# run: cmake --build build -j 2 --verbose -# -# - name: Python tests -# run: cmake --build build --target pytest -# -# - name: C++ tests -# run: cmake --build build --target cpptest -# -# - name: Interface test -# run: cmake --build build --target test_cmake_build - - - # Testing on CentOS 7 + PGI compilers, which seems to require more workarounds - centos-nvhpc7: - runs-on: ubuntu-latest - name: "🐍 3 • CentOS7 / PGI 22.9 • x64" - container: centos:7 - - steps: - - uses: actions/checkout@v3 - - - name: Add Python 3 and a few requirements - run: yum update -y && yum install -y epel-release && yum install -y git python3-devel make environment-modules cmake3 yum-utils - - - name: Install NVidia HPC SDK - run: yum-config-manager --add-repo https://developer.download.nvidia.com/hpc-sdk/rhel/nvhpc.repo && yum -y install nvhpc-22.9 - - # On CentOS 7, we have to filter a few tests (compiler internal error) - # and allow deeper template recursion (not needed on CentOS 8 with a newer - # standard library). On some systems, you many need further workarounds: - # https://github.com/pybind/pybind11/pull/2475 - - name: Configure - shell: bash - run: | - source /etc/profile.d/modules.sh - module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/22.9 - cmake3 -S . -B build -DDOWNLOAD_CATCH=ON \ - -DCMAKE_CXX_STANDARD=11 \ - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \ - -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \ - -DPYBIND11_TEST_FILTER="test_smart_ptr.cpp" - - # Building before installing Pip should produce a warning but not an error - - name: Build - run: cmake3 --build build -j 2 --verbose - - - name: Install CMake with pip - run: | - python3 -m pip install --upgrade pip - python3 -m pip install pytest - - - name: Python tests - run: cmake3 --build build --target pytest - - - name: C++ tests - run: cmake3 --build build --target cpptest - - - name: Interface test - run: cmake3 --build build --target test_cmake_build - - - # Testing on GCC using the GCC docker images (only recent images supported) - gcc: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - { gcc: 7, std: 11 } - - { gcc: 7, std: 17 } - - { gcc: 8, std: 14 } - - { gcc: 8, std: 17 } - - { gcc: 10, std: 17 } - - { gcc: 11, std: 20 } - - { gcc: 12, std: 20 } - - name: "🐍 3 • GCC ${{ matrix.gcc }} • C++${{ matrix.std }}• x64" - container: "gcc:${{ matrix.gcc }}" - - steps: - - uses: actions/checkout@v3 - - - name: Add Python 3 - run: apt-get update; apt-get install -y python3-dev python3-numpy python3-pytest python3-pip libeigen3-dev - - - name: Update pip - run: python3 -m pip install --upgrade pip - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v1.13 - - - name: Configure - shell: bash - run: > - cmake -S . -B build - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DCMAKE_CXX_STANDARD=${{ matrix.std }} - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Build - run: cmake --build build -j 2 - - - name: Python tests - run: cmake --build build --target pytest - - - name: C++ tests - run: cmake --build build --target cpptest - - - name: Interface test - run: cmake --build build --target test_cmake_build - - - # Testing on ICC using the oneAPI apt repo - icc: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - - name: "🐍 3 • ICC latest • x64" - - steps: - - uses: actions/checkout@v3 - - - name: Add apt repo - run: | - sudo apt-get update - sudo apt-get install -y wget build-essential pkg-config cmake ca-certificates gnupg - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - - - name: Add ICC & Python 3 - run: sudo apt-get update; sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic cmake python3-dev python3-numpy python3-pytest python3-pip - - - name: Update pip - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - python3 -m pip install --upgrade pip - - - name: Install dependencies - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - python3 -m pip install -r tests/requirements.txt - - - name: Configure C++11 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake -S . -B build-11 \ - -DPYBIND11_WERROR=ON \ - -DDOWNLOAD_CATCH=ON \ - -DDOWNLOAD_EIGEN=OFF \ - -DCMAKE_CXX_STANDARD=11 \ - -DCMAKE_CXX_COMPILER=$(which icpc) \ - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Build C++11 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake --build build-11 -j 2 -v - - - name: Python tests C++11 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - sudo service apport stop - cmake --build build-11 --target check - - - name: C++ tests C++11 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake --build build-11 --target cpptest - - - name: Interface test C++11 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake --build build-11 --target test_cmake_build - - - name: Configure C++17 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake -S . -B build-17 \ - -DPYBIND11_WERROR=ON \ - -DDOWNLOAD_CATCH=ON \ - -DDOWNLOAD_EIGEN=OFF \ - -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_CXX_COMPILER=$(which icpc) \ - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Build C++17 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake --build build-17 -j 2 -v - - - name: Python tests C++17 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - sudo service apport stop - cmake --build build-17 --target check - - - name: C++ tests C++17 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake --build build-17 --target cpptest - - - name: Interface test C++17 - run: | - set +e; source /opt/intel/oneapi/setvars.sh; set -e - cmake --build build-17 --target test_cmake_build - - - # Testing on CentOS (manylinux uses a centos base, and this is an easy way - # to get GCC 4.8, which is the manylinux1 compiler). - centos: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - container: - - "centos:7" # GCC 4.8 - - "almalinux:8" - - "almalinux:9" - - name: "🐍 3 • ${{ matrix.container }} • x64" - container: "${{ matrix.container }}" - - steps: - - uses: actions/checkout@v3 - - - name: Add Python 3 (RHEL 7) - if: matrix.container == 'centos:7' - run: yum update -y && yum install -y python3-devel gcc-c++ make git - - - name: Add Python 3 (RHEL 8+) - if: matrix.container != 'centos:7' - run: dnf update -y && dnf install -y python3-devel gcc-c++ make git - - - name: Update pip - run: python3 -m pip install --upgrade pip - - - name: Install dependencies - run: | - python3 -m pip install cmake -r tests/requirements.txt - - - name: Configure - shell: bash - run: > - cmake -S . -B build - -DCMAKE_BUILD_TYPE=MinSizeRel - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - -DCMAKE_CXX_STANDARD=11 - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Build - run: cmake --build build -j 2 - - - name: Python tests - run: cmake --build build --target pytest - - - name: C++ tests - run: cmake --build build --target cpptest - - - name: Interface test - run: cmake --build build --target test_cmake_build - - - # This tests an "install" with the CMake tools - install-classic: - name: "🐍 3.7 • Debian • x86 • Install" - runs-on: ubuntu-latest - container: i386/debian:buster - - steps: - - uses: actions/checkout@v1 # Required to run inside docker - - - name: Install requirements - run: | - apt-get update - apt-get install -y git make cmake g++ libeigen3-dev python3-dev python3-pip - pip3 install "pytest==6.*" - - - name: Configure for install - run: > - cmake . - -DPYBIND11_INSTALL=1 -DPYBIND11_TEST=0 - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Make and install - run: make install - - - name: Copy tests to new directory - run: cp -a tests /pybind11-tests - - - name: Make a new test directory - run: mkdir /build-tests - - - name: Configure tests - run: > - cmake ../pybind11-tests - -DDOWNLOAD_CATCH=ON - -DPYBIND11_WERROR=ON - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - working-directory: /build-tests - - - name: Python tests - run: make pytest -j 2 - working-directory: /build-tests - - - # This verifies that the documentation is not horribly broken, and does a - # basic validation check on the SDist. - doxygen: - name: "Documentation build test" - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install Doxygen - run: sudo apt-get install -y doxygen librsvg2-bin # Changed to rsvg-convert in 20.04 - - - name: Build docs - run: pipx run nox -s docs - - - name: Make SDist - run: pipx run nox -s build -- --sdist - - - run: git status --ignored - - - name: Check local include dir - run: > - ls pybind11; - python3 -c "import pybind11, pathlib; assert (a := pybind11.get_include()) == (b := str(pathlib.Path('include').resolve())), f'{a} != {b}'" - - - name: Compare Dists (headers only) - working-directory: include - run: | - python3 -m pip install --user -U ../dist/*.tar.gz - installed=$(python3 -c "import pybind11; print(pybind11.get_include() + '/pybind11')") - diff -rq $installed ./pybind11 - - win32: - strategy: - fail-fast: false - matrix: - python: - - 3.6 - - 3.7 - - 3.8 - - 3.9 - - include: - - python: 3.9 - args: -DCMAKE_CXX_STANDARD=20 - - python: 3.8 - args: -DCMAKE_CXX_STANDARD=17 - - python: 3.7 - args: -DCMAKE_CXX_STANDARD=14 - - - name: "🐍 ${{ matrix.python }} • MSVC 2019 • x86 ${{ matrix.args }}" - runs-on: windows-2019 - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - architecture: x86 - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v1.13 - - - name: Prepare MSVC - uses: ilammy/msvc-dev-cmd@v1.12.0 - with: - arch: x86 - - - name: Prepare env - run: | - python -m pip install -r tests/requirements.txt - - # First build - C++11 mode and inplace - - name: Configure ${{ matrix.args }} - run: > - cmake -S . -B build - -G "Visual Studio 16 2019" -A Win32 - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - ${{ matrix.args }} - - name: Build C++11 - run: cmake --build build -j 2 - - - name: Python tests - run: cmake --build build -t pytest - - win32-debug: - strategy: - fail-fast: false - matrix: - python: - - 3.8 - - 3.9 - - include: - - python: 3.9 - args: -DCMAKE_CXX_STANDARD=20 - - python: 3.8 - args: -DCMAKE_CXX_STANDARD=17 - - name: "🐍 ${{ matrix.python }} • MSVC 2019 (Debug) • x86 ${{ matrix.args }}" - runs-on: windows-2019 - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - architecture: x86 - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v1.13 - - - name: Prepare MSVC - uses: ilammy/msvc-dev-cmd@v1.12.0 - with: - arch: x86 - - - name: Prepare env - run: | - python -m pip install -r tests/requirements.txt - - # First build - C++11 mode and inplace - - name: Configure ${{ matrix.args }} - run: > - cmake -S . -B build - -G "Visual Studio 16 2019" -A Win32 - -DCMAKE_BUILD_TYPE=Debug - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - ${{ matrix.args }} - - name: Build C++11 - run: cmake --build build --config Debug -j 2 - - - name: Python tests - run: cmake --build build --config Debug -t pytest - - - windows-2022: - strategy: - fail-fast: false - matrix: - python: - - 3.9 - - name: "🐍 ${{ matrix.python }} • MSVC 2022 C++20 • x64" - runs-on: windows-2022 - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - - name: Prepare env - run: | - python3 -m pip install -r tests/requirements.txt - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v1.13 - - - name: Configure C++20 - run: > - cmake -S . -B build - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - -DCMAKE_CXX_STANDARD=20 - - - name: Build C++20 - run: cmake --build build -j 2 - - - name: Python tests - run: cmake --build build --target pytest - - - name: C++20 tests - run: cmake --build build --target cpptest -j 2 - - - name: Interface test C++20 - run: cmake --build build --target test_cmake_build - - mingw: - name: "🐍 3 • windows-latest • ${{ matrix.sys }}" - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - strategy: - fail-fast: false - matrix: - include: - - { sys: mingw64, env: x86_64 } - - { sys: mingw32, env: i686 } - steps: - - uses: msys2/setup-msys2@v2 - with: - msystem: ${{matrix.sys}} - install: >- - git - mingw-w64-${{matrix.env}}-gcc - mingw-w64-${{matrix.env}}-python-pip - mingw-w64-${{matrix.env}}-python-numpy - mingw-w64-${{matrix.env}}-python-scipy - mingw-w64-${{matrix.env}}-cmake - mingw-w64-${{matrix.env}}-make - mingw-w64-${{matrix.env}}-python-pytest - mingw-w64-${{matrix.env}}-eigen3 - mingw-w64-${{matrix.env}}-boost - mingw-w64-${{matrix.env}}-catch - - - uses: actions/checkout@v3 - - - name: Configure C++11 - # LTO leads to many undefined reference like - # `pybind11::detail::function_call::function_call(pybind11::detail::function_call&&) - run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build - - - name: Build C++11 - run: cmake --build build -j 2 - - - name: Python tests C++11 - run: cmake --build build --target pytest -j 2 - - - name: C++11 tests - run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target cpptest -j 2 - - - name: Interface test C++11 - run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target test_cmake_build - - - name: Clean directory - run: git clean -fdx - - - name: Configure C++14 - run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build2 - - - name: Build C++14 - run: cmake --build build2 -j 2 - - - name: Python tests C++14 - run: cmake --build build2 --target pytest -j 2 - - - name: C++14 tests - run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target cpptest -j 2 - - - name: Interface test C++14 - run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target test_cmake_build - - - name: Clean directory - run: git clean -fdx - - - name: Configure C++17 - run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build3 - - - name: Build C++17 - run: cmake --build build3 -j 2 - - - name: Python tests C++17 - run: cmake --build build3 --target pytest -j 2 - - - name: C++17 tests - run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target cpptest -j 2 - - - name: Interface test C++17 - run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target test_cmake_build diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml deleted file mode 100644 index 5ec0dd462f..0000000000 --- a/.github/workflows/configure.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Config - -on: - workflow_dispatch: - pull_request: - push: - branches: - - master - - stable - - v* - -jobs: - # This tests various versions of CMake in various combinations, to make sure - # the configure step passes. - cmake: - strategy: - fail-fast: false - matrix: - runs-on: [ubuntu-latest, macos-latest, windows-latest] - arch: [x64] - cmake: ["3.23"] - - include: - - runs-on: ubuntu-latest - arch: x64 - cmake: 3.4 - - - runs-on: macos-latest - arch: x64 - cmake: 3.7 - - - runs-on: windows-2019 - arch: x64 # x86 compilers seem to be missing on 2019 image - cmake: 3.18 - - name: 🐍 3.7 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }} - runs-on: ${{ matrix.runs-on }} - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - architecture: ${{ matrix.arch }} - - - name: Prepare env - run: python -m pip install -r tests/requirements.txt - - # An action for adding a specific version of CMake: - # https://github.com/jwlawson/actions-setup-cmake - - name: Setup CMake ${{ matrix.cmake }} - uses: jwlawson/actions-setup-cmake@v1.13 - with: - cmake-version: ${{ matrix.cmake }} - - # These steps use a directory with a space in it intentionally - - name: Make build directories - run: mkdir "build dir" - - - name: Configure - working-directory: build dir - shell: bash - run: > - cmake .. - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)") - - # Only build and test if this was manually triggered in the GitHub UI - - name: Build - working-directory: build dir - if: github.event_name == 'workflow_dispatch' - run: cmake --build . --config Release - - - name: Test - working-directory: build dir - if: github.event_name == 'workflow_dispatch' - run: cmake --build . --config Release --target check diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 31d893c479..0000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,55 +0,0 @@ -# This is a format job. Pre-commit has a first-party GitHub action, so we use -# that: https://github.com/pre-commit/action - -name: Format - -on: - workflow_dispatch: - pull_request: - push: - branches: - - master - - stable - - "v*" - -env: - FORCE_COLOR: 3 - -jobs: - pre-commit: - name: Format - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - name: Add matchers - run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" - - uses: pre-commit/action@v3.0.0 - with: - # Slow hooks are marked with manual - slow is okay here, run them too - extra_args: --hook-stage manual --all-files - - clang-tidy: - # When making changes here, please also review the "Clang-Tidy" section - # in .github/CONTRIBUTING.md and update as needed. - name: Clang-Tidy - runs-on: ubuntu-latest - container: silkeh/clang:13 - steps: - - uses: actions/checkout@v3 - - - name: Install requirements - run: apt-get update && apt-get install -y python3-dev python3-pytest - - - name: Configure - run: > - cmake -S . -B build - -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--use-color;--warnings-as-errors=*" - -DDOWNLOAD_EIGEN=ON - -DDOWNLOAD_CATCH=ON - -DCMAKE_CXX_STANDARD=17 - - - name: Build - run: cmake --build build -j 2 -- --keep-going diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 165a2fd87b..0000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Labeler -on: - pull_request_target: - types: [closed] - -jobs: - label: - name: Labeler - runs-on: ubuntu-latest - steps: - - - uses: actions/labeler@main - if: > - github.event.pull_request.merged == true && - !startsWith(github.event.pull_request.title, 'chore(deps):') && - !startsWith(github.event.pull_request.title, 'ci(fix):') && - !startsWith(github.event.pull_request.title, 'docs(changelog):') - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/labeler_merged.yml diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml deleted file mode 100644 index f03a397019..0000000000 --- a/.github/workflows/pip.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Pip - -on: - workflow_dispatch: - pull_request: - push: - branches: - - master - - stable - - v* - release: - types: - - published - -env: - PIP_ONLY_BINARY: numpy - -jobs: - # This builds the sdists and wheels and makes sure the files are exactly as - # expected. Using Windows and Python 3.6, since that is often the most - # challenging matrix element. - test-packaging: - name: 🐍 3.6 • 📦 tests • windows-latest - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - - name: Setup 🐍 3.6 - uses: actions/setup-python@v4 - with: - python-version: 3.6 - - - name: Prepare env - run: | - python -m pip install -r tests/requirements.txt - - - name: Python Packaging tests - run: pytest tests/extra_python_package/ - - - # This runs the packaging tests and also builds and saves the packages as - # artifacts. - packaging: - name: 🐍 3.8 • 📦 & 📦 tests • ubuntu-latest - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Setup 🐍 3.8 - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - - name: Prepare env - run: | - python -m pip install -r tests/requirements.txt build twine - - - name: Python Packaging tests - run: pytest tests/extra_python_package/ - - - name: Build SDist and wheels - run: | - python -m build - PYBIND11_GLOBAL_SDIST=1 python -m build - - - name: Check metadata - run: twine check dist/* - - - name: Save standard package - uses: actions/upload-artifact@v3 - with: - name: standard - path: dist/pybind11-* - - - name: Save global package - uses: actions/upload-artifact@v3 - with: - name: global - path: dist/pybind11_global-* - - - - # When a GitHub release is made, upload the artifacts to PyPI - upload: - name: Upload to PyPI - runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' - needs: [packaging] - - steps: - - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - # Downloads all to directories matching the artifact names - - uses: actions/download-artifact@v3 - - - name: Publish standard package - uses: pypa/gh-action-pypi-publish@v1.5.1 - with: - password: ${{ secrets.pypi_password }} - packages_dir: standard/ - - - name: Publish global package - uses: pypa/gh-action-pypi-publish@v1.5.1 - with: - password: ${{ secrets.pypi_password_global }} - packages_dir: global/ diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml deleted file mode 100644 index 366284acf4..0000000000 --- a/.github/workflows/upstream.yml +++ /dev/null @@ -1,112 +0,0 @@ - -name: Upstream - -on: - workflow_dispatch: - pull_request: - -concurrency: - group: upstream-${{ github.ref }} - cancel-in-progress: true - -env: - PIP_ONLY_BINARY: numpy - -jobs: - standard: - name: "🐍 3.11 latest internals • ubuntu-latest • x64" - runs-on: ubuntu-latest - if: "contains(github.event.pull_request.labels.*.name, 'python dev')" - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: "3.11-dev" - - - name: Setup Boost (Linux) - if: runner.os == 'Linux' - run: sudo apt-get install libboost-dev - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v1.13 - - - 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 - run: > - cmake -S . -B . - -DPYBIND11_WERROR=ON - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - -DCMAKE_CXX_STANDARD=11 - - - 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 - 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 }} - ${{ matrix.args2 }} - - - name: Build - run: cmake --build build2 -j 2 - - - name: Python tests - run: cmake --build build2 --target pytest - - - name: C++ tests - 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 build3 --target test_cmake_build - - # This makes sure the setup_helpers module can build packages using - # setuptools - - name: Setuptools helpers test - run: pytest tests/extra_setuptools From d04a1976c773aa4d857ea63a13af3169a8ebebe7 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 8 Nov 2022 11:55:53 -0800 Subject: [PATCH 02/26] Try .appveyor.yml skip_commits ALL --- .appveyor.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000000..934edfbd0b --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,37 @@ +version: 1.0.{build} +image: +- Visual Studio 2017 +test: off +skip_commits: + message: /.*/ # Skip ALL commits. +skip_branch_with_pr: true +build: + parallel: true +platform: +- x86 +environment: + matrix: + - PYTHON: 36 + CONFIG: Debug +install: +- ps: | + $env:CMAKE_GENERATOR = "Visual Studio 15 2017" + if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" } + $env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH" + python -W ignore -m pip install --upgrade pip wheel + python -W ignore -m pip install pytest numpy --no-warn-script-location pytest-timeout +- ps: | + Start-FileDownload 'https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip' + 7z x eigen-3.3.7.zip -y > $null + $env:CMAKE_INCLUDE_PATH = "eigen-3.3.7;$env:CMAKE_INCLUDE_PATH" +build_script: +- cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_ARCH%" + -DCMAKE_CXX_STANDARD=14 + -DPYBIND11_WERROR=ON + -DDOWNLOAD_CATCH=ON + -DCMAKE_SUPPRESS_REGENERATION=1 + . +- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +- cmake --build . --config %CONFIG% --target pytest -- /m /v:m /logger:%MSBuildLogger% +- cmake --build . --config %CONFIG% --target cpptest -- /m /v:m /logger:%MSBuildLogger% +on_failure: if exist "tests\test_cmake_build" type tests\test_cmake_build\*.log* From 58d8c8b53cacce5ad121b56c5b2380afe6515e64 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 8 Nov 2022 11:56:14 -0800 Subject: [PATCH 03/26] Remove ci from .pre-commit-config.yaml --- .pre-commit-config.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fd079dd037..76aeeee47a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,11 +13,6 @@ # See https://github.com/pre-commit/pre-commit -ci: - autoupdate_commit_msg: "chore(deps): update pre-commit hooks" - autofix_commit_msg: "style: pre-commit fixes" - autoupdate_schedule: monthly - # third-party content exclude: ^tools/JoinPaths.cmake$ From cf34cd816fabe43fa143cca17837dd7cfbcc302d Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 8 Nov 2022 12:05:20 -0800 Subject: [PATCH 04/26] Revert "Remove ci from .pre-commit-config.yaml" This reverts commit 58d8c8b53cacce5ad121b56c5b2380afe6515e64. --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76aeeee47a..fd079dd037 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,6 +13,11 @@ # See https://github.com/pre-commit/pre-commit +ci: + autoupdate_commit_msg: "chore(deps): update pre-commit hooks" + autofix_commit_msg: "style: pre-commit fixes" + autoupdate_schedule: monthly + # third-party content exclude: ^tools/JoinPaths.cmake$ From 70540821780c04956c3cbef49fc38c53cea7964f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 10:37:30 -0800 Subject: [PATCH 05/26] windows_clang.yml just showing clang, clang++ versions --- .github/workflows/windows_clang.yml | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/windows_clang.yml diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml new file mode 100644 index 0000000000..ce503c6765 --- /dev/null +++ b/.github/workflows/windows_clang.yml @@ -0,0 +1,37 @@ +name: WindowsClang + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + build_and_test: + strategy: + matrix: + os: windows-latest + + runs-on: '${{ matrix.os }}' + + name: 'build_and_test ${{ matrix.os }}' + + defaults: + run: + shell: pwsh + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Clean up PATH + uses: egor-tensin/cleanup-path@v2 + if: runner.os == 'Windows' + + - name: Set up Clang + uses: egor-tensin/setup-clang@v1 + if: matrix.toolset == 'clang' + + - name: Show Clang version + run: | + clang --version + clang++ --version From ce7eddf27115023b4f947b1246a4a2d2b5546e1d Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 10:41:59 -0800 Subject: [PATCH 06/26] fix: matrix os must be a list --- .github/workflows/windows_clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index ce503c6765..8f9116e7f6 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -9,7 +9,7 @@ jobs: build_and_test: strategy: matrix: - os: windows-latest + os: [windows-latest] runs-on: '${{ matrix.os }}' From 2f036294eae1f67aa8e0fe7a97beb13a7e5b16a9 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 10:44:47 -0800 Subject: [PATCH 07/26] Fix silly oversight --- .github/workflows/windows_clang.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 8f9116e7f6..be16faa38a 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -29,7 +29,6 @@ jobs: - name: Set up Clang uses: egor-tensin/setup-clang@v1 - if: matrix.toolset == 'clang' - name: Show Clang version run: | From dcbd4059b27f00ebf7a6f263c866ff2f92d921f0 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 11:04:32 -0800 Subject: [PATCH 08/26] Add Python & cmake setup, pybind11 build & test --- .github/workflows/windows_clang.yml | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index be16faa38a..2bc922c461 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -10,6 +10,7 @@ jobs: strategy: matrix: os: [windows-latest] + python: [3.10] runs-on: '${{ matrix.os }}' @@ -21,7 +22,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clean up PATH uses: egor-tensin/cleanup-path@v2 @@ -34,3 +35,35 @@ jobs: run: | clang --version clang++ --version + + - name: Setup Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Update CMake + uses: jwlawson/actions-setup-cmake@v1.13 + + - name: Prepare env + run: | + python -m pip install -r tests/requirements.txt + + - name: Configure Clang C++17 + run: > + cmake -S . -B . + -DPYBIND11_WERROR=OFF + -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF + -DDOWNLOAD_CATCH=OFF + -DDOWNLOAD_EIGEN=OFF + -DCMAKE_C_COMPILER=clang + -DCMAKE_CXX_COMPILER=clang++ + -DCMAKE_CXX_STANDARD=17 + + - name: Build Clang C++17 + run: cmake --build . -j 2 + + - name: Python tests Clang C++17 + run: cmake --build . --target pytest -j 2 + + - name: Clean directory + run: git clean -fdx From 313839217e0dff68125efc420d5605fa140fc8e8 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 11:10:25 -0800 Subject: [PATCH 09/26] Python version must be in quotes. --- .github/workflows/windows_clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 2bc922c461..2b0892467e 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [windows-latest] - python: [3.10] + python: ['3.10'] runs-on: '${{ matrix.os }}' From 58ba016f47aa0d4033547feae9bd684cf9d99efa Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 11:21:30 -0800 Subject: [PATCH 10/26] Remove pwsh default (in hopes of fixing Update Cmake step) --- .github/workflows/windows_clang.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 2b0892467e..6c43156834 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -16,10 +16,6 @@ jobs: name: 'build_and_test ${{ matrix.os }}' - defaults: - run: - shell: pwsh - steps: - name: Checkout uses: actions/checkout@v3 From 44cb5111b5fea29642dbfe4cdf3e57d6b704bb03 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 11:32:24 -0800 Subject: [PATCH 11/26] Remove egor-tensin/cleanup-path@v2 --- .github/workflows/windows_clang.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 6c43156834..8396282f18 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -20,10 +20,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Clean up PATH - uses: egor-tensin/cleanup-path@v2 - if: runner.os == 'Windows' - - name: Set up Clang uses: egor-tensin/setup-clang@v1 From 27de4397c3cb438bcc0a3e0393638e24eab8e65c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 11:51:40 -0800 Subject: [PATCH 12/26] Remove -DCMAKE_C_COMPILER=clang CMake Warning: Manually-specified variables were not used by the project: CMAKE_C_COMPILER --- .github/workflows/windows_clang.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 8396282f18..e8584a13f0 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -47,7 +47,6 @@ jobs: -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF - -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 From 4bcc2c0d68e5e7cc59a70c948b4f6ac750f14df6 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 12:08:52 -0800 Subject: [PATCH 13/26] Show CMake version --- .github/workflows/windows_clang.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index e8584a13f0..6b4cfc3cc0 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -23,11 +23,6 @@ jobs: - name: Set up Clang uses: egor-tensin/setup-clang@v1 - - name: Show Clang version - run: | - clang --version - clang++ --version - - name: Setup Python ${{ matrix.python }} uses: actions/setup-python@v4 with: @@ -40,6 +35,15 @@ jobs: run: | python -m pip install -r tests/requirements.txt + - name: Show Clang version + run: clang --version + + - name: Show Clang++ version + run: clang++ --version + + - name: Show CMake version + run: cmake --version + - name: Configure Clang C++17 run: > cmake -S . -B . From f00b912d9fd7969b336ce62782c9a4bd433352f5 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 14:32:23 -0800 Subject: [PATCH 14/26] cmake -G Ninja --- .github/workflows/windows_clang.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 6b4cfc3cc0..bb3308e1bb 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -31,6 +31,9 @@ jobs: - name: Update CMake uses: jwlawson/actions-setup-cmake@v1.13 + - name: Install ninja-build tool + uses: seanmiddleditch/gha-setup-ninja@v3 + - name: Prepare env run: | python -m pip install -r tests/requirements.txt @@ -46,11 +49,12 @@ jobs: - name: Configure Clang C++17 run: > - cmake -S . -B . + cmake -G Ninja -S . -B . -DPYBIND11_WERROR=OFF -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF + -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 From 173516da403c962b95251dd639887f2689009881 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 14:49:15 -0800 Subject: [PATCH 15/26] `-DCMAKE_VERBOSE_MAKEFILE=ON` (and remove `-DCMAKE_C_COMPILER` again). --- .github/workflows/windows_clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index bb3308e1bb..ab061614df 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -50,11 +50,11 @@ jobs: - name: Configure Clang C++17 run: > cmake -G Ninja -S . -B . + -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=OFF -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF -DDOWNLOAD_CATCH=OFF -DDOWNLOAD_EIGEN=OFF - -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 From 85fb1f87ba2d5290d295b94c7f794ebbcc893e78 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 15:06:59 -0800 Subject: [PATCH 16/26] Cosmetic changes --- .github/workflows/windows_clang.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index ab061614df..5e27efe3b5 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -35,11 +35,7 @@ jobs: uses: seanmiddleditch/gha-setup-ninja@v3 - name: Prepare env - run: | - python -m pip install -r tests/requirements.txt - - - name: Show Clang version - run: clang --version + run: python -m pip install -r tests/requirements.txt - name: Show Clang++ version run: clang++ --version @@ -47,7 +43,7 @@ jobs: - name: Show CMake version run: cmake --version - - name: Configure Clang C++17 + - name: Configure Clang run: > cmake -G Ninja -S . -B . -DCMAKE_VERBOSE_MAKEFILE=ON @@ -58,10 +54,10 @@ jobs: -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 - - name: Build Clang C++17 + - name: Build Clang run: cmake --build . -j 2 - - name: Python tests Clang C++17 + - name: Python tests Clang run: cmake --build . --target pytest -j 2 - name: Clean directory From 03d6e1ecfe65cf60624226233613b0bc4bf1a1d7 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 15:09:46 -0800 Subject: [PATCH 17/26] Patching in snapshot of (already closed) PR #4316 --- include/pybind11/detail/internals.h | 5 +++++ tests/CMakeLists.txt | 6 ++++++ tests/named_namespace_a.cpp | 25 +++++++++++++++++++++++++ tests/named_namespace_b.cpp | 14 ++++++++++++++ tests/test_exc_named_namespace_a.py | 15 +++++++++++++++ tests/test_exc_named_namespace_b.py | 5 +++++ tests/test_unnamed_namespace_a.cpp | 24 ++++++++++++++++++++++++ tests/test_unnamed_namespace_a.py | 15 +++++++++++++++ tests/test_unnamed_namespace_b.cpp | 13 +++++++++++++ tests/test_unnamed_namespace_b.py | 5 +++++ 10 files changed, 127 insertions(+) create mode 100644 tests/named_namespace_a.cpp create mode 100644 tests/named_namespace_b.cpp create mode 100644 tests/test_exc_named_namespace_a.py create mode 100644 tests/test_exc_named_namespace_b.py create mode 100644 tests/test_unnamed_namespace_a.cpp create mode 100644 tests/test_unnamed_namespace_a.py create mode 100644 tests/test_unnamed_namespace_b.cpp create mode 100644 tests/test_unnamed_namespace_b.py diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 6fd61098c4..8183ce8a58 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -209,6 +209,11 @@ struct internals { PYBIND11_TLS_FREE(tstate); } #endif + + std::unordered_map> + std_type_index_registry_unnamed_namespace; + std::unordered_map> + std_type_index_registry_named_namespace; }; /// Additional type information which does not fit into the PyTypeObject. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 491f215cef..20bc6de2a4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -133,6 +133,8 @@ set(PYBIND11_TEST_FILES test_eigen_tensor_avoid_stl_array.cpp test_enum test_eval + test_exc_named_namespace_a.py + test_exc_named_namespace_b.py test_exceptions test_factory_constructors test_gil_scoped @@ -156,6 +158,8 @@ set(PYBIND11_TEST_FILES test_tagbased_polymorphic test_thread test_union + test_unnamed_namespace_a + test_unnamed_namespace_b test_virtual_functions) # Invoking cmake with something like: @@ -219,6 +223,8 @@ tests_extra_targets("test_exceptions.py;test_local_bindings.py;test_stl.py;test_ # And add additional targets for other tests. tests_extra_targets("test_exceptions.py" "cross_module_interleaved_error_already_set") tests_extra_targets("test_gil_scoped.py" "cross_module_gil_utils") +tests_extra_targets("test_exc_named_namespace_a.py" "named_namespace_a") +tests_extra_targets("test_exc_named_namespace_b.py" "named_namespace_b") set(PYBIND11_EIGEN_REPO "https://gitlab.com/libeigen/eigen.git" diff --git a/tests/named_namespace_a.cpp b/tests/named_namespace_a.cpp new file mode 100644 index 0000000000..f997119d30 --- /dev/null +++ b/tests/named_namespace_a.cpp @@ -0,0 +1,25 @@ +#include + +#include "pybind11_tests.h" + +namespace test_named_namespace { +struct any_struct {}; +} // namespace test_named_namespace + +PYBIND11_MODULE(named_namespace_a, m) { + m.attr("name") = "NA"; + + py::detail::get_internals() + .std_type_index_registry_named_namespace[std::type_index( + typeid(test_named_namespace::any_struct))] + .push_back("NA"); + + m.def("std_type_index_registry_dump", []() { + py::list items; + for (const auto &it : + py::detail::get_internals().std_type_index_registry_named_namespace) { + items.append(py::make_tuple(it.first.name(), it.second)); + } + return items; + }); +} diff --git a/tests/named_namespace_b.cpp b/tests/named_namespace_b.cpp new file mode 100644 index 0000000000..ca38e17800 --- /dev/null +++ b/tests/named_namespace_b.cpp @@ -0,0 +1,14 @@ +#include "pybind11_tests.h" + +namespace test_named_namespace { +struct any_struct {}; +} // namespace test_named_namespace + +PYBIND11_MODULE(named_namespace_b, m) { + m.attr("name") = "NB"; + + py::detail::get_internals() + .std_type_index_registry_named_namespace[std::type_index( + typeid(test_named_namespace::any_struct))] + .push_back("NB"); +} diff --git a/tests/test_exc_named_namespace_a.py b/tests/test_exc_named_namespace_a.py new file mode 100644 index 0000000000..e19f31f169 --- /dev/null +++ b/tests/test_exc_named_namespace_a.py @@ -0,0 +1,15 @@ +import named_namespace_a as m +import pytest + + +def test_inspect(): + assert m.name == "NA" + reg = m.std_type_index_registry_dump() + if len(reg) == 1: + assert tuple(sorted(reg[0][1])) == ("NA", "NB") + pytest.skip("std::type_index-EQ-GOOD") + if len(reg) == 2: + assert reg[0][0] == reg[1][0] + assert tuple(sorted(reg[0][1] + reg[1][1])) == ("NA", "NB") + pytest.skip("std::type_index-NE-BAD") + assert reg is None # Sure to fail. diff --git a/tests/test_exc_named_namespace_b.py b/tests/test_exc_named_namespace_b.py new file mode 100644 index 0000000000..f00fd97af2 --- /dev/null +++ b/tests/test_exc_named_namespace_b.py @@ -0,0 +1,5 @@ +import named_namespace_b as m + + +def test_inspect(): + assert m.name == "NB" diff --git a/tests/test_unnamed_namespace_a.cpp b/tests/test_unnamed_namespace_a.cpp new file mode 100644 index 0000000000..00d55d5da0 --- /dev/null +++ b/tests/test_unnamed_namespace_a.cpp @@ -0,0 +1,24 @@ +#include + +#include "pybind11_tests.h" + +namespace { +struct any_struct {}; +} // namespace + +TEST_SUBMODULE(unnamed_namespace_a, m) { + m.attr("name") = "UA"; + + py::detail::get_internals() + .std_type_index_registry_unnamed_namespace[std::type_index(typeid(any_struct))] + .push_back("UA"); + + m.def("std_type_index_registry_dump", []() { + py::list items; + for (const auto &it : + py::detail::get_internals().std_type_index_registry_unnamed_namespace) { + items.append(py::make_tuple(it.first.name(), it.second)); + } + return items; + }); +} diff --git a/tests/test_unnamed_namespace_a.py b/tests/test_unnamed_namespace_a.py new file mode 100644 index 0000000000..ea882cc8d8 --- /dev/null +++ b/tests/test_unnamed_namespace_a.py @@ -0,0 +1,15 @@ +import pytest + +from pybind11_tests import unnamed_namespace_a as m + + +def test_inspect(): + assert m.name == "UA" + reg = m.std_type_index_registry_dump() + if len(reg) == 1: + assert tuple(sorted(reg[0][1])) == ("UA", "UB") + pytest.skip("std::type_index-EQ-BAD") + if len(reg) == 2: + assert tuple(sorted([reg[0][1][0], reg[1][1][0]])) == ("UA", "UB") + pytest.skip("std::type_index-NE-GOOD") + assert reg is None # Sure to fail. diff --git a/tests/test_unnamed_namespace_b.cpp b/tests/test_unnamed_namespace_b.cpp new file mode 100644 index 0000000000..c38691af2f --- /dev/null +++ b/tests/test_unnamed_namespace_b.cpp @@ -0,0 +1,13 @@ +#include "pybind11_tests.h" + +namespace { +struct any_struct {}; +} // namespace + +TEST_SUBMODULE(unnamed_namespace_b, m) { + m.attr("name") = "UB"; + + py::detail::get_internals() + .std_type_index_registry_unnamed_namespace[std::type_index(typeid(any_struct))] + .push_back("UB"); +} diff --git a/tests/test_unnamed_namespace_b.py b/tests/test_unnamed_namespace_b.py new file mode 100644 index 0000000000..4c033597bd --- /dev/null +++ b/tests/test_unnamed_namespace_b.py @@ -0,0 +1,5 @@ +from pybind11_tests import unnamed_namespace_b as m + + +def test_inspect(): + assert m.name == "UB" From 3163ae29b76275329584f51166e1748f41a827f6 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 15:23:55 -0800 Subject: [PATCH 18/26] Revert "Patching in snapshot of (already closed) PR #4316" This reverts commit 03d6e1ecfe65cf60624226233613b0bc4bf1a1d7. --- include/pybind11/detail/internals.h | 5 ----- tests/CMakeLists.txt | 6 ------ tests/named_namespace_a.cpp | 25 ------------------------- tests/named_namespace_b.cpp | 14 -------------- tests/test_exc_named_namespace_a.py | 15 --------------- tests/test_exc_named_namespace_b.py | 5 ----- tests/test_unnamed_namespace_a.cpp | 24 ------------------------ tests/test_unnamed_namespace_a.py | 15 --------------- tests/test_unnamed_namespace_b.cpp | 13 ------------- tests/test_unnamed_namespace_b.py | 5 ----- 10 files changed, 127 deletions(-) delete mode 100644 tests/named_namespace_a.cpp delete mode 100644 tests/named_namespace_b.cpp delete mode 100644 tests/test_exc_named_namespace_a.py delete mode 100644 tests/test_exc_named_namespace_b.py delete mode 100644 tests/test_unnamed_namespace_a.cpp delete mode 100644 tests/test_unnamed_namespace_a.py delete mode 100644 tests/test_unnamed_namespace_b.cpp delete mode 100644 tests/test_unnamed_namespace_b.py diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 8183ce8a58..6fd61098c4 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -209,11 +209,6 @@ struct internals { PYBIND11_TLS_FREE(tstate); } #endif - - std::unordered_map> - std_type_index_registry_unnamed_namespace; - std::unordered_map> - std_type_index_registry_named_namespace; }; /// Additional type information which does not fit into the PyTypeObject. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 20bc6de2a4..491f215cef 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -133,8 +133,6 @@ set(PYBIND11_TEST_FILES test_eigen_tensor_avoid_stl_array.cpp test_enum test_eval - test_exc_named_namespace_a.py - test_exc_named_namespace_b.py test_exceptions test_factory_constructors test_gil_scoped @@ -158,8 +156,6 @@ set(PYBIND11_TEST_FILES test_tagbased_polymorphic test_thread test_union - test_unnamed_namespace_a - test_unnamed_namespace_b test_virtual_functions) # Invoking cmake with something like: @@ -223,8 +219,6 @@ tests_extra_targets("test_exceptions.py;test_local_bindings.py;test_stl.py;test_ # And add additional targets for other tests. tests_extra_targets("test_exceptions.py" "cross_module_interleaved_error_already_set") tests_extra_targets("test_gil_scoped.py" "cross_module_gil_utils") -tests_extra_targets("test_exc_named_namespace_a.py" "named_namespace_a") -tests_extra_targets("test_exc_named_namespace_b.py" "named_namespace_b") set(PYBIND11_EIGEN_REPO "https://gitlab.com/libeigen/eigen.git" diff --git a/tests/named_namespace_a.cpp b/tests/named_namespace_a.cpp deleted file mode 100644 index f997119d30..0000000000 --- a/tests/named_namespace_a.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#include "pybind11_tests.h" - -namespace test_named_namespace { -struct any_struct {}; -} // namespace test_named_namespace - -PYBIND11_MODULE(named_namespace_a, m) { - m.attr("name") = "NA"; - - py::detail::get_internals() - .std_type_index_registry_named_namespace[std::type_index( - typeid(test_named_namespace::any_struct))] - .push_back("NA"); - - m.def("std_type_index_registry_dump", []() { - py::list items; - for (const auto &it : - py::detail::get_internals().std_type_index_registry_named_namespace) { - items.append(py::make_tuple(it.first.name(), it.second)); - } - return items; - }); -} diff --git a/tests/named_namespace_b.cpp b/tests/named_namespace_b.cpp deleted file mode 100644 index ca38e17800..0000000000 --- a/tests/named_namespace_b.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "pybind11_tests.h" - -namespace test_named_namespace { -struct any_struct {}; -} // namespace test_named_namespace - -PYBIND11_MODULE(named_namespace_b, m) { - m.attr("name") = "NB"; - - py::detail::get_internals() - .std_type_index_registry_named_namespace[std::type_index( - typeid(test_named_namespace::any_struct))] - .push_back("NB"); -} diff --git a/tests/test_exc_named_namespace_a.py b/tests/test_exc_named_namespace_a.py deleted file mode 100644 index e19f31f169..0000000000 --- a/tests/test_exc_named_namespace_a.py +++ /dev/null @@ -1,15 +0,0 @@ -import named_namespace_a as m -import pytest - - -def test_inspect(): - assert m.name == "NA" - reg = m.std_type_index_registry_dump() - if len(reg) == 1: - assert tuple(sorted(reg[0][1])) == ("NA", "NB") - pytest.skip("std::type_index-EQ-GOOD") - if len(reg) == 2: - assert reg[0][0] == reg[1][0] - assert tuple(sorted(reg[0][1] + reg[1][1])) == ("NA", "NB") - pytest.skip("std::type_index-NE-BAD") - assert reg is None # Sure to fail. diff --git a/tests/test_exc_named_namespace_b.py b/tests/test_exc_named_namespace_b.py deleted file mode 100644 index f00fd97af2..0000000000 --- a/tests/test_exc_named_namespace_b.py +++ /dev/null @@ -1,5 +0,0 @@ -import named_namespace_b as m - - -def test_inspect(): - assert m.name == "NB" diff --git a/tests/test_unnamed_namespace_a.cpp b/tests/test_unnamed_namespace_a.cpp deleted file mode 100644 index 00d55d5da0..0000000000 --- a/tests/test_unnamed_namespace_a.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#include "pybind11_tests.h" - -namespace { -struct any_struct {}; -} // namespace - -TEST_SUBMODULE(unnamed_namespace_a, m) { - m.attr("name") = "UA"; - - py::detail::get_internals() - .std_type_index_registry_unnamed_namespace[std::type_index(typeid(any_struct))] - .push_back("UA"); - - m.def("std_type_index_registry_dump", []() { - py::list items; - for (const auto &it : - py::detail::get_internals().std_type_index_registry_unnamed_namespace) { - items.append(py::make_tuple(it.first.name(), it.second)); - } - return items; - }); -} diff --git a/tests/test_unnamed_namespace_a.py b/tests/test_unnamed_namespace_a.py deleted file mode 100644 index ea882cc8d8..0000000000 --- a/tests/test_unnamed_namespace_a.py +++ /dev/null @@ -1,15 +0,0 @@ -import pytest - -from pybind11_tests import unnamed_namespace_a as m - - -def test_inspect(): - assert m.name == "UA" - reg = m.std_type_index_registry_dump() - if len(reg) == 1: - assert tuple(sorted(reg[0][1])) == ("UA", "UB") - pytest.skip("std::type_index-EQ-BAD") - if len(reg) == 2: - assert tuple(sorted([reg[0][1][0], reg[1][1][0]])) == ("UA", "UB") - pytest.skip("std::type_index-NE-GOOD") - assert reg is None # Sure to fail. diff --git a/tests/test_unnamed_namespace_b.cpp b/tests/test_unnamed_namespace_b.cpp deleted file mode 100644 index c38691af2f..0000000000 --- a/tests/test_unnamed_namespace_b.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "pybind11_tests.h" - -namespace { -struct any_struct {}; -} // namespace - -TEST_SUBMODULE(unnamed_namespace_b, m) { - m.attr("name") = "UB"; - - py::detail::get_internals() - .std_type_index_registry_unnamed_namespace[std::type_index(typeid(any_struct))] - .push_back("UB"); -} diff --git a/tests/test_unnamed_namespace_b.py b/tests/test_unnamed_namespace_b.py deleted file mode 100644 index 4c033597bd..0000000000 --- a/tests/test_unnamed_namespace_b.py +++ /dev/null @@ -1,5 +0,0 @@ -from pybind11_tests import unnamed_namespace_b as m - - -def test_inspect(): - assert m.name == "UB" From 5aa60934fdaff47f2c691ccfa6118538b0f646c9 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 15:24:48 -0800 Subject: [PATCH 19/26] Patching in snapshot of PR #4319 --- docs/classes.rst | 9 ++++++++ include/pybind11/detail/internals.h | 4 ++-- tests/CMakeLists.txt | 2 ++ tests/test_unnamed_namespace_a.cpp | 25 ++++++++++++++++++++++ tests/test_unnamed_namespace_a.py | 32 +++++++++++++++++++++++++++++ tests/test_unnamed_namespace_b.cpp | 25 ++++++++++++++++++++++ tests/test_unnamed_namespace_b.py | 12 +++++++++++ 7 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 tests/test_unnamed_namespace_a.cpp create mode 100644 tests/test_unnamed_namespace_a.py create mode 100644 tests/test_unnamed_namespace_b.cpp create mode 100644 tests/test_unnamed_namespace_b.py diff --git a/docs/classes.rst b/docs/classes.rst index c0c53135b8..5fbe08870e 100644 --- a/docs/classes.rst +++ b/docs/classes.rst @@ -58,6 +58,15 @@ interactive Python session demonstrating this example is shown below: Static member functions can be bound in the same way using :func:`class_::def_static`. +.. note:: + + Binding C++ types in unnamed namespaces (also known as anonymous namespaces) + works reliably only with GCC and MSVC, but not with CLANG, or if libc++ is used. + See `#4319 `_ for background. + If portability is a concern, it is therefore not recommended to bind C++ + types in unnamed namespaces. It will be safest to manually pick unique + namespace names. + Keyword and default arguments ============================= It is possible to specify keyword and default arguments using the syntax diff --git a/include/pybind11/detail/internals.h b/include/pybind11/detail/internals.h index 6fd61098c4..31e9287318 100644 --- a/include/pybind11/detail/internals.h +++ b/include/pybind11/detail/internals.h @@ -34,7 +34,7 @@ /// further ABI-incompatible changes may be made before the ABI is officially /// changed to the new version. #ifndef PYBIND11_INTERNALS_VERSION -# define PYBIND11_INTERNALS_VERSION 4 +# define PYBIND11_INTERNALS_VERSION 5 #endif PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) @@ -114,7 +114,7 @@ inline void tls_replace_value(PYBIND11_TLS_KEY_REF key, void *value) { // libstdc++, this doesn't happen: equality and the type_index hash are based on the type name, // which works. If not under a known-good stl, provide our own name-based hash and equality // functions that use the type name. -#if defined(__GLIBCXX__) +#if !defined(_LIBCPP_VERSION) inline bool same_type(const std::type_info &lhs, const std::type_info &rhs) { return lhs == rhs; } using type_hash = std::hash; using type_equal_to = std::equal_to; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 491f215cef..285f43b5b9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -156,6 +156,8 @@ set(PYBIND11_TEST_FILES test_tagbased_polymorphic test_thread test_union + test_unnamed_namespace_a + test_unnamed_namespace_b test_virtual_functions) # Invoking cmake with something like: diff --git a/tests/test_unnamed_namespace_a.cpp b/tests/test_unnamed_namespace_a.cpp new file mode 100644 index 0000000000..e538484aa4 --- /dev/null +++ b/tests/test_unnamed_namespace_a.cpp @@ -0,0 +1,25 @@ +#include "pybind11_tests.h" + +namespace { +struct any_struct {}; +} // namespace + +TEST_SUBMODULE(unnamed_namespace_a, m) { + if (py::detail::get_type_info(typeid(any_struct)) == nullptr) { + py::class_(m, "unnamed_namespace_a_any_struct"); + } else { + m.attr("unnamed_namespace_a_any_struct") = py::none(); + } + m.attr("defined___clang__") = +#if defined(__clang__) + true; +#else + false; +#endif + m.attr("defined__LIBCPP_VERSION") = +#if defined(_LIBCPP_VERSION) + true; +#else + false; +#endif +} diff --git a/tests/test_unnamed_namespace_a.py b/tests/test_unnamed_namespace_a.py new file mode 100644 index 0000000000..1d3190ddfc --- /dev/null +++ b/tests/test_unnamed_namespace_a.py @@ -0,0 +1,32 @@ +import pytest + +from pybind11_tests import unnamed_namespace_a as m +from pybind11_tests import unnamed_namespace_b as mb + + +@pytest.mark.xfail( + "m.defined___clang__ or m.defined__LIBCPP_VERSION", + reason="Known issues: https://github.com/pybind/pybind11/pull/4319", + strict=False, +) +def test_have_class_any_struct(): + assert m.unnamed_namespace_a_any_struct is not None + + +def test_have_at_least_one_class_any_struct(): + assert ( + m.unnamed_namespace_a_any_struct is not None + or mb.unnamed_namespace_b_any_struct is not None + ) + + +@pytest.mark.xfail( + "m.defined___clang__ or m.defined__LIBCPP_VERSION", + reason="Known issues: https://github.com/pybind/pybind11/pull/4319", + strict=True, +) +def test_have_both_class_any_struct(): + assert ( + m.unnamed_namespace_a_any_struct is not None + and mb.unnamed_namespace_b_any_struct is not None + ) diff --git a/tests/test_unnamed_namespace_b.cpp b/tests/test_unnamed_namespace_b.cpp new file mode 100644 index 0000000000..84e3c29447 --- /dev/null +++ b/tests/test_unnamed_namespace_b.cpp @@ -0,0 +1,25 @@ +#include "pybind11_tests.h" + +namespace { +struct any_struct {}; +} // namespace + +TEST_SUBMODULE(unnamed_namespace_b, m) { + if (py::detail::get_type_info(typeid(any_struct)) == nullptr) { + py::class_(m, "unnamed_namespace_b_any_struct"); + } else { + m.attr("unnamed_namespace_b_any_struct") = py::none(); + } + m.attr("defined___clang__") = +#if defined(__clang__) + true; +#else + false; +#endif + m.attr("defined__LIBCPP_VERSION") = +#if defined(_LIBCPP_VERSION) + true; +#else + false; +#endif +} diff --git a/tests/test_unnamed_namespace_b.py b/tests/test_unnamed_namespace_b.py new file mode 100644 index 0000000000..1e1efac62f --- /dev/null +++ b/tests/test_unnamed_namespace_b.py @@ -0,0 +1,12 @@ +import pytest + +from pybind11_tests import unnamed_namespace_b as m + + +@pytest.mark.xfail( + "m.defined___clang__ or m.defined__LIBCPP_VERSION", + reason="Known issues: https://github.com/pybind/pybind11/pull/4319", + strict=False, +) +def test_have_class_any_struct(): + assert m.unnamed_namespace_b_any_struct is not None From 80a207c206da016db99e85985d218430d2957c2f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 20:50:49 -0800 Subject: [PATCH 20/26] Adjust expectations for Windows Clang (and make code less redundant). --- tests/test_unnamed_namespace_a.cpp | 6 ++++++ tests/test_unnamed_namespace_a.py | 20 +++++++++----------- tests/test_unnamed_namespace_b.cpp | 12 ------------ tests/test_unnamed_namespace_b.py | 11 ++--------- 4 files changed, 17 insertions(+), 32 deletions(-) diff --git a/tests/test_unnamed_namespace_a.cpp b/tests/test_unnamed_namespace_a.cpp index e538484aa4..e8704edca0 100644 --- a/tests/test_unnamed_namespace_a.cpp +++ b/tests/test_unnamed_namespace_a.cpp @@ -10,6 +10,12 @@ TEST_SUBMODULE(unnamed_namespace_a, m) { } else { m.attr("unnamed_namespace_a_any_struct") = py::none(); } + m.attr("defined_WIN32_or__WIN32") = +#if defined(WIN32) || defined(_WIN32) + true; +#else + false; +#endif m.attr("defined___clang__") = #if defined(__clang__) true; diff --git a/tests/test_unnamed_namespace_a.py b/tests/test_unnamed_namespace_a.py index 1d3190ddfc..be4f4bfe9b 100644 --- a/tests/test_unnamed_namespace_a.py +++ b/tests/test_unnamed_namespace_a.py @@ -3,14 +3,16 @@ from pybind11_tests import unnamed_namespace_a as m from pybind11_tests import unnamed_namespace_b as mb +XFAIL_CONDITION = "not m.defined_WIN32_or__WIN32 and (m.defined___clang__ or m.defined__LIBCPP_VERSION)" +XFAIL_REASON = "Known issues: https://github.com/pybind/pybind11/pull/4319" -@pytest.mark.xfail( - "m.defined___clang__ or m.defined__LIBCPP_VERSION", - reason="Known issues: https://github.com/pybind/pybind11/pull/4319", - strict=False, + +@pytest.mark.xfail(XFAIL_CONDITION, reason=XFAIL_REASON, strict=False) +@pytest.mark.parametrize( + "any_struct", (m.unnamed_namespace_a_any_struct, mb.unnamed_namespace_b_any_struct) ) -def test_have_class_any_struct(): - assert m.unnamed_namespace_a_any_struct is not None +def test_have_class_any_struct(any_struct): + assert any_struct is not None def test_have_at_least_one_class_any_struct(): @@ -20,11 +22,7 @@ def test_have_at_least_one_class_any_struct(): ) -@pytest.mark.xfail( - "m.defined___clang__ or m.defined__LIBCPP_VERSION", - reason="Known issues: https://github.com/pybind/pybind11/pull/4319", - strict=True, -) +@pytest.mark.xfail(XFAIL_CONDITION, reason=XFAIL_REASON, strict=True) def test_have_both_class_any_struct(): assert ( m.unnamed_namespace_a_any_struct is not None diff --git a/tests/test_unnamed_namespace_b.cpp b/tests/test_unnamed_namespace_b.cpp index 84e3c29447..f97757a7de 100644 --- a/tests/test_unnamed_namespace_b.cpp +++ b/tests/test_unnamed_namespace_b.cpp @@ -10,16 +10,4 @@ TEST_SUBMODULE(unnamed_namespace_b, m) { } else { m.attr("unnamed_namespace_b_any_struct") = py::none(); } - m.attr("defined___clang__") = -#if defined(__clang__) - true; -#else - false; -#endif - m.attr("defined__LIBCPP_VERSION") = -#if defined(_LIBCPP_VERSION) - true; -#else - false; -#endif } diff --git a/tests/test_unnamed_namespace_b.py b/tests/test_unnamed_namespace_b.py index 1e1efac62f..4bcaa7a6c5 100644 --- a/tests/test_unnamed_namespace_b.py +++ b/tests/test_unnamed_namespace_b.py @@ -1,12 +1,5 @@ -import pytest - from pybind11_tests import unnamed_namespace_b as m -@pytest.mark.xfail( - "m.defined___clang__ or m.defined__LIBCPP_VERSION", - reason="Known issues: https://github.com/pybind/pybind11/pull/4319", - strict=False, -) -def test_have_class_any_struct(): - assert m.unnamed_namespace_b_any_struct is not None +def test_have_attr_any_struct(): + assert hasattr(m, "unnamed_namespace_b_any_struct") From fdab183e63c0c2d2008254d609abb63d9015c279 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 21:18:44 -0800 Subject: [PATCH 21/26] Make names conform more to the ci.yml scheme --- .github/workflows/windows_clang.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 5e27efe3b5..a02e70c535 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -6,15 +6,16 @@ on: workflow_dispatch: jobs: - build_and_test: + WindowsClang: + strategy: matrix: os: [windows-latest] python: ['3.10'] - runs-on: '${{ matrix.os }}' + runs-on: "${{ matrix.os }}" - name: 'build_and_test ${{ matrix.os }}' + name: "🐍 ${{ matrix.python }} • ${{ matrix.os }}" steps: - name: Checkout From 196b3d981b697db714aad0415818e610f2183f03 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 21:29:25 -0800 Subject: [PATCH 22/26] Add cpptest, test_cmake_build --- .github/workflows/windows_clang.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index a02e70c535..c0e6d59105 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -61,5 +61,11 @@ jobs: - name: Python tests Clang run: cmake --build . --target pytest -j 2 + - name: C++ tests Clang + run: cmake --build . --target cpptest -j 2 + + - name: Interface test Clang + run: cmake --build . --target test_cmake_build -j 2 + - name: Clean directory run: git clean -fdx From a5f2eaa91f1d09e510ff7fbb715000361f744f2c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 21:42:46 -0800 Subject: [PATCH 23/26] Mark cpptest as UNAVAILABLE C:\hostedtoolcache\windows\cmake\3.25.0\x64\cmake-3.25.0-rc4-windows-x86_64\bin\cmake.exe -P D:\a\pybind11\pybind11\CMakeFiles\VerifyGlobs.cmake ninja: error: unknown target 'cpptest', did you mean 'pytest'? Error: Process completed with exit code 1. --- .github/workflows/windows_clang.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index c0e6d59105..92ded206d8 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -61,8 +61,7 @@ jobs: - name: Python tests Clang run: cmake --build . --target pytest -j 2 - - name: C++ tests Clang - run: cmake --build . --target cpptest -j 2 + # UNAVAILABLE: cpptest - name: Interface test Clang run: cmake --build . --target test_cmake_build -j 2 From 129556a1f82b02481702f01e06914c23f1b7bebb Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 22:03:37 -0800 Subject: [PATCH 24/26] `-DDOWNLOAD_CATCH=ON` --- .github/workflows/windows_clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index 92ded206d8..b4e4799243 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -50,7 +50,7 @@ jobs: -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=OFF -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF - -DDOWNLOAD_CATCH=OFF + -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=OFF -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 From 623183d86898682143eecbb3c118d4c63f018fc2 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 9 Nov 2022 22:24:59 -0800 Subject: [PATCH 25/26] EIGEN=ON and try again cpptest (after CATCH=ON in previous commit was successful). --- .github/workflows/windows_clang.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index b4e4799243..ce6319ca72 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -51,7 +51,7 @@ jobs: -DPYBIND11_WERROR=OFF -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=OFF + -DDOWNLOAD_EIGEN=ON -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 @@ -61,7 +61,8 @@ jobs: - name: Python tests Clang run: cmake --build . --target pytest -j 2 - # UNAVAILABLE: cpptest + - name: C++ tests + run: cmake --build . --target cpptest -j 2 - name: Interface test Clang run: cmake --build . --target test_cmake_build -j 2 From 897d7014e743ae2b4dbe12851bac414c0d7b0c6e Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 10 Nov 2022 06:01:34 -0800 Subject: [PATCH 26/26] Add `pip install --upgrade pip`, Show env, cosmetic changes --- .github/workflows/windows_clang.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/windows_clang.yml b/.github/workflows/windows_clang.yml index ce6319ca72..703118eca3 100644 --- a/.github/workflows/windows_clang.yml +++ b/.github/workflows/windows_clang.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: jobs: - WindowsClang: + windows_clang: strategy: matrix: @@ -15,9 +15,12 @@ jobs: runs-on: "${{ matrix.os }}" - name: "🐍 ${{ matrix.python }} • ${{ matrix.os }}" + name: "🐍 ${{ matrix.python }} • ${{ matrix.os }} • clang-latest" steps: + - name: Show env + run: env + - name: Checkout uses: actions/checkout@v3 @@ -35,8 +38,10 @@ jobs: - name: Install ninja-build tool uses: seanmiddleditch/gha-setup-ninja@v3 - - name: Prepare env - run: python -m pip install -r tests/requirements.txt + - name: Run pip installs + run: | + python -m pip install --upgrade pip + python -m pip install -r tests/requirements.txt - name: Show Clang++ version run: clang++ --version @@ -44,6 +49,7 @@ jobs: - name: Show CMake version run: cmake --version + # TODO: WERROR=ON - name: Configure Clang run: > cmake -G Ninja -S . -B . @@ -55,16 +61,16 @@ jobs: -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 - - name: Build Clang + - name: Build run: cmake --build . -j 2 - - name: Python tests Clang + - name: Python tests run: cmake --build . --target pytest -j 2 - name: C++ tests run: cmake --build . --target cpptest -j 2 - - name: Interface test Clang + - name: Interface test run: cmake --build . --target test_cmake_build -j 2 - name: Clean directory