diff --git a/.github/actions/run-standard-tests/action.yml b/.github/actions/run-standard-tests/action.yml index 86c3b11bb..449e6088b 100644 --- a/.github/actions/run-standard-tests/action.yml +++ b/.github/actions/run-standard-tests/action.yml @@ -13,6 +13,18 @@ inputs: running-mode: description: Running mode (parallel or serial) required: true + test-khiops: + description: Test the MODL binary + required: false + default: 'true' + test-coclustering: + description: Test the MODL_Coclustering binary + required: false + default: 'true' + test-kni: + description: Test the KhiopsNativeInterface library via KNITransfer + required: false + default: 'true' config: description: Build configuration (debug or release) required: true @@ -69,17 +81,27 @@ runs: run: | if [[ "${{ inputs.running-mode }}" == "parallel" ]] ; then export PARALLEL_ARG="-p 4" + else + export PARALLEL_ARG="-p 1" fi if [[ "${{ inputs.config }}" == "release" ]] ; then - $PYTHON $TEST_PY test/LearningTest/TestKhiops/Standard "${{ inputs.binary-path }}" ${PARALLEL_ARG} - $PYTHON $TEST_PY test/LearningTest/TestCoclustering/Standard "${{ inputs.binary-path }}" ${PARALLEL_ARG} - if [[ "${{ inputs.running-mode }}" != "parallel" ]] ; then + if [[ "${{ inputs.test-khiops }}" == "true" ]] ; then + $PYTHON $TEST_PY test/LearningTest/TestKhiops/Standard "${{ inputs.binary-path }}" ${PARALLEL_ARG} + fi + if [[ "${{ inputs.test-coclustering }}" == "true" ]] ; then + $PYTHON $TEST_PY test/LearningTest/TestCoclustering/Standard "${{ inputs.binary-path }}" ${PARALLEL_ARG} + fi + if [[ "${{ inputs.test-kni }}" == "true" && "${{ inputs.running-mode }}" != "parallel" ]] ; then $PYTHON $TEST_PY test/LearningTest/TestKNI/Standard "${{ inputs.binary-path }}" fi else - $PYTHON $TEST_PY test/LearningTest/TestKhiops/Standard/IrisLight "${{ inputs.binary-path }}" ${PARALLEL_ARG} - $PYTHON $TEST_PY test/LearningTest/TestCoclustering/Standard/Iris "${{ inputs.binary-path }}" ${PARALLEL_ARG} - if [[ "${{ inputs.running-mode }}" != "parallel" ]] ; then + if [[ "${{ inputs.test-khiops }}" == "true" ]] ; then + $PYTHON $TEST_PY test/LearningTest/TestKhiops/Standard/IrisLight "${{ inputs.binary-path }}" ${PARALLEL_ARG} + fi + if [[ "${{ inputs.test-coclustering }}" == "true" ]] ; then + $PYTHON $TEST_PY test/LearningTest/TestCoclustering/Standard/Iris "${{ inputs.binary-path }}" ${PARALLEL_ARG} + fi + if [[ "${{ inputs.test-kni }}" == "true" && "${{ inputs.running-mode }}" != "parallel" ]] ; then $PYTHON $TEST_PY test/LearningTest/TestKNI/Standard/Iris "${{ inputs.binary-path }}" fi fi @@ -89,15 +111,23 @@ runs: run: | mkdir -p results if [[ "${{ inputs.config }}" == "release" ]] ; then - $PYTHON $APPLY_PY test/LearningTest/TestKhiops/Standard errors | tee -a results/errors.txt - $PYTHON $APPLY_PY test/LearningTest/TestCoclustering/Standard errors | tee -a results/errors.txt - if [[ "${{ inputs.running-mode }}" != "parallel" ]] ; then + if [[ "${{ inputs.test-khiops }}" == "true" ]] ; then + $PYTHON $APPLY_PY test/LearningTest/TestKhiops/Standard errors | tee -a results/errors.txt + fi + if [[ "${{ inputs.test-coclustering }}" == "true" ]] ; then + $PYTHON $APPLY_PY test/LearningTest/TestCoclustering/Standard errors | tee -a results/errors.txt + fi + if [[ "${{ inputs.test-kni }}" == "true" && "${{ inputs.running-mode }}" != "parallel" ]] ; then $PYTHON $APPLY_PY test/LearningTest/TestKNI/Standard errors | tee -a results/errors.txt fi else - $PYTHON $APPLY_PY test/LearningTest/TestKhiops/Standard/IrisLight errors | tee -a results/errors.txt - $PYTHON $APPLY_PY test/LearningTest/TestCoclustering/Standard/Iris errors | tee -a results/errors.txt - if [[ "${{ inputs.running-mode }}" != "parallel" ]] ; then + if [[ "${{ inputs.test-khiops }}" == "true" ]] ; then + $PYTHON $APPLY_PY test/LearningTest/TestKhiops/Standard/IrisLight errors | tee -a results/errors.txt + fi + if [[ "${{ inputs.test-coclustering }}" == "true" ]] ; then + $PYTHON $APPLY_PY test/LearningTest/TestCoclustering/Standard/Iris errors | tee -a results/errors.txt + fi + if [[ "${{ inputs.test-kni }}" == "true" && "${{ inputs.running-mode }}" != "parallel" ]] ; then $PYTHON $APPLY_PY test/LearningTest/TestKNI/Standard/Iris errors | tee -a results/errors.txt fi fi diff --git a/.github/workflows/pack-pip.yml b/.github/workflows/pack-pip.yml index 47e033a29..a965e9686 100644 --- a/.github/workflows/pack-pip.yml +++ b/.github/workflows/pack-pip.yml @@ -159,7 +159,7 @@ jobs: name: pkg-wheel-windows-2025-vs2026 path: wheelhouse/*.whl if-no-files-found: error - test-khiops-core-wheel: + test-khiops-core-and-kni-wheels: strategy: matrix: setup: @@ -171,7 +171,7 @@ jobs: - {os: macos-15-intel, image: ''} runs-on: ${{ matrix.setup.os }} container: ${{ matrix.setup.image }} - name: Test wheel + name: Test Khiops Core and KNI wheels with LearningTestTool needs: [build-wheel, sign-wheel-windows] steps: - uses: actions/checkout@v6 @@ -218,7 +218,7 @@ jobs: fi $PYTHON -m pip install --find-links=wheelhouse khiops-core $PYTHON -m pip show -f khiops-core - - name: Run standard tests + - name: Run standard tests on the Core package uses: ./.github/actions/run-standard-tests with: warning_as_error: true @@ -227,6 +227,17 @@ jobs: binary-path: ${{ steps.install_khiops_core.outputs.BIN_DIR }} testing-context-description: pip-test-${{ matrix.setup.os }}-${{ matrix.setup.image }} + - name: Run standard tests on the KNI package + uses: ./.github/actions/run-standard-tests + with: + warning_as_error: true + running-mode: serial + test-khiops: false + test-coclustering: false + config: release + binary-path: ${{ steps.install_khiops_core.outputs.BIN_DIR }} + testing-context-description: pip-test-${{ matrix.setup.os }}-${{ matrix.setup.image + }} test-kni: name: Test KNI Python wheel needs: [build-wheel, sign-wheel-windows] @@ -300,7 +311,7 @@ jobs: if: github.ref_type == 'tag' && github.repository_owner == 'KhiopsML' && inputs.python_repository == 'testpypi' name: Publish to Test.PyPI.org - needs: [build-wheel, test-khiops-core-wheel, test-kni] + needs: [build-wheel, test-khiops-core-and-kni-wheels, test-kni] runs-on: ubuntu-latest permissions: id-token: write @@ -321,7 +332,7 @@ jobs: name: Publish to PyPI.org if: github.ref_type == 'tag' && github.repository_owner == 'KhiopsML' && inputs.python_repository == 'pypi' - needs: [build-wheel, test-khiops-core-wheel, test-kni] + needs: [build-wheel, test-khiops-core-and-kni-wheels, test-kni] runs-on: ubuntu-latest permissions: id-token: write diff --git a/src/Learning/KNITransfer/CMakeLists.txt b/src/Learning/KNITransfer/CMakeLists.txt index 6496ecd17..4273a2937 100644 --- a/src/Learning/KNITransfer/CMakeLists.txt +++ b/src/Learning/KNITransfer/CMakeLists.txt @@ -4,3 +4,19 @@ add_executable(KNITransfer ${cppfiles}) set_khiops_options(KNITransfer) target_link_libraries(KNITransfer PUBLIC KhiopsNativeInterface KWLearningProblem DTForest PLParallelTask) + +# On Pip installations the KNI library is installed into `bin/`, in the same directory as KNITransfer, not into `lib/`. +# Hence, append the binary's own directory to the rpath so that it is found at runtime on MacOS and Linux. +if(IS_PIP AND NOT MSVC) + if(APPLE) + set_property( + TARGET KNITransfer + APPEND + PROPERTY INSTALL_RPATH "@loader_path") + else() + set_property( + TARGET KNITransfer + APPEND + PROPERTY INSTALL_RPATH "$ORIGIN") + endif() +endif()