Skip to content

Commit 19c4a04

Browse files
authored
Merge pull request #223 from KhiopsML/189-use-conda-forge-to-build-package
Use conda forge to build package
2 parents c2cb69d + f08ca7e commit 19c4a04

File tree

7 files changed

+70
-69
lines changed

7 files changed

+70
-69
lines changed

.github/workflows/api-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
# because the `env` context is only accessible at the step level;
4040
# hence, it is hard-coded
4141
image: |-
42-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '10.2.3-b.4.with_native_10.2.3-b.4' }}
42+
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '10.2.3-b.4.with_conda-forge_10.2.3-b.4' }}
4343
# Use the 'runner' user (1001) from github so checkout actions work properly
4444
# https://github.com/actions/runner/issues/2033#issuecomment-1598547465
4545
options: --user 1001

.github/workflows/conda.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
workflow_dispatch:
1010
inputs:
1111
khiops-core-version:
12-
default: 10.2.2
12+
default: 10.2.3b.4
1313
description: khiops-core version for testing
1414
khiops-samples-version:
1515
default: 10.2.0
@@ -39,19 +39,18 @@ jobs:
3939
# Checkout the full repository to have the tags so versioneer works properly
4040
# See issue https://github.com/actions/checkout/issues/701
4141
fetch-depth: 0
42-
- name: Install Miniconda
42+
- name: Install Miniforge
4343
uses: conda-incubator/setup-miniconda@v3
4444
with:
45-
miniconda-version: latest
45+
miniforge-version: latest
4646
python-version: '3.12'
4747
- name: Install Dependency Requirements for Building Conda Packages
4848
run: conda install -y conda-build
4949
- name: Build the Conda Package
5050
# Note: The "khiops-dev" conda channel is needed to retrieve the "khiops-core" package.
5151
# The "test" part of the conda recipe needs this package.
5252
run: |
53-
conda build --channel conda-forge --channel khiops-dev \
54-
--output-folder ./khiops-conda ./packaging/conda
53+
conda build --channel khiops-dev --output-folder ./khiops-conda ./packaging/conda
5554
- name: Upload Conda Package Artifact
5655
uses: actions/upload-artifact@v4
5756
with:
@@ -78,10 +77,10 @@ jobs:
7877
runs-on: ${{ matrix.env.os }}
7978
container: ${{ fromJSON(matrix.env.json-image) }}
8079
steps:
81-
- name: Install Miniconda
80+
- name: Install Miniforge
8281
uses: conda-incubator/setup-miniconda@v3
8382
with:
84-
miniconda-version: latest # needed for macOS 13
83+
miniforge-version: latest # needed for macOS 13
8584
python-version: ${{ matrix.python-version }}
8685
- name: Download Conda Package Artifact
8786
uses: actions/download-artifact@v4
@@ -92,16 +91,9 @@ jobs:
9291
run: |
9392
KHIOPS_CORE_VERSION="${{ inputs.khiops-core-version || env.DEFAULT_KHIOPS_CORE_VERSION }}"
9493
echo "KHIOPS_CORE_VERSION=$KHIOPS_CORE_VERSION" >> "$GITHUB_ENV"
95-
- name: Install the Khiops Conda package (Windows)
96-
if: runner.os == 'Windows'
94+
- name: Install the Khiops Conda package
9795
run: |
98-
conda install --channel conda-forge --channel khiops-dev khiops-core=$KHIOPS_CORE_VERSION
99-
conda install --override-channels --channel conda-forge --channel ./khiops-conda/ khiops
100-
# In Linux/macOS we need the conda-forge channel to install their pinned versions
101-
- name: Install the Khiops Conda package (Linux/macOS)
102-
if: runner.os != 'Windows'
103-
run: |
104-
conda install --channel conda-forge --channel khiops-dev khiops-core=$KHIOPS_CORE_VERSION
96+
conda install --channel khiops-dev khiops-core=$KHIOPS_CORE_VERSION
10597
conda install --channel ./khiops-conda/ khiops
10698
- name: Test Khiops Installation Status
10799
run: kh-status
@@ -135,10 +127,10 @@ jobs:
135127
# See the upload-artifact step in the build job for the explanation of this pattern
136128
name: khiops-conda
137129
path: ./khiops-conda
138-
- name: Install Miniconda
130+
- name: Install Miniforge
139131
uses: conda-incubator/setup-miniconda@v3
140132
with:
141-
miniconda-version: latest
133+
miniforge-version: latest
142134
python-version: '3.12'
143135
- name: Install Requirement Packages
144136
run: conda install -y anaconda-client conda-index

