Skip to content

Commit

Permalink
Merge pull request #74 from KhiopsML/7-build-nsis-khiops-nocode-insta…
Browse files Browse the repository at this point in the history
…ller-in-the-ci

7 build nsis khiops nocode installer in the ci
  • Loading branch information
folmos-at-orange authored Nov 23, 2023
2 parents 37564a2 + 8b25cdc commit c3c41e3
Show file tree
Hide file tree
Showing 54 changed files with 2,090 additions and 537 deletions.
72 changes: 72 additions & 0 deletions .github/actions/test-khiops-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: Test Khiops Installation
description: Tests a Khiops installation on the Iris dataset
runs:
using: composite
steps:
# Python install: we don't use the setup-python action because of the following error:
# python3: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by python3)
- name: Python setup for Linux
if: runner.os == 'Linux'
shell: bash
run: |
if [ -d "/etc/apt" ]
then
apt-get install -y python3 > /dev/null
else
yum install -y python3.11
fi
echo "PYTHON=python3" >> "$GITHUB_ENV"
- name: Python setup for Windows or macOS
if: runner.os == 'Windows' || runner.os == 'macOS'
shell: bash
run: echo "PYTHON=python" >> "$GITHUB_ENV"
- name: Set the name for the khiops laucher script
shell: bash
run: |
if [[ $RUNNER_OS == "Windows" ]]
then
# Put the full path in windows since bash doesn't find ".cmd" files
# in the path even if they are there
modl_path=$(which MODL)
khiops_bin_dir=$(dirname "$modl_path")
KHIOPS_SCRIPT="$khiops_bin_dir/khiops.cmd"
KHIOPS_CC_SCRIPT="$khiops_bin_dir/khiops_coclustering.cmd"
echo "KHIOPS_SCRIPT=$KHIOPS_SCRIPT" >> "$GITHUB_ENV"
echo "KHIOPS_CC_SCRIPT=$KHIOPS_CC_SCRIPT" >> "$GITHUB_ENV"
else
echo "KHIOPS_SCRIPT=khiops" >> "$GITHUB_ENV"
echo "KHIOPS_CC_SCRIPT=khiops_coclustering" >> "$GITHUB_ENV"
fi
- name: Check Khiops installation
shell: bash
run: |
"$KHIOPS_SCRIPT" -v
"$KHIOPS_CC_SCRIPT" -v
- name: Run Khiops tests
shell: bash
run: |
cd test/LearningTest/TestKhiops/Standard/Iris/
"$KHIOPS_SCRIPT" -b -i test.prm -e results/err.txt
cd -
- name: Run Khiops Coclustering tests
shell: bash
run: |
cd test/LearningTest/TestCoclustering/Standard/Iris/
"$KHIOPS_CC_SCRIPT" -b -i test.prm -e results/err.txt
cd -
- name: Check the test results
shell: bash
run: |-
touch test/LearningTest/TestCoclustering/Standard/Iris/results/time.log
touch test/LearningTest/TestKhiops/Standard/Iris/results/time.log
echo "Check test results"
cd test/LearningTest/cmd/python/
$PYTHON test_khiops.py Khiops nul Standard
$PYTHON test_khiops.py Coclustering nul Standard
$PYTHON apply_command.py errors ../../TestKhiops/Standard/ Iris | tee /tmp/khiops-log.txt
$PYTHON apply_command.py errors ../../TestCoclustering/Standard/ Iris | tee /tmp/coclustering-log.txt
if (grep -q error /tmp/khiops-log.txt || grep -q error /tmp/coclustering-log.txt); then
echo "::error::Errors in Khiops run"
false
fi
51 changes: 0 additions & 51 deletions .github/actions/test-khiops/action.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Build development containers
name: Build Linux containers for packaging
on:
workflow_dispatch:
jobs:
build-container:
build-packaging-container:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -24,13 +24,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the image and push it to the registry
id: docker-build
uses: docker/build-push-action@v2
with:
# relative path to the place where source code with Dockerfile is located
context: ./packaging/dockerfiles
file: ./packaging/dockerfiles/Dockerfile.${{ matrix.os }}
# Note: tags must be lower-case
file: ./packaging/dockerfiles/linux/Dockerfile.${{ matrix.os }}
tags: ghcr.io/khiopsml/khiops/khiopsdev-${{ matrix.os }}:latest
push: true
- name: Display the image digest
run: echo ${{ steps.docker_build.outputs.digest }}
run: echo ${{ steps.docker-build.outputs.digest }}
8 changes: 5 additions & 3 deletions .github/workflows/pack-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name: Create Debian package
on:
workflow_dispatch:
pull_request:
paths: ['**CMakeLists.txt', '**.cmake']
jobs:
build-deb-package:
runs-on: ubuntu-latest
Expand All @@ -24,7 +26,7 @@ jobs:
echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV"
- name: Configure CMake
run: |
cmake --preset linux-gcc-release -DTESTING=OFF
cmake --preset linux-gcc-release -DBUILD_JARS=ON
- name: Build Khiops binaries
run: |
cmake --build --preset linux-gcc-release --parallel \
Expand Down Expand Up @@ -90,8 +92,8 @@ jobs:
run: |
khiops -v
khiops_coclustering -v
- name: Test Khiops and Khiops Coclustering
uses: ./.github/actions/test-khiops
- name: Test Khiops installation
uses: ./.github/actions/test-khiops-install
test-kni-deb:
needs: build-deb-package
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pack-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
with:
preset-name: ${{env.PRESET_NAME}}
targets: MODL MODL_Coclustering KhiopsNativeInterface
override-flags: -DBUILD_JARS=OFF -DTESTING=OFF
- name: Build package with CPack
run: cd build/${{env.PRESET_NAME}} && cpack -G ZIP
- name: Upload artifacts
Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/pack-nsis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
name: Build NSIS Windows installer
on:
workflow_dispatch:
pull_request:
paths:
- '**CMakeLists.txt'
- packaging/windows/nsis/*.nsh
- packaging/windows/nsis/*.nsi
push:
tags: [v*]
jobs:
build-nsis-installer:
outputs:
khiops-package-version: ${{ steps.get-version.outputs.khiops-package-version }}
name: Build NSIS Windows installer
runs-on: windows-latest
steps:
- name: Obtain checkout ref
shell: bash
run: |
# We take the "pull request head" ref (by default it is a merged one)
if [[ "${{ github.event_name }}" == "pull_request" ]]
then
CHECKOUT_REF="${{ github.event.pull_request.head.sha }}"
# Otherwise the default checkout action ref
else
CHECKOUT_REF="${{ github.ref_name }}"
fi
echo "CHECKOUT_REF=$CHECKOUT_REF" >> $GITHUB_ENV
echo "Checkout ref: $CHECKOUT_REF"
- name: Checkout sources
uses: actions/[email protected]
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Put the package version on the environment and output
id: get-version
shell: bash
run: |
# Build the versions
KHIOPS_PACKAGE_VERSION="$(./scripts/khiops-package-version ${{ env.CHECKOUT_REF }})"
KHIOPS_PACKAGE_REDUCED_VERSION="$(echo $KHIOPS_PACKAGE_VERSION | cut -d'-' -f1)"
echo "KHIOPS_PACKAGE_VERSION=$KHIOPS_PACKAGE_VERSION" >> "$GITHUB_ENV"
echo "KHIOPS_PACKAGE_REDUCED_VERSION=$KHIOPS_PACKAGE_REDUCED_VERSION" >> "$GITHUB_ENV"
echo "khiops-package-version=$KHIOPS_PACKAGE_VERSION" >> "$GITHUB_OUTPUT"
- name: Download Windows install assets
uses: robinraju/[email protected]
with:
repository: khiopsml/khiops-win-install-assets
latest: true
- name: Extract Windows installer assets and load assets-info.env
shell: bash
run: |
assets_tar_gz=$(ls khiops-win-install-assets*.tar.gz)
tar -zxvf "$assets_tar_gz"
cat assets/assets-info.env >> "$GITHUB_ENV"
- name: Build Khiops binaries
uses: ./.github/actions/build-khiops
with:
preset-name: windows-msvc-release
targets: MODL MODL_Coclustering norm_jar khiops_jar
override-flags: -DTESTING=OFF -DBUILD_JARS=ON
- name: Build NSIS package
shell: pwsh
run: |-
cd ./packaging/windows/nsis
makensis `
/DKHIOPS_VERSION=${{ env.KHIOPS_PACKAGE_VERSION }} `
/DKHIOPS_REDUCED_VERSION=${{ env.KHIOPS_PACKAGE_REDUCED_VERSION }} `
/DKHIOPS_WINDOWS_BUILD_DIR=..\..\..\build\windows-msvc-release `
/DJRE_INSTALLER_PATH=..\..\..\assets\${{ env.JRE_FILENAME }} `
/DJRE_VERSION=${{ env.JRE_VERSION }} `
/DMSMPI_INSTALLER_PATH=..\..\..\assets\${{ env.MSMPI_FILENAME }} `
/DMSMPI_VERSION=${{ env.MSMPI_VERSION }} `
/DKHIOPS_VIZ_INSTALLER_PATH=..\..\..\assets\${{ env.KHIOPS_VIZ_FILENAME }} `
/DKHIOPS_COVIZ_INSTALLER_PATH=..\..\..\assets\${{ env.KHIOPS_COVIZ_FILENAME }} `
/DKHIOPS_SAMPLES_DIR=..\..\..\assets\samples `
/DKHIOPS_DOC_DIR=..\..\..\assets\doc `
khiops.nsi
- name: Upload installer as an artifact
uses: actions/[email protected]
with:
name: khiops-installer
path: ./packaging/windows/nsis/khiops-${{ env.KHIOPS_PACKAGE_VERSION }}-setup.exe
test-nsis-installer:
name: Test NSIS Windows installer
needs: build-nsis-installer
runs-on: windows-2019
steps:
- name: Download NSIS installer artifact
uses: actions/[email protected]
with:
name: khiops-installer
- name: Install Khiops
shell: pwsh
run: |
# Execute the installer
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
Start-Process `
-FilePath .\khiops-${{ needs.build-nsis-installer.outputs.khiops-package-version }}-setup.exe `
-ArgumentList '/S' `
-Wait
# Add Khiops and MPI to the path
$Env:Path += ";${Env:ProgramFiles}\khiops\bin;${Env:ProgramFiles}\Microsoft MPI\Bin"
echo "PATH=${Env:PATH}" >> ${Env:GITHUB_ENV}
echo ${Env:GITHUB_ENV}
type ${Env:GITHUB_ENV}
- name: Checkout the khiops sources
uses: actions/checkout@v3
- name: Test the installation
uses: ./.github/actions/test-khiops-install
14 changes: 8 additions & 6 deletions .github/workflows/pack-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name: Create RPM package
on:
workflow_dispatch:
pull_request:
paths: ['**CMakeLists.txt', '**.cmake']
jobs:
build-rpm-package:
runs-on: ubuntu-latest
Expand All @@ -28,7 +30,7 @@ jobs:
source /etc/profile.d/modules.sh
module load mpi/mpich-x86_64
echo "MPI_SUFFIX=$MPI_SUFFIX" >> "$GITHUB_ENV"
cmake --preset linux-gcc-release -DTESTING=OFF
cmake --preset linux-gcc-release -DBUILD_JARS=ON
- name: Build Khiops binaries
run: |
cmake --build --preset linux-gcc-release --parallel \
Expand Down Expand Up @@ -88,8 +90,8 @@ jobs:
- name: Install Khiops Desktop (with java)
run: |
yum install -y ./artifacts/khiops-*
- name: Test Khiops and Khiops Coclustering
uses: ./.github/actions/test-khiops
- name: Test Khiops installation
uses: ./.github/actions/test-khiops-install
test-kni-rpm:
needs: build-rpm-package
runs-on: ubuntu-latest
Expand All @@ -105,7 +107,7 @@ jobs:
steps:
- name: Put OS info on the environment
run: |
source /etc/os-release
source /etc/os-release
echo "ID=$ID" >> "$GITHUB_ENV"
VERSION=$(echo $PLATFORM_ID | cut -d":" -f2)
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
Expand All @@ -117,10 +119,10 @@ jobs:
- name: Install KNI package
run: |
yum update -y
yum install -y ./artifacts/kni*
yum install -y ./artifacts/kni*
- name: Checkout sources
uses: actions/checkout@v3
with:
sparse-checkout: .github
- name: Test KNI package
- name: Test KNI package installation
uses: ./.github/actions/test-kni
1 change: 0 additions & 1 deletion .github/workflows/pre-commit-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Run pre-commit checks
on:
pull_request:
push:
workflow_dispatch:
jobs:
pre-commit-checks:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/run-standard-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
KhiopsBatchMode: true
jobs:
# Build the project on each platform for all targets to ensure that all sources and cmake files are correct
# The useful binaries are cached for the current run_id. It will be restored only in the same run of the
# The useful binaries are cached for the current run_id. It will be restored only in the same run of the
# build. The cached binaries are delete in the last job (cleanup-cache)
build-full-project:
strategy:
Expand All @@ -34,7 +34,6 @@ jobs:
uses: ./.github/actions/build-khiops
with:
preset-name: ${{ env.PRESET_NAME }}
override-flags: -DTESTING=OFF
- name: Cache binaries
id: cache-binaries-unix
uses: actions/cache@v3
Expand Down Expand Up @@ -109,8 +108,8 @@ jobs:
if [[ "${{ matrix.build-setup.os }}" == 'windows-2022' ]]; then
export EXT=".exe"
fi
if [[ "${{ matrix.running-mode }}" == "parallel" ]] ; then
export KhiopsMPIProcessNumber=3
if [[ "${{ matrix.running-mode }}" == "parallel" ]] ; then
export KhiopsMPIProcessNumber=3
fi
if [[ "${{ matrix.config }}" == "release" ]] ; then
python $TEST_PY Khiops ${BIN_PATH}/MODL${EXT} Standard
Expand Down
Loading

0 comments on commit c3c41e3

Please sign in to comment.