Skip to content

Update copyright

Update copyright #439

Workflow file for this run

---
name: Conda Package
env:
# Note: The default Khiops version must never be an alpha release as they are
# ephemeral. To test alpha versions run the workflow manually.
DEFAULT_KHIOPS_CORE_VERSION: 10.2.4
DEFAULT_SAMPLES_VERSION: 10.2.4
on:
workflow_dispatch:
inputs:
khiops-core-version:
default: 10.2.4
description: khiops-core version for testing
khiops-samples-version:
default: 10.2.4
description: khiops-samples version
release-channel:
type: choice
default: khiops-dev
options: [khiops-dev, khiops]
description: Anaconda channel to release
push:
tags: ['*']
pull_request:
paths:
- setup.py
- setup.cfg
- pyproject.toml
- LICENSE.md
- versioneer.py
- khiops/_version.py
- packaging/conda/**,
- '!packaging/conda/README.md'
- .github/workflows/conda.yml
defaults:
run:
shell: bash -el {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout Sources
uses: actions/checkout@v4
with:
# Checkout the full repository to have the tags so versioneer works properly
# See issue https://github.com/actions/checkout/issues/701
fetch-depth: 0
- name: Install Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
python-version: '3.12'
conda-remove-defaults: true
- name: Install Dependency Requirements for Building Conda Packages
run: conda install -y conda-build
- name: Build the Conda Package
# Note: The "khiops-dev" conda channel is needed to retrieve the "khiops-core" package.
# The "test" part of the conda recipe needs this package.
run: |
conda build --channel khiops-dev --output-folder ./khiops-conda ./packaging/conda
- name: Upload Conda Package Artifact
uses: actions/upload-artifact@v4
with:
name: khiops-conda
path: ./khiops-conda
retention-days: 7
# Test Conda package on brand new environments
test:
needs: build
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
env:
- {os: ubuntu-20.04, json-image: '{"image": null}'}
- {os: ubuntu-22.04, json-image: '{"image": null}'}
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux:8"}'}
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux:9"}'}
- {os: windows-2019, json-image: '{"image": null}'}
- {os: windows-2022, json-image: '{"image": null}'}
- {os: macos-13, json-image: '{"image": null}'}
- {os: macos-14, json-image: '{"image": null}'}
- {os: macos-15, json-image: '{"image": null}'}
runs-on: ${{ matrix.env.os }}
container: ${{ fromJSON(matrix.env.json-image) }}
steps:
- name: Install Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest # needed for macOS 13
python-version: ${{ matrix.python-version }}
conda-remove-defaults: true
- name: Download Conda Package Artifact
uses: actions/download-artifact@v4
with:
name: khiops-conda
path: ./khiops-conda
- name: Put the khiops-core Version in the Environment
run: |
KHIOPS_CORE_VERSION="${{ inputs.khiops-core-version || env.DEFAULT_KHIOPS_CORE_VERSION }}"
echo "KHIOPS_CORE_VERSION=$KHIOPS_CORE_VERSION" >> "$GITHUB_ENV"
- name: Install the Khiops Conda package
run: |
conda install --channel khiops-dev khiops-core=$KHIOPS_CORE_VERSION
conda install --channel ./khiops-conda/ khiops
- 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 corrolary, 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 khiops.core as kh; kh.get_runner().print_status()"
- name: Download Sample Datasets
run: |
kh-download-datasets \
--version ${{ inputs.khiops-samples-version || env.DEFAULT_SAMPLES_VERSION }}
- name: Test Conda Package on Samples
env:
# Force > 2 CPU cores to launch mpiexec
KHIOPS_PROC_NUMBER: 4
run: |
kh-samples core -i train_predictor -e
kh-samples core -i train_predictor_error_handling -e
kh-samples core -i train_coclustering -e
kh-samples sklearn -i khiops_classifier -e
kh-samples sklearn -i khiops_coclustering -e
- name: Test Conda Package on Some Samples (Conda-Based Environments)
env:
# Force > 2 CPU cores to launch mpiexec
KHIOPS_PROC_NUMBER: 4
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 corrolary, 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 some Khiops and Khiops Coclustering 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
# Release is only executed on tags
# Note: For this job to work the secrets variables KHIOPS_ANACONDA_CHANNEL_TOKEN and
# KHIOPS_DEV_ANACONDA_CHANNEL_TOKEN must be set with valid anaconda.org access tokens
release:
if: github.ref_type == 'tag'
needs: test
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
# See the upload-artifact step in the build job for the explanation of this pattern
name: khiops-conda
path: ./khiops-conda
- name: Install Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
python-version: '3.12'
conda-remove-defaults: true
- name: Install Requirement Packages
run: conda install -y anaconda-client conda-index
- name: Reindex the package directory
run: python -m conda_index ./khiops-conda
- name: Upload the Package to anaconda.org
run: |-
# Set the anaconda.org channel
ANACONDA_CHANNEL="${{ inputs.release-channel || 'khiops-dev' }}"
# For the release channel: upload without forcing
if [[ "$ANACONDA_CHANNEL" == "khiops" ]]
then
anaconda --token "${{ secrets.KHIOPS_ANACONDA_CHANNEL_TOKEN }}" upload \
--user "$ANACONDA_CHANNEL" ./khiops-conda/noarch/*.tar.bz2
# For the dev channel: upload with forcing
else
anaconda --token "${{ secrets.KHIOPS_DEV_ANACONDA_CHANNEL_TOKEN }}" upload \
--user "$ANACONDA_CHANNEL" --force ./khiops-conda/noarch/*.tar.bz2
fi