Test the released Conda Package #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Test the released Conda Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| khiops-samples-version: | |
| default: 11.0.0 | |
| description: khiops-samples version | |
| khiops-python-version: | |
| default: 11.0.1.0 | |
| description: khiops-python version for testing | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Test Conda package on brand new environments | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.10', '3.14'] | |
| os: [ubuntu-24.04, windows-2025, macos-15] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Install Miniforge | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-version: 24.11.0-0 | |
| python-version: ${{ matrix.python-version }} | |
| conda-remove-defaults: true | |
| - name: Install the Khiops Conda package | |
| run: | | |
| # Add the Conda `rc` label for alpha or RC pre-releases | |
| if [[ $(echo ${{ inputs.khiops-python-version }} | grep -E ".*(a|rc)\.[0-9]+") ]]; then | |
| RC_LABEL="conda-forge/label/rc::" | |
| else | |
| RC_LABEL="" | |
| fi | |
| conda install "${RC_LABEL}"khiops==${{ inputs.khiops-python-version }} | |
| - name: Test Khiops Installation Status | |
| run: kh-status | |
| - name: Test Khiops Installation Status (Conda-Based Environments) | |
| run: | | |
| # Set `python` to the current Conda Python executable | |
| PYTHON="$(type -P python)" | |
| # Remove $CONDA_PREFIX/bin from PATH | |
| PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g") | |
| # Unset *CONDA* environment variables | |
| # As a corollary, CONDA_PREFIX is unset | |
| # Note: There is no way to remove these variables from GITHUB_ENV | |
| # (see https://github.com/actions/runner/issues/1126) | |
| for CONDA_VAR in $(env | grep CONDA) | |
| do | |
| unset $(echo $CONDA_VAR | cut -d '=' -f 1) | |
| done | |
| # Note: kh-status is not reachable as it is not in PATH | |
| $PYTHON -c \ | |
| "import sys; import khiops.core as kh; return_code = kh.get_runner().print_status(); sys.exit(return_code)" | |
| - name: Download Sample Datasets | |
| run: | | |
| kh-download-datasets \ | |
| --version ${{ inputs.khiops-samples-version }} | |
| - name: Run Samples | |
| env: | |
| # Force > 2 CPU cores to launch mpiexec | |
| KHIOPS_PROC_NUMBER: 4 | |
| # Oversubscribe for Open MPI 4.x | |
| rmaps_base_oversubscribe: true | |
| OMPI_MCA_rmaps_base_oversubscribe: true | |
| # Oversubscribe for Open MPI >= 5 | |
| PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe | |
| run: | | |
| kh-samples core -i deploy_model -e | |
| kh-samples core -i deploy_coclustering -e | |
| kh-samples core -i train_predictor_error_handling -e | |
| kh-samples sklearn -i khiops_classifier -e | |
| kh-samples sklearn -i khiops_coclustering -e | |
| - name: Run Samples (Conda-Based Environments) | |
| env: | |
| # Force > 2 CPU cores to launch mpiexec | |
| KHIOPS_PROC_NUMBER: 4 | |
| # Oversubscribe for Open MPI 4.x | |
| rmaps_base_oversubscribe: true | |
| OMPI_MCA_rmaps_base_oversubscribe: true | |
| # Oversubscribe for Open MPI >= 5 | |
| PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe | |
| run: | | |
| # Set `python` to the current Conda Python executable | |
| PYTHON="$(type -P python)" | |
| # Remove $CONDA_PREFIX/bin from PATH | |
| PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g") | |
| # Unset *CONDA* environment variables | |
| # As a corollary, CONDA_PREFIX is unset | |
| # Note: There is no way to remove these variables from GITHUB_ENV | |
| # (see https://github.com/actions/runner/issues/1126) | |
| for CONDA_VAR in $(env | grep CONDA) | |
| do | |
| unset $(echo $CONDA_VAR | cut -d '=' -f 1) | |
| done | |
| # Run samples | |
| # Note: kh-samples is not reachable as it is not in PATH | |
| $PYTHON -m khiops.samples.samples -i deploy_model -e | |
| $PYTHON -m khiops.samples.samples -i deploy_coclustering -e | |
| $PYTHON -m khiops.samples.samples -i train_predictor_error_handling -e | |
| $PYTHON -m khiops.samples.samples_sklearn -i khiops_classifier -e | |
| $PYTHON -m khiops.samples.samples_sklearn -i khiops_coclustering -e | |
| # Checkout the sources to obtain the tests | |
| # Note: The `sparse-checkout` option of this action is bugged so we checkout all the sources | |
| # See https://github.com/actions/checkout/issues/1628 | |
| - name: Checkout Sources | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| # This is needed so python does not retrieve the khiops module from PWD | |
| - name: Remove the khiops Module from the Sources | |
| run: rm -rf khiops | |
| - name: Install the Test Requirements | |
| run: conda install -y --file test-requirements.txt | |
| - name: Run the Runner Initialization Integration Test | |
| run: | | |
| python -m unittest -v \ | |
| tests.test_khiops_integrations.KhiopsRunnerEnvironmentTests.test_runner_environment_initialization | |
| - name: Run the Runner Initialization Integration Test (Conda-Based Environments) | |
| run: |- | |
| # Set `python` to the current Conda Python executable | |
| PYTHON="$(type -P python)" | |
| # Remove $CONDA_PREFIX/bin from PATH | |
| PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g") | |
| # Unset *CONDA* environment variables | |
| # As a corolary, CONDA_PREFIX is unset | |
| # Note: There is no way to remove these variables from GITHUB_ENV | |
| # (see https://github.com/actions/runner/issues/1126) | |
| for CONDA_VAR in $(env | grep CONDA) | |
| do | |
| unset $(echo $CONDA_VAR | cut -d '=' -f 1) | |
| done | |
| # Execute the runner initialization integration test | |
| $PYTHON -m unittest -v \ | |
| tests.test_khiops_integrations.KhiopsRunnerEnvironmentTests.test_runner_environment_initialization |