ci.yml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  1. name: CI
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. push:
  6. branches:
  7. - master
  8. - stable
  9. - v*
  10. jobs:
  11. # This is the "main" test suite, which tests a large number of different
  12. # versions of default compilers and Python versions in GitHub Actions.
  13. standard:
  14. strategy:
  15. fail-fast: false
  16. matrix:
  17. runs-on: [ubuntu-latest, windows-latest, macos-latest]
  18. python:
  19. - 2.7
  20. - 3.5
  21. - 3.6
  22. - 3.9
  23. - 3.10-dev
  24. - pypy2
  25. - pypy3
  26. # Items in here will either be added to the build matrix (if not
  27. # present), or add new keys to an existing matrix element if all the
  28. # existing keys match.
  29. #
  30. # We support three optional keys: args (both build), args1 (first
  31. # build), and args2 (second build).
  32. include:
  33. # Just add a key
  34. - runs-on: ubuntu-latest
  35. python: 3.6
  36. args: >
  37. -DPYBIND11_FINDPYTHON=ON
  38. - runs-on: windows-latest
  39. python: 3.6
  40. args: >
  41. -DPYBIND11_FINDPYTHON=ON
  42. # These items will be removed from the build matrix, keys must match.
  43. exclude:
  44. # Currently 32bit only, and we build 64bit
  45. - runs-on: windows-latest
  46. python: pypy2
  47. - runs-on: windows-latest
  48. python: pypy3
  49. # TODO: PyPy2 7.3.3 segfaults, while 7.3.2 was fine.
  50. - runs-on: ubuntu-latest
  51. python: pypy2
  52. name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
  53. runs-on: ${{ matrix.runs-on }}
  54. steps:
  55. - uses: actions/checkout@v2
  56. - name: Setup Python ${{ matrix.python }}
  57. uses: actions/setup-python@v2
  58. with:
  59. python-version: ${{ matrix.python }}
  60. - name: Setup Boost (Windows / Linux latest)
  61. shell: bash
  62. run: echo "BOOST_ROOT=$BOOST_ROOT_1_72_0" >> $GITHUB_ENV
  63. - name: Update CMake
  64. uses: jwlawson/actions-setup-cmake@v1.8
  65. - name: Cache wheels
  66. if: runner.os == 'macOS'
  67. uses: actions/cache@v2
  68. with:
  69. # This path is specific to macOS - we really only need it for PyPy NumPy wheels
  70. # See https://github.com/actions/cache/blob/master/examples.md#python---pip
  71. # for ways to do this more generally
  72. path: ~/Library/Caches/pip
  73. # Look to see if there is a cache hit for the corresponding requirements file
  74. key: ${{ runner.os }}-pip-${{ matrix.python }}-x64-${{ hashFiles('tests/requirements.txt') }}
  75. - name: Prepare env
  76. run: python -m pip install -r tests/requirements.txt --prefer-binary
  77. - name: Setup annotations on Linux
  78. if: runner.os == 'Linux'
  79. run: python -m pip install pytest-github-actions-annotate-failures
  80. # First build - C++11 mode and inplace
  81. - name: Configure C++11 ${{ matrix.args }}
  82. run: >
  83. cmake -S . -B .
  84. -DPYBIND11_WERROR=ON
  85. -DDOWNLOAD_CATCH=ON
  86. -DDOWNLOAD_EIGEN=ON
  87. -DCMAKE_CXX_STANDARD=11
  88. ${{ matrix.args }}
  89. - name: Build C++11
  90. run: cmake --build . -j 2
  91. - name: Python tests C++11
  92. run: cmake --build . --target pytest -j 2
  93. - name: C++11 tests
  94. # TODO: Figure out how to load the DLL on Python 3.8+
  95. if: "!(runner.os == 'Windows' && (matrix.python == 3.8 || matrix.python == 3.9 || matrix.python == '3.10-dev'))"
  96. run: cmake --build . --target cpptest -j 2
  97. - name: Interface test C++11
  98. run: cmake --build . --target test_cmake_build
  99. - name: Clean directory
  100. run: git clean -fdx
  101. # Second build - C++17 mode and in a build directory
  102. - name: Configure ${{ matrix.args2 }}
  103. run: >
  104. cmake -S . -B build2
  105. -DPYBIND11_WERROR=ON
  106. -DDOWNLOAD_CATCH=ON
  107. -DDOWNLOAD_EIGEN=ON
  108. -DCMAKE_CXX_STANDARD=17
  109. ${{ matrix.args }}
  110. ${{ matrix.args2 }}
  111. - name: Build
  112. run: cmake --build build2 -j 2
  113. - name: Python tests
  114. run: cmake --build build2 --target pytest
  115. - name: C++ tests
  116. # TODO: Figure out how to load the DLL on Python 3.8+
  117. if: "!(runner.os == 'Windows' && (matrix.python == 3.8 || matrix.python == 3.9 || matrix.python == '3.10-dev'))"
  118. run: cmake --build build2 --target cpptest
  119. - name: Interface test
  120. run: cmake --build build2 --target test_cmake_build
  121. # Eventually Microsoft might have an action for setting up
  122. # MSVC, but for now, this action works:
  123. - name: Prepare compiler environment for Windows 🐍 2.7
  124. if: matrix.python == 2.7 && runner.os == 'Windows'
  125. uses: ilammy/msvc-dev-cmd@v1
  126. with:
  127. arch: x64
  128. # This makes two environment variables available in the following step(s)
  129. - name: Set Windows 🐍 2.7 environment variables
  130. if: matrix.python == 2.7 && runner.os == 'Windows'
  131. shell: bash
  132. run: |
  133. echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
  134. echo "MSSdk=1" >> $GITHUB_ENV
  135. # This makes sure the setup_helpers module can build packages using
  136. # setuptools
  137. - name: Setuptools helpers test
  138. run: pytest tests/extra_setuptools
  139. deadsnakes:
  140. strategy:
  141. fail-fast: false
  142. matrix:
  143. include:
  144. - python-version: 3.9
  145. python-debug: true
  146. valgrind: true
  147. - python-version: 3.10-dev
  148. python-debug: false
  149. name: "🐍 ${{ matrix.python-version }}${{ matrix.python-debug && '-dbg' || '' }} (deadsnakes)${{ matrix.valgrind && ' • Valgrind' || '' }} • x64"
  150. runs-on: ubuntu-latest
  151. steps:
  152. - uses: actions/checkout@v2
  153. - name: Setup Python ${{ matrix.python-version }} (deadsnakes)
  154. uses: deadsnakes/action@v2.1.1
  155. with:
  156. python-version: ${{ matrix.python-version }}
  157. debug: ${{ matrix.python-debug }}
  158. - name: Update CMake
  159. uses: jwlawson/actions-setup-cmake@v1.8
  160. - name: Valgrind cache
  161. if: matrix.valgrind
  162. uses: actions/cache@v2
  163. id: cache-valgrind
  164. with:
  165. path: valgrind
  166. key: 3.16.1 # Valgrind version
  167. - name: Compile Valgrind
  168. if: matrix.valgrind && steps.cache-valgrind.outputs.cache-hit != 'true'
  169. run: |
  170. VALGRIND_VERSION=3.16.1
  171. curl https://sourceware.org/pub/valgrind/valgrind-$VALGRIND_VERSION.tar.bz2 -o - | tar xj
  172. mv valgrind-$VALGRIND_VERSION valgrind
  173. cd valgrind
  174. ./configure
  175. make -j 2 > /dev/null
  176. - name: Install Valgrind
  177. if: matrix.valgrind
  178. working-directory: valgrind
  179. run: |
  180. sudo make install
  181. sudo apt-get update
  182. sudo apt-get install libc6-dbg # Needed by Valgrind
  183. - name: Prepare env
  184. run: python -m pip install -r tests/requirements.txt --prefer-binary
  185. - name: Configure
  186. run: >
  187. cmake -S . -B build
  188. -DCMAKE_BUILD_TYPE=Debug
  189. -DPYBIND11_WERROR=ON
  190. -DDOWNLOAD_CATCH=ON
  191. -DDOWNLOAD_EIGEN=ON
  192. -DCMAKE_CXX_STANDARD=17
  193. - name: Build
  194. run: cmake --build build -j 2
  195. - name: Python tests
  196. run: cmake --build build --target pytest
  197. - name: C++ tests
  198. run: cmake --build build --target cpptest
  199. - name: Run Valgrind on Python tests
  200. if: matrix.valgrind
  201. run: cmake --build build --target memcheck
  202. # Testing on clang using the excellent silkeh clang docker images
  203. clang:
  204. runs-on: ubuntu-latest
  205. strategy:
  206. fail-fast: false
  207. matrix:
  208. clang:
  209. - 3.6
  210. - 3.7
  211. - 3.9
  212. - 7
  213. - 9
  214. - dev
  215. std:
  216. - 11
  217. include:
  218. - clang: 5
  219. std: 14
  220. - clang: 10
  221. std: 20
  222. - clang: 10
  223. std: 17
  224. name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64"
  225. container: "silkeh/clang:${{ matrix.clang }}"
  226. steps:
  227. - uses: actions/checkout@v2
  228. - name: Add wget and python3
  229. run: apt-get update && apt-get install -y python3-dev python3-numpy python3-pytest libeigen3-dev
  230. - name: Configure
  231. shell: bash
  232. run: >
  233. cmake -S . -B build
  234. -DPYBIND11_WERROR=ON
  235. -DDOWNLOAD_CATCH=ON
  236. -DCMAKE_CXX_STANDARD=${{ matrix.std }}
  237. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  238. - name: Build
  239. run: cmake --build build -j 2
  240. - name: Python tests
  241. run: cmake --build build --target pytest
  242. - name: C++ tests
  243. run: cmake --build build --target cpptest
  244. - name: Interface test
  245. run: cmake --build build --target test_cmake_build
  246. # Testing NVCC; forces sources to behave like .cu files
  247. cuda:
  248. runs-on: ubuntu-latest
  249. name: "🐍 3.8 • CUDA 11 • Ubuntu 20.04"
  250. container: nvidia/cuda:11.0-devel-ubuntu20.04
  251. steps:
  252. - uses: actions/checkout@v2
  253. # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND
  254. - name: Install 🐍 3
  255. run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy
  256. - name: Configure
  257. run: cmake -S . -B build -DPYBIND11_CUDA_TESTS=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
  258. - name: Build
  259. run: cmake --build build -j2 --verbose
  260. - name: Python tests
  261. run: cmake --build build --target pytest
  262. # TODO: Internal compiler error - report to NVidia
  263. # # Testing CentOS 8 + PGI compilers
  264. # centos-nvhpc8:
  265. # runs-on: ubuntu-latest
  266. # name: "🐍 3 • CentOS8 / PGI 20.11 • x64"
  267. # container: centos:8
  268. #
  269. # steps:
  270. # - uses: actions/checkout@v2
  271. #
  272. # - name: Add Python 3 and a few requirements
  273. # run: yum update -y && yum install -y git python3-devel python3-numpy python3-pytest make environment-modules
  274. #
  275. # - name: Install CMake with pip
  276. # run: |
  277. # python3 -m pip install --upgrade pip
  278. # python3 -m pip install cmake --prefer-binary
  279. #
  280. # - name: Install NVidia HPC SDK
  281. # run: >
  282. # yum -y install
  283. # https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc-20-11-20.11-1.x86_64.rpm
  284. # https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc-2020-20.11-1.x86_64.rpm
  285. #
  286. # - name: Configure
  287. # shell: bash
  288. # run: |
  289. # source /etc/profile.d/modules.sh
  290. # module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.11
  291. # cmake -S . -B build -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=14 -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  292. #
  293. # - name: Build
  294. # run: cmake --build build -j 2 --verbose
  295. #
  296. # - name: Python tests
  297. # run: cmake --build build --target pytest
  298. #
  299. # - name: C++ tests
  300. # run: cmake --build build --target cpptest
  301. #
  302. # - name: Interface test
  303. # run: cmake --build build --target test_cmake_build
  304. # Testing on CentOS 7 + PGI compilers, which seems to require more workarounds
  305. centos-nvhpc7:
  306. runs-on: ubuntu-latest
  307. name: "🐍 3 • CentOS7 / PGI 20.9 • x64"
  308. container: centos:7
  309. steps:
  310. - uses: actions/checkout@v2
  311. - name: Add Python 3 and a few requirements
  312. run: yum update -y && yum install -y epel-release && yum install -y git python3-devel make environment-modules cmake3
  313. - name: Install NVidia HPC SDK
  314. run: yum -y install https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc-20-9-20.9-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc-2020-20.9-1.x86_64.rpm
  315. # On CentOS 7, we have to filter a few tests (compiler internal error)
  316. # and allow deeper templete recursion (not needed on CentOS 8 with a newer
  317. # standard library). On some systems, you many need further workarounds:
  318. # https://github.com/pybind/pybind11/pull/2475
  319. - name: Configure
  320. shell: bash
  321. run: |
  322. source /etc/profile.d/modules.sh
  323. module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/20.9
  324. cmake3 -S . -B build -DDOWNLOAD_CATCH=ON \
  325. -DCMAKE_CXX_STANDARD=11 \
  326. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \
  327. -DCMAKE_CXX_FLAGS="-Wc,--pending_instantiations=0" \
  328. -DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp"
  329. # Building before installing Pip should produce a warning but not an error
  330. - name: Build
  331. run: cmake3 --build build -j 2 --verbose
  332. - name: Install CMake with pip
  333. run: |
  334. python3 -m pip install --upgrade pip
  335. python3 -m pip install pytest
  336. - name: Python tests
  337. run: cmake3 --build build --target pytest
  338. - name: C++ tests
  339. run: cmake3 --build build --target cpptest
  340. - name: Interface test
  341. run: cmake3 --build build --target test_cmake_build
  342. # Testing on GCC using the GCC docker images (only recent images supported)
  343. gcc:
  344. runs-on: ubuntu-latest
  345. strategy:
  346. fail-fast: false
  347. matrix:
  348. gcc:
  349. - 7
  350. - latest
  351. std:
  352. - 11
  353. include:
  354. - gcc: 10
  355. std: 20
  356. name: "🐍 3 • GCC ${{ matrix.gcc }} • C++${{ matrix.std }}• x64"
  357. container: "gcc:${{ matrix.gcc }}"
  358. steps:
  359. - uses: actions/checkout@v1
  360. - name: Add Python 3
  361. run: apt-get update; apt-get install -y python3-dev python3-numpy python3-pytest python3-pip libeigen3-dev
  362. - name: Update pip
  363. run: python3 -m pip install --upgrade pip
  364. - name: Update CMake
  365. uses: jwlawson/actions-setup-cmake@v1.8
  366. - name: Configure
  367. shell: bash
  368. run: >
  369. cmake -S . -B build
  370. -DPYBIND11_WERROR=ON
  371. -DDOWNLOAD_CATCH=ON
  372. -DCMAKE_CXX_STANDARD=${{ matrix.std }}
  373. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  374. - name: Build
  375. run: cmake --build build -j 2
  376. - name: Python tests
  377. run: cmake --build build --target pytest
  378. - name: C++ tests
  379. run: cmake --build build --target cpptest
  380. - name: Interface test
  381. run: cmake --build build --target test_cmake_build
  382. # Testing on ICC using the oneAPI apt repo
  383. icc:
  384. runs-on: ubuntu-20.04
  385. strategy:
  386. fail-fast: false
  387. name: "🐍 3 • ICC latest • x64"
  388. steps:
  389. - uses: actions/checkout@v2
  390. - name: Add apt repo
  391. run: |
  392. sudo apt-get update
  393. sudo apt-get install -y wget build-essential pkg-config cmake ca-certificates gnupg
  394. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
  395. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
  396. echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
  397. - name: Add ICC & Python 3
  398. 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
  399. - name: Update pip
  400. run: |
  401. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  402. python3 -m pip install --upgrade pip
  403. - name: Install dependencies
  404. run: |
  405. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  406. python3 -m pip install -r tests/requirements.txt --prefer-binary
  407. - name: Configure C++11
  408. run: |
  409. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  410. cmake -S . -B build-11 \
  411. -DPYBIND11_WERROR=ON \
  412. -DDOWNLOAD_CATCH=ON \
  413. -DDOWNLOAD_EIGEN=OFF \
  414. -DCMAKE_CXX_STANDARD=11 \
  415. -DCMAKE_CXX_COMPILER=$(which icpc) \
  416. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  417. - name: Build C++11
  418. run: |
  419. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  420. cmake --build build-11 -j 2 -v
  421. - name: Python tests C++11
  422. run: |
  423. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  424. sudo service apport stop
  425. cmake --build build-11 --target check
  426. - name: C++ tests C++11
  427. run: |
  428. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  429. cmake --build build-11 --target cpptest
  430. - name: Interface test C++11
  431. run: |
  432. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  433. cmake --build build-11 --target test_cmake_build
  434. - name: Configure C++17
  435. run: |
  436. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  437. cmake -S . -B build-17 \
  438. -DPYBIND11_WERROR=ON \
  439. -DDOWNLOAD_CATCH=ON \
  440. -DDOWNLOAD_EIGEN=OFF \
  441. -DCMAKE_CXX_STANDARD=17 \
  442. -DCMAKE_CXX_COMPILER=$(which icpc) \
  443. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  444. - name: Build C++17
  445. run: |
  446. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  447. cmake --build build-17 -j 2 -v
  448. - name: Python tests C++17
  449. run: |
  450. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  451. sudo service apport stop
  452. cmake --build build-17 --target check
  453. - name: C++ tests C++17
  454. run: |
  455. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  456. cmake --build build-17 --target cpptest
  457. - name: Interface test C++17
  458. run: |
  459. set +e; source /opt/intel/oneapi/setvars.sh; set -e
  460. cmake --build build-17 --target test_cmake_build
  461. # Testing on CentOS (manylinux uses a centos base, and this is an easy way
  462. # to get GCC 4.8, which is the manylinux1 compiler).
  463. centos:
  464. runs-on: ubuntu-latest
  465. strategy:
  466. fail-fast: false
  467. matrix:
  468. centos:
  469. - 7 # GCC 4.8
  470. - 8
  471. name: "🐍 3 • CentOS ${{ matrix.centos }} • x64"
  472. container: "centos:${{ matrix.centos }}"
  473. steps:
  474. - uses: actions/checkout@v2
  475. - name: Add Python 3
  476. run: yum update -y && yum install -y python3-devel gcc-c++ make git
  477. - name: Update pip
  478. run: python3 -m pip install --upgrade pip
  479. - name: Install dependencies
  480. run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary
  481. - name: Configure
  482. shell: bash
  483. run: >
  484. cmake -S . -B build
  485. -DPYBIND11_WERROR=ON
  486. -DDOWNLOAD_CATCH=ON
  487. -DDOWNLOAD_EIGEN=ON
  488. -DCMAKE_CXX_STANDARD=11
  489. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  490. - name: Build
  491. run: cmake --build build -j 2
  492. - name: Python tests
  493. run: cmake --build build --target pytest
  494. - name: C++ tests
  495. run: cmake --build build --target cpptest
  496. - name: Interface test
  497. run: cmake --build build --target test_cmake_build
  498. # This tests an "install" with the CMake tools
  499. install-classic:
  500. name: "🐍 3.5 • Debian • x86 • Install"
  501. runs-on: ubuntu-latest
  502. container: i386/debian:stretch
  503. steps:
  504. - uses: actions/checkout@v1
  505. - name: Install requirements
  506. run: |
  507. apt-get update
  508. apt-get install -y git make cmake g++ libeigen3-dev python3-dev python3-pip
  509. pip3 install "pytest==3.1.*"
  510. - name: Configure for install
  511. run: >
  512. cmake .
  513. -DPYBIND11_INSTALL=1 -DPYBIND11_TEST=0
  514. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  515. - name: Make and install
  516. run: make install
  517. - name: Copy tests to new directory
  518. run: cp -a tests /pybind11-tests
  519. - name: Make a new test directory
  520. run: mkdir /build-tests
  521. - name: Configure tests
  522. run: >
  523. cmake ../pybind11-tests
  524. -DDOWNLOAD_CATCH=ON
  525. -DPYBIND11_WERROR=ON
  526. -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
  527. working-directory: /build-tests
  528. - name: Run tests
  529. run: make pytest -j 2
  530. working-directory: /build-tests
  531. # This verifies that the documentation is not horribly broken, and does a
  532. # basic sanity check on the SDist.
  533. doxygen:
  534. name: "Documentation build test"
  535. runs-on: ubuntu-latest
  536. steps:
  537. - uses: actions/checkout@v2
  538. - uses: actions/setup-python@v2
  539. - name: Install Doxygen
  540. run: sudo apt-get install -y doxygen librsvg2-bin # Changed to rsvg-convert in 20.04
  541. - name: Install docs & setup requirements
  542. run: python3 -m pip install -r docs/requirements.txt
  543. - name: Build docs
  544. run: python3 -m sphinx -W -b html docs docs/.build
  545. - name: Make SDist
  546. run: python3 setup.py sdist
  547. - run: git status --ignored
  548. - name: Check local include dir
  549. run: >
  550. ls pybind11;
  551. python3 -c "import pybind11, pathlib; assert (a := pybind11.get_include()) == (b := str(pathlib.Path('include').resolve())), f'{a} != {b}'"
  552. - name: Compare Dists (headers only)
  553. working-directory: include
  554. run: |
  555. python3 -m pip install --user -U ../dist/*
  556. installed=$(python3 -c "import pybind11; print(pybind11.get_include() + '/pybind11')")
  557. diff -rq $installed ./pybind11
  558. win32:
  559. strategy:
  560. fail-fast: false
  561. matrix:
  562. python:
  563. - 3.5
  564. - 3.6
  565. - 3.7
  566. - 3.8
  567. - 3.9
  568. - pypy3
  569. # TODO: fix hang on pypy2
  570. include:
  571. - python: 3.9
  572. args: -DCMAKE_CXX_STANDARD=20 -DDOWNLOAD_EIGEN=OFF
  573. - python: 3.8
  574. args: -DCMAKE_CXX_STANDARD=17
  575. name: "🐍 ${{ matrix.python }} • MSVC 2019 • x86 ${{ matrix.args }}"
  576. runs-on: windows-latest
  577. steps:
  578. - uses: actions/checkout@v2
  579. - name: Setup Python ${{ matrix.python }}
  580. uses: actions/setup-python@v2
  581. with:
  582. python-version: ${{ matrix.python }}
  583. architecture: x86
  584. - name: Update CMake
  585. uses: jwlawson/actions-setup-cmake@v1.8
  586. - name: Prepare MSVC
  587. uses: ilammy/msvc-dev-cmd@v1
  588. with:
  589. arch: x86
  590. - name: Prepare env
  591. run: python -m pip install -r tests/requirements.txt --prefer-binary
  592. # First build - C++11 mode and inplace
  593. - name: Configure ${{ matrix.args }}
  594. run: >
  595. cmake -S . -B build
  596. -G "Visual Studio 16 2019" -A Win32
  597. -DPYBIND11_WERROR=ON
  598. -DDOWNLOAD_CATCH=ON
  599. -DDOWNLOAD_EIGEN=ON
  600. ${{ matrix.args }}
  601. - name: Build C++11
  602. run: cmake --build build -j 2
  603. - name: Run tests
  604. run: cmake --build build -t pytest
  605. win32-msvc2015:
  606. name: "🐍 ${{ matrix.python }} • MSVC 2015 • x64"
  607. runs-on: windows-latest
  608. strategy:
  609. fail-fast: false
  610. matrix:
  611. python:
  612. - 2.7
  613. - 3.6
  614. - 3.7
  615. # todo: check/cpptest does not support 3.8+ yet
  616. steps:
  617. - uses: actions/checkout@v2
  618. - name: Setup 🐍 ${{ matrix.python }}
  619. uses: actions/setup-python@v2
  620. with:
  621. python-version: ${{ matrix.python }}
  622. - name: Update CMake
  623. uses: jwlawson/actions-setup-cmake@v1.8
  624. - name: Prepare MSVC
  625. uses: ilammy/msvc-dev-cmd@v1
  626. with:
  627. toolset: 14.0
  628. - name: Prepare env
  629. run: python -m pip install -r tests/requirements.txt --prefer-binary
  630. # First build - C++11 mode and inplace
  631. - name: Configure
  632. run: >
  633. cmake -S . -B build
  634. -G "Visual Studio 14 2015" -A x64
  635. -DPYBIND11_WERROR=ON
  636. -DDOWNLOAD_CATCH=ON
  637. -DDOWNLOAD_EIGEN=ON
  638. - name: Build C++14
  639. run: cmake --build build -j 2
  640. - name: Run all checks
  641. run: cmake --build build -t check
  642. win32-msvc2017:
  643. name: "🐍 ${{ matrix.python }} • MSVC 2017 • x64"
  644. runs-on: windows-2016
  645. strategy:
  646. fail-fast: false
  647. matrix:
  648. python:
  649. - 2.7
  650. - 3.5
  651. - 3.7
  652. std:
  653. - 14
  654. include:
  655. - python: 2.7
  656. std: 17
  657. args: >
  658. -DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
  659. steps:
  660. - uses: actions/checkout@v2
  661. - name: Setup 🐍 ${{ matrix.python }}
  662. uses: actions/setup-python@v2
  663. with:
  664. python-version: ${{ matrix.python }}
  665. - name: Update CMake
  666. uses: jwlawson/actions-setup-cmake@v1.8
  667. - name: Prepare env
  668. run: python -m pip install -r tests/requirements.txt --prefer-binary
  669. # First build - C++11 mode and inplace
  670. - name: Configure
  671. run: >
  672. cmake -S . -B build
  673. -G "Visual Studio 15 2017" -A x64
  674. -DPYBIND11_WERROR=ON
  675. -DDOWNLOAD_CATCH=ON
  676. -DDOWNLOAD_EIGEN=ON
  677. -DCMAKE_CXX_STANDARD=${{ matrix.std }}
  678. ${{ matrix.args }}
  679. - name: Build ${{ matrix.std }}
  680. run: cmake --build build -j 2
  681. - name: Run all checks
  682. run: cmake --build build -t check