Skip to content
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

ci(gha): enable test on macos #421

Merged
merged 4 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/_wheel-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
type: string
description: "Python version"
required: true
cpp_test:
type: boolean
description: "Run C++ tests"
required: false
default: false

defaults:
run:
Expand Down Expand Up @@ -48,6 +53,9 @@ jobs:
run: |
cmake -DCMAKE_BUILD_TYPE=Release -S . -B build -G Ninja

- if: ${{ inputs.cpp_test }}
run: echo "SKBUILD_CMAKE_DEFINE=NURI_POSTINSTALL_TEST=ON" >>$GITHUB_ENV

- if: ${{ contains(inputs.python, 'linux') }}
uses: pypa/[email protected]
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ jobs:
uses: ./.github/workflows/_wheel-build.yaml
with:
python: cp38-macosx_x86_64
cpp_test: true

test-build-mac-arm:
needs: [check-want-test]
if: ${{ needs.check-want-test.outputs.want-test == 'true' }}
uses: ./.github/workflows/_wheel-build.yaml
with:
python: cp38-macosx_arm64
cpp_test: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wheels-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
uses: ./.github/workflows/_wheel-build.yaml
with:
python: ${{ matrix.pyver }}-${{ matrix.os }}
cpp_test: ${{ matrix.pyver == 'cp38' }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ option(NURI_TEST_COVERAGE "Enable coverage build" OFF)
option(NURI_BUILD_DOCS "Build documentation" OFF)
option(NURI_BUILD_PYTHON_DOCS "Build python documentation" OFF)

option(NURI_POSTINSTALL_TEST "Run tests after installation" OFF)
mark_as_advanced(NURI_POSTINSTALL_TEST)

if(CMAKE_SYSTEM_NAME MATCHES Linux)
set(NURI_RPATH_PREFIX "$ORIGIN")
elseif(CMAKE_SYSTEM_NAME MATCHES Darwin)
Expand Down Expand Up @@ -142,3 +145,16 @@ endif()

include(CTest)
add_subdirectory(test EXCLUDE_FROM_ALL)

if(BUILD_TESTING AND NURI_POSTINSTALL_TEST)
message(NOTICE "Running tests after post-installation step")
include(ProcessorCount)

ProcessorCount(NPROC)
install(CODE
"execute_process(
COMMAND \"\${CMAKE_CTEST_COMMAND}\" -T test -j ${NPROC} --output-on-failure
WORKING_DIRECTORY \"$<1:${CMAKE_CURRENT_BINARY_DIR}>\"
)"
)
endif()
Loading