|
| 1 | +--- |
| 2 | +name: Test the released Conda Package |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + khiops-core-version: |
| 7 | + default: 11.0.0 |
| 8 | + description: khiops-core version for testing |
| 9 | + khiops-samples-version: |
| 10 | + default: 11.0.0 |
| 11 | + description: khiops-samples version |
| 12 | + khiops-python-version: |
| 13 | + default: 11.0.0.3 |
| 14 | + description: khiops-python version for testing |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: bash -el {0} |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 20 | + cancel-in-progress: true |
| 21 | +jobs: |
| 22 | + # Test Conda package on brand new environments |
| 23 | + test: |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] |
| 28 | + env: |
| 29 | + - {os: ubuntu-22.04, json-image: '{"image": "ubuntu:20.04"}'} |
| 30 | + - {os: ubuntu-22.04, json-image: '{"image": null}'} |
| 31 | + - {os: ubuntu-24.04, json-image: '{"image": null}'} |
| 32 | + - {os: ubuntu-22.04, json-image: '{"image": "rockylinux:8"}'} |
| 33 | + - {os: ubuntu-22.04, json-image: '{"image": "rockylinux:9"}'} |
| 34 | + - {os: windows-2022, json-image: '{"image": null}'} |
| 35 | + - {os: windows-2025, json-image: '{"image": null}'} |
| 36 | + - {os: macos-14, json-image: '{"image": null}'} |
| 37 | + - {os: macos-15, json-image: '{"image": null}'} |
| 38 | + - {os: macos-15-intel, json-image: '{"image": null}'} |
| 39 | + runs-on: ${{ matrix.env.os }} |
| 40 | + container: ${{ fromJSON(matrix.env.json-image) }} |
| 41 | + steps: |
| 42 | + - name: Install Miniforge |
| 43 | + uses: conda-incubator/setup-miniconda@v3 |
| 44 | + with: |
| 45 | + miniforge-version: 24.11.0-0 |
| 46 | + python-version: ${{ matrix.python-version }} |
| 47 | + conda-remove-defaults: true |
| 48 | + - name: Install the Khiops Conda package |
| 49 | + run: | |
| 50 | + # Add the Conda `rc` label for alpha or RC pre-releases |
| 51 | + if [[ $(echo ${{ inputs.khiops-core-version }} | grep -E ".*(a|rc)\.[0-9]+") ]]; then |
| 52 | + RC_LABEL="conda-forge/label/rc::" |
| 53 | + else |
| 54 | + RC_LABEL="" |
| 55 | + fi |
| 56 | + conda install "${RC_LABEL}"khiops-core==${{ inputs.khiops-core-version }} |
| 57 | + conda install khiops==${{ inputs.khiops-python-version }} |
| 58 | + - name: Test Khiops Installation Status |
| 59 | + run: kh-status |
| 60 | + - name: Test Khiops Installation Status (Conda-Based Environments) |
| 61 | + run: | |
| 62 | + # Set `python` to the current Conda Python executable |
| 63 | + PYTHON="$(type -P python)" |
| 64 | +
|
| 65 | + # Remove $CONDA_PREFIX/bin from PATH |
| 66 | + PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g") |
| 67 | +
|
| 68 | + # Unset *CONDA* environment variables |
| 69 | + # As a corollary, CONDA_PREFIX is unset |
| 70 | + # Note: There is no way to remove these variables from GITHUB_ENV |
| 71 | + # (see https://github.com/actions/runner/issues/1126) |
| 72 | + for CONDA_VAR in $(env | grep CONDA) |
| 73 | + do |
| 74 | + unset $(echo $CONDA_VAR | cut -d '=' -f 1) |
| 75 | + done |
| 76 | +
|
| 77 | + # Note: kh-status is not reachable as it is not in PATH |
| 78 | + $PYTHON -c \ |
| 79 | + "import sys; import khiops.core as kh; return_code = kh.get_runner().print_status(); sys.exit(return_code)" |
| 80 | + - name: Download Sample Datasets |
| 81 | + run: | |
| 82 | + kh-download-datasets \ |
| 83 | + --version ${{ inputs.khiops-samples-version }} |
| 84 | + - name: Run Samples |
| 85 | + env: |
| 86 | + # Force > 2 CPU cores to launch mpiexec |
| 87 | + KHIOPS_PROC_NUMBER: 4 |
| 88 | + run: | |
| 89 | + kh-samples core -i deploy_model -e |
| 90 | + kh-samples core -i deploy_coclustering -e |
| 91 | + kh-samples core -i train_predictor_error_handling -e |
| 92 | + kh-samples sklearn -i khiops_classifier -e |
| 93 | + kh-samples sklearn -i khiops_coclustering -e |
| 94 | + - name: Run Samples (Conda-Based Environments) |
| 95 | + env: |
| 96 | + # Force > 2 CPU cores to launch mpiexec |
| 97 | + KHIOPS_PROC_NUMBER: 4 |
| 98 | + run: | |
| 99 | + # Set `python` to the current Conda Python executable |
| 100 | + PYTHON="$(type -P python)" |
| 101 | +
|
| 102 | + # Remove $CONDA_PREFIX/bin from PATH |
| 103 | + PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g") |
| 104 | +
|
| 105 | + # Unset *CONDA* environment variables |
| 106 | + # As a corollary, CONDA_PREFIX is unset |
| 107 | + # Note: There is no way to remove these variables from GITHUB_ENV |
| 108 | + # (see https://github.com/actions/runner/issues/1126) |
| 109 | + for CONDA_VAR in $(env | grep CONDA) |
| 110 | + do |
| 111 | + unset $(echo $CONDA_VAR | cut -d '=' -f 1) |
| 112 | + done |
| 113 | +
|
| 114 | + # Run samples |
| 115 | + # Note: kh-samples is not reachable as it is not in PATH |
| 116 | + $PYTHON -m khiops.samples.samples -i deploy_model -e |
| 117 | + $PYTHON -m khiops.samples.samples -i deploy_coclustering -e |
| 118 | + $PYTHON -m khiops.samples.samples -i train_predictor_error_handling -e |
| 119 | + $PYTHON -m khiops.samples.samples_sklearn -i khiops_classifier -e |
| 120 | + $PYTHON -m khiops.samples.samples_sklearn -i khiops_coclustering -e |
| 121 | + # Checkout the sources to obtain the tests |
| 122 | + # Note: The `sparse-checkout` option of this action is bugged so we checkout all the sources |
| 123 | + # See https://github.com/actions/checkout/issues/1628 |
| 124 | + - name: Checkout Sources |
| 125 | + uses: actions/checkout@v4 |
| 126 | + with: |
| 127 | + fetch-depth: 1 |
| 128 | + # This is needed so python does not retrieve the khiops module from PWD |
| 129 | + - name: Remove the khiops Module from the Sources |
| 130 | + run: rm -rf khiops |
| 131 | + - name: Install the Test Requirements |
| 132 | + run: conda install -y --file test-requirements.txt |
| 133 | + - name: Run the Runner Initialization Integration Test |
| 134 | + run: | |
| 135 | + python -m unittest -v \ |
| 136 | + tests.test_khiops_integrations.KhiopsRunnerEnvironmentTests.test_runner_environment_initialization |
| 137 | + - name: Run the Runner Initialization Integration Test (Conda-Based Environments) |
| 138 | + run: |- |
| 139 | + # Set `python` to the current Conda Python executable |
| 140 | + PYTHON="$(type -P python)" |
| 141 | +
|
| 142 | + # Remove $CONDA_PREFIX/bin from PATH |
| 143 | + PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g") |
| 144 | +
|
| 145 | + # Unset *CONDA* environment variables |
| 146 | + # As a corolary, CONDA_PREFIX is unset |
| 147 | + # Note: There is no way to remove these variables from GITHUB_ENV |
| 148 | + # (see https://github.com/actions/runner/issues/1126) |
| 149 | + for CONDA_VAR in $(env | grep CONDA) |
| 150 | + do |
| 151 | + unset $(echo $CONDA_VAR | cut -d '=' -f 1) |
| 152 | + done |
| 153 | +
|
| 154 | + # Execute the runner initialization integration test |
| 155 | + $PYTHON -m unittest -v \ |
| 156 | + tests.test_khiops_integrations.KhiopsRunnerEnvironmentTests.test_runner_environment_initialization |
0 commit comments