Skip to content

Commit

Permalink
Merge pull request #421 from seoklab/ci/macos-test
Browse files Browse the repository at this point in the history
ci(gha): enable test on macos
  • Loading branch information
jnooree authored Dec 3, 2024
2 parents 382f294 + 787ed30 commit 3aac593
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
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()

0 comments on commit 3aac593

Please sign in to comment.