.github/workflows/dev-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Dev Docker
33
env:
4-
DEFAULT_KHIOPS_REVISION: 10.2.2
4+
DEFAULT_KHIOPS_REVISION: 10.2.3-b.4
55
DEFAULT_IMAGE_INCREMENT: 0
66
DEFAULT_SERVER_REVISION: main
77
DEFAULT_PYTHON_VERSIONS: 3.8 3.9 3.10 3.11 3.12
@@ -12,7 +12,7 @@ on:
1212
inputs:
1313
khiops-revision:
1414
type: string
15-
default: main
15+
default: 10.2.3-b.4
1616
description: Khiops Revision
1717
image-increment:
1818
type: number

.github/workflows/pip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
# because the `env` context is only accessible at the step level;
5757
# hence, it is hard-coded
5858
image: |-
59-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '10.2.3-b.4.with_native_10.2.3-b.4' }}
59+
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '10.2.3-b.4.with_conda-forge_10.2.3-b.4' }}
6060
steps:
6161
- name: Set parameters as env
6262
run: |

.github/workflows/unit-tests.yml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Unit Tests
33
env:
44
DEFAULT_SAMPLES_REVISION: main
5-
DEFAULT_KHIOPS_DESKTOP_REVISION: 10.2.3-b.3
5+
DEFAULT_KHIOPS_DESKTOP_REVISION: 10.2.3-b.4
66
on:
77
workflow_dispatch:
88
inputs:
@@ -13,7 +13,7 @@ on:
1313
default: latest
1414
description: Development Docker Image Tag
1515
khiops-desktop-revision:
16-
default: 10.2.3-b.3
16+
default: 10.2.3-b.4
1717
description: Khiops Windows Desktop Application Version
1818
run-long-tests:
1919
type: boolean
@@ -36,7 +36,7 @@ jobs:
3636
# because the `env` context is only accessible at the step level;
3737
# hence, it is hard-coded
3838
image: |-
39-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '10.2.3-b.4.with_native_10.2.3-b.4' }}
39+
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '10.2.3-b.4.with_conda-forge_10.2.3-b.4' }}
4040
credentials:
4141
username: ${{ github.actor }}
4242
password: ${{ secrets.GITHUB_TOKEN }}
@@ -70,29 +70,36 @@ jobs:
7070
- name: Setup and Install Test Requirements
7171
if: success() || failure()
7272
run: |
73-
mkdir -p -m u+rwx reports/py${{ matrix.python-version }}
74-
mkdir -p -m u+rwx reports/py${{ matrix.python-version }}_conda
75-
# install within the conda environments without activating them
76-
# Native Khiops-based Conda environment
77-
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }} -c conda-forge unittest-xml-reporting
78-
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }} --file test-requirements.txt
73+
CONDA="/root/miniforge3/bin/conda"
74+
75+
# Native Khiops-based Conda environment, and
7976
# `khiops-core`-based Conda environment
80-
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }}_conda -c conda-forge unittest-xml-reporting
81-
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }}_conda --file test-requirements.txt
77+
CONDA_ENVS="py${{ matrix.python-version }} py${{ matrix.python-version }}_conda"
78+
for CONDA_ENV in $CONDA_ENVS
79+
do
80+
mkdir -p -m u+rwx reports/"$CONDA_ENV"
81+
82+
# install within the conda environments without activating them
83+
$CONDA install -y -n "$CONDA_ENV" unittest-xml-reporting
84+
$CONDA install -y -n "$CONDA_ENV" --file test-requirements.txt
85+
done
8286
- name: Install khiops-python dependencies
8387
if: success() || failure()
8488
run: |
8589
# The following git command is required,
8690
# as the Git repository is in a directory the current user does not own,
8791
# Python versioneer fails to compute the current version correctly otherwise
88-
git config --global --add safe.directory $(realpath .)
89-
# Native Khiops-based Conda environment
90-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} python setup.py egg_info
91-
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }} `grep -v "^\[" khiops.egg-info/requires.txt`
92+
git config --global --add safe.directory $(realpath .)
93+
CONDA="/root/miniforge3/bin/conda"
94+
# Native Khiops-based Conda environment, and
9295
# `khiops-core`-based Conda environment
93-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda python setup.py egg_info
94-
/root/miniconda3/bin/conda install -y -n py${{ matrix.python-version }}_conda `grep -v "^\[" khiops.egg-info/requires.txt`
95-
rm -rf khiops.egg-info
96+
CONDA_ENVS="py${{ matrix.python-version }} py${{ matrix.python-version }}_conda"
97+
for CONDA_ENV in $CONDA_ENVS
98+
do
99+
$CONDA run --no-capture-output -n "$CONDA_ENV" python setup.py egg_info
100+
$CONDA install -y -n "$CONDA_ENV" `grep -v "^\[" khiops.egg-info/requires.txt`
101+
rm -rf khiops.egg-info
102+
done
96103
- name: Prepare Unit Tests Environment
97104
if: github.ref != 'dev' && github.ref != 'main' && ! inputs.run-long-tests
98105
run: echo "UNITTEST_ONLY_SHORT_TESTS=true" >> "$GITHUB_ENV"
@@ -113,14 +120,16 @@ jobs:
113120
# This is needed so that the Git tag is parsed and the khiops-python
114121
# version is retrieved
115122
git config --global --add safe.directory $(realpath .)
116-
# Native Khiops-based Conda environments
117-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} coverage run -m xmlrunner -o "reports/py${{ matrix.python-version }}" -v
118-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} coverage report -m
119-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }} coverage xml -o "reports/py${{ matrix.python-version }}/py-coverage.xml"
120-
# `khiops-core`-based Conda environments
121-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda coverage run -m xmlrunner -o "reports/py${{ matrix.python-version }}_conda" -v
122-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda coverage report -m
123-
/root/miniconda3/bin/conda run --no-capture-output -n py${{ matrix.python-version }}_conda coverage xml -o "reports/py${{ matrix.python-version }}_conda/py-coverage.xml"
123+
CONDA="/root/miniforge3/bin/conda"
124+
# Native Khiops-based Conda environment, and
125+
# `khiops-core`-based Conda environment
126+
CONDA_ENVS="py${{ matrix.python-version }} py${{ matrix.python-version }}_conda"
127+
for CONDA_ENV in $CONDA_ENVS
128+
do
129+
$CONDA run --no-capture-output -n "$CONDA_ENV" coverage run -m xmlrunner -o "reports/py${{ matrix.python-version }}" -v
130+
$CONDA run --no-capture-output -n "$CONDA_ENV" coverage report -m
131+
$CONDA run --no-capture-output -n "$CONDA_ENV" coverage xml -o "reports/$CONDA_ENV/py-coverage.xml"
132+
done
124133
- name: Display Unit Test Reports
125134
uses: dorny/test-reporter@v1
126135
with:
@@ -217,7 +226,7 @@ jobs:
217226
# because the `env` context is only accessible at the step level;
218227
# hence, it is hard-coded
219228
image: |-
220-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '10.2.3-b.4.with_native_10.2.3-b.4' }}
229+
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '10.2.3-b.4.with_conda-forge_10.2.3-b.4' }}
221230
credentials:
222231
username: ${{ github.actor }}
223232
password: ${{ secrets.GITHUB_TOKEN }}

