-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add GHA and several test fixes #2321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a01b244
a32d10a
207d897
12e8e03
4ee282e
314a035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- stable | ||
- v* | ||
|
||
jobs: | ||
standard: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu, windows, macos] | ||
python: | ||
- 2.7 | ||
- 3.5 | ||
- 3.8 | ||
- 3.9-dev | ||
- pypy2 | ||
- pypy3 | ||
|
||
include: | ||
- os: ubuntu | ||
python: 3.6 | ||
- os: macos | ||
python: 3.7 | ||
|
||
exclude: | ||
# Currently 32bit only, and we build 64bit | ||
- os: windows | ||
python: pypy2 | ||
- os: windows | ||
python: pypy3 | ||
|
||
# Currently can't build due to warning, fixed in CPython > 3.9b5 | ||
- os: macos | ||
python: 3.9-dev | ||
|
||
# Currently broken on embed_test | ||
- os: windows | ||
python: 3.8 | ||
- os: windows | ||
python: 3.9-dev | ||
|
||
name: Python ${{ matrix.python }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }}-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Python ${{ matrix.python }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Prepare env | ||
run: python -m pip install -r tests/requirements.txt | ||
|
||
- name: Configure | ||
shell: bash | ||
run: > | ||
cmake -S . -B build | ||
-DPYBIND11_WERROR=ON | ||
-DDOWNLOAD_CATCH=ON | ||
-DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)") | ||
|
||
- name: Build | ||
run: cmake --build build -j 2 | ||
|
||
- name: Python tests | ||
run: cmake --build build --target pytest -j 2 -v | ||
|
||
- name: C++ tests | ||
run: cmake --build build --target cpptest -j 2 -v | ||
|
||
- name: Interface test | ||
run: cmake --build build --target test_cmake_build |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,4 @@ MANIFEST | |
sosize-*.txt | ||
pybind11Config*.cmake | ||
pybind11Targets.cmake | ||
/*env* | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,14 @@ function(pybind11_enable_warnings target_name) | |
target_compile_options(${target_name} PRIVATE -Werror) | ||
endif() | ||
endif() | ||
|
||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND PYTHON_VERSION VERSION_LESS 3.0) | ||
if(CMAKE_CXX_STANDARD STREQUAL "14") | ||
target_compile_options(${target_name} PUBLIC -Wno-deprecated-register) | ||
elseif(NOT CMAKE_CXX_STANDARD VERSION_LESS 17) | ||
target_compile_options(${target_name} PUBLIC -Wno-register) | ||
endif() | ||
endif() | ||
endfunction() | ||
|
||
set(test_targets pybind11_tests) | ||
|
@@ -203,10 +211,10 @@ foreach(target ${test_targets}) | |
|
||
# Always write the output file directly into the 'tests' directory (even on MSVC) | ||
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) | ||
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${testdir}) | ||
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${testdir}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought cmake doesn't care about quotes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, without quotes spaces turn into separate arguments. All filename variables need to have quotes. We aren't testing with a space in the name of a directory, but I expect this would fail without quotes. |
||
foreach(config ${CMAKE_CONFIGURATION_TYPES}) | ||
string(TOUPPER ${config} config) | ||
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} ${testdir}) | ||
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} "${testdir}") | ||
endforeach() | ||
endif() | ||
endforeach() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--extra-index-url https://antocuni.github.io/pypy-wheels/manylinux2010/ | ||
numpy; platform_python_implementation!="PyPy" or sys_platform!="darwin" or python_version<"3.0" | ||
pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the leading slash intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm assuming a virtual environment would be in the main directory or in a build directory (which should be already ignored)