diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f3538aad9..c97fdaf8f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -15,13 +15,17 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' - name: Get Concurrency run: echo NPROC="nproc" >> $GITHUB_ENV - name: Set Up Dependencies run: | - sudo apt install -y cmake ninja-build pkg-config lcov g++-11 libcairo2-dev gnuplot libmpfr-dev python3-pip python3-dev gnuplot + sudo apt install -y cmake ninja-build pkg-config lcov g++-11 libcairo2-dev gnuplot libmpfr-dev python3-pip python3.11-dev gnuplot + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 sudo pip3 install coverage pytest - name: Create Build Environment diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 7db7a861d..3994cccef 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -41,6 +41,9 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' - name: Get macOS Concurrency if: runner.os == 'macOS' @@ -57,7 +60,7 @@ jobs: - name: Set Up macOS Dependencies if: runner.os == 'macOS' run: | - brew install ninja gcc@12 python3 mpfr cairo gnuplot pkg-config + brew install ninja gcc@12 mpfr cairo gnuplot pkg-config python3 -m pip install --upgrade pip pip3 install --upgrade pip pip3 install pytest @@ -65,7 +68,8 @@ jobs: - name: Set Up Linux Dependencies if: runner.os == 'Linux' run: | - sudo apt install -y cmake ninja-build pkg-config clang-15 g++-12 libcairo2-dev gnuplot libmpfr-dev python3-pip python3-dev + sudo apt install -y cmake ninja-build pkg-config clang-15 g++-12 libcairo2-dev gnuplot libmpfr-dev python3-pip python3.11-dev + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 sudo pip3 install pytest - name: Create Build Environment diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 320297f30..cdd001299 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,6 +51,9 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' - name: Get macOS Concurrency if: runner.os == 'macOS' @@ -72,7 +75,9 @@ jobs: - name: Set Up Linux Dependencies if: runner.os == 'Linux' run: | - sudo apt install -y cmake ninja-build pkg-config ${{matrix.config.cxx-pkg}} libcairo2-dev gnuplot libmpfr-dev python3-pip python3-dev + sudo apt install -y cmake ninja-build pkg-config ${{matrix.config.cxx-pkg}} libcairo2-dev gnuplot libmpfr-dev python3-pip python3.11-dev + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 + sudo pip3 install pytest - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 785885163..dc0ed1d80 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Python3 COMPONENTS Interpreter Development) +find_package(Python3 3.11 EXACT COMPONENTS Interpreter Development) if(PYTHON3_FOUND) diff --git a/python/tests/CMakeLists.txt b/python/tests/CMakeLists.txt index 58665f9ef..1c0a9df22 100644 --- a/python/tests/CMakeLists.txt +++ b/python/tests/CMakeLists.txt @@ -1,9 +1,13 @@ -execute_process(COMMAND ${Python3_EXECUTABLE} -m pytest --version RESULT_VARIABLE PYTEST_result OUTPUT_QUIET ERROR_QUIET) +execute_process(COMMAND pytest --version RESULT_VARIABLE PYTEST_result OUTPUT_QUIET ERROR_QUIET) if(${PYTEST_result} EQUAL 0) set(PYTHON_TESTS ON) message(STATUS "pytest package found, Python tests will be performed.") else() - message(WARNING "pytest package not available, will not perform Python tests.") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + message(FATAL_ERROR "pytest package not available, can not perform Python tests.") + else() + message(WARNING "pytest package not available, will not perform Python tests.") + endif() endif() if(PYTHON_TESTS) @@ -20,8 +24,8 @@ if(PYTHON_TESTS) ) foreach(TESTNAME ${TESTS_PYTHON}) - add_custom_target(test_python_${TESTNAME} COMMAND ${Python3_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_${TESTNAME}.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - add_test(NAME test_python_${TESTNAME} COMMAND ${Python3_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_${TESTNAME}.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_custom_target(test_python_${TESTNAME} COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_${TESTNAME}.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_test(NAME test_python_${TESTNAME} COMMAND pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_${TESTNAME}.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) set_property(TEST test_python_${TESTNAME} PROPERTY ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/python") set_property(TEST test_python_${TESTNAME} PROPERTY LABELS "python") endforeach()