packaging/docker/khiopspydev/Dockerfile.rocky

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LABEL description="Container for the development of khiops-python"
88
# Reuse KHIOPSDEV_OS from previous stage
99
ARG KHIOPSDEV_OS
1010
ARG KHIOPS_REVISION
11-
# - Install dev tools and miniconda3 (for the unit tests)
11+
# - Install dev tools and miniforge (for the unit tests)
1212
# - Build and install Khiops
1313
# - Set mpich as the default MPI
1414
RUN true \
@@ -55,12 +55,12 @@ RUN true \
5555
alternatives --install /usr/bin/python python /usr/bin/python3 1 \
5656
&& alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 ; \
5757
fi \
58-
# Install miniconda3 to have multiple Python versions via Conda \
59-
&& mkdir -p /root/miniconda3 && cd /root/miniconda3 \
60-
&& wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.1.2-0-Linux-x86_64.sh -O ./Miniconda3-py312_24.1.2-0-Linux-x86_64.sh \
61-
&& echo "b978856ec3c826eb495b60e3fffe621f670c101150ebcbdeede4f961f22dc438 Miniconda3-py312_24.1.2-0-Linux-x86_64.sh" | sha256sum --check \
62-
&& bash ./Miniconda3-py312_24.1.2-0-Linux-x86_64.sh -b -u -p /root/miniconda3 \
63-
&& rm -rf /root/miniconda3/Miniconda3-py312_24.1.2-0-Linux-x86_64.sh \
58+
# Install miniforge to have multiple Python versions via Conda \
59+
&& mkdir -p /root/miniforge3 && cd /root/miniforge3 \
60+
&& wget https://github.com/conda-forge/miniforge/releases/download/24.1.2-0/Miniforge3-24.1.2-0-Linux-x86_64.sh -O ./Miniforge3_24.1.2-0-Linux-x86_64.sh \
61+
&& echo "dbadb808edf4da00af35d888d3eeebbfdce71972b60bf4b16dbacaee2ab57f28 Miniforge3_24.1.2-0-Linux-x86_64.sh" | sha256sum --check \
62+
&& bash ./Miniforge3_24.1.2-0-Linux-x86_64.sh -b -u -p /root/miniforge3 \
63+
&& rm -rf /root/miniforge3/Miniforge3_24.1.2-0-Linux-x86_64.sh \
6464
# Clean build files \
6565
&& dnf clean all \
6666
&& rm -rf ./khiops \
@@ -71,9 +71,9 @@ RUN true \
7171
ARG PYTHON_VERSIONS
7272
RUN /bin/bash -c 'for version in ${PYTHON_VERSIONS}; \
7373
do \
74-
/root/miniconda3/bin/conda create -y -n py${version} python=${version}; \
75-
/root/miniconda3/bin/conda create -y -n py${version}_conda python=${version}; \
76-
/root/miniconda3/bin/conda install -y -n py${version}_conda -c conda-forge -c khiops-dev khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
74+
/root/miniforge3/bin/conda create -y -n py${version} python=${version}; \
75+
/root/miniforge3/bin/conda create -y -n py${version}_conda python=${version}; \
76+
/root/miniforge3/bin/conda install -y -n py${version}_conda -c khiops-dev khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
7777
done'
7878

7979
RUN mkdir -p /scripts

packaging/docker/khiopspydev/Dockerfile.ubuntu

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM ghcr.io/khiopsml/khiops/khiopsdev-${KHIOPSDEV_OS}:latest AS khiopsdev
55
LABEL maintainer="[email protected]"
66
LABEL description="Container for the development of khiops-python"
77

8-
# Install dev tools and miniconda3 (for the unit tests); build and install Khiops
8+
# Install dev tools and miniforge (for the unit tests); build and install Khiops
99
ARG KHIOPS_REVISION
1010
RUN true \
1111
# Install git (for khiops-python version calculation) and pip \
@@ -22,12 +22,12 @@ RUN true \
2222
&& rm -f KHIOPS_CORE.deb \
2323
# Set python to python3 \
2424
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
25-
# Install miniconda3 to have multiple Python versions via Conda \
26-
&& mkdir -p /root/miniconda3 && cd /root/miniconda3 \
27-
&& wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.1.2-0-Linux-x86_64.sh -O ./Miniconda3-py312_24.1.2-0-Linux-x86_64.sh \
28-
&& echo "b978856ec3c826eb495b60e3fffe621f670c101150ebcbdeede4f961f22dc438 Miniconda3-py312_24.1.2-0-Linux-x86_64.sh" | sha256sum --check \
29-
&& bash ./Miniconda3-py312_24.1.2-0-Linux-x86_64.sh -b -u -p /root/miniconda3 \
30-
&& rm -rf /root/miniconda3/Miniconda3-py312_24.1.2-0-Linux-x86_64.sh \
25+
# Install miniforge to have multiple Python versions via Conda \
26+
&& mkdir -p /root/miniforge3 && cd /root/miniforge3 \
27+
&& wget https://github.com/conda-forge/miniforge/releases/download/24.1.2-0/Miniforge3-24.1.2-0-Linux-x86_64.sh -O ./Miniforge3_24.1.2-0-Linux-x86_64.sh \
28+
&& echo "dbadb808edf4da00af35d888d3eeebbfdce71972b60bf4b16dbacaee2ab57f28 Miniforge3_24.1.2-0-Linux-x86_64.sh" | sha256sum --check \
29+
&& bash ./Miniforge3_24.1.2-0-Linux-x86_64.sh -b -u -p /root/miniforge3 \
30+
&& rm -rf /root/miniforge3/Miniforge3_24.1.2-0-Linux-x86_64.sh \
3131
# Make sure that MPI is openmpi \
3232
&& update-alternatives --set mpirun /usr/bin/mpirun.openmpi \
3333
# Clean build files \
@@ -41,9 +41,9 @@ RUN true \
4141
ARG PYTHON_VERSIONS
4242
RUN /bin/bash -c 'for version in ${PYTHON_VERSIONS}; \
4343
do \
44-
/root/miniconda3/bin/conda create -y -n py${version} python=${version}; \
45-
/root/miniconda3/bin/conda create -y -n py${version}_conda python=${version}; \
46-
/root/miniconda3/bin/conda install -y -n py${version}_conda -c conda-forge -c khiops-dev khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
44+
/root/miniforge3/bin/conda create -y -n py${version} python=${version}; \
45+
/root/miniforge3/bin/conda create -y -n py${version}_conda python=${version}; \
46+
/root/miniforge3/bin/conda install -y -n py${version}_conda -c khiops-dev khiops-core=$(echo ${KHIOPS_REVISION} | tr -d "-") ; \
4747
done'
4848

4949
RUN mkdir -p /scripts

0 commit comments

Comments
 (0)