Skip to content

Commit

Permalink
Add NSIS windows packaging
Browse files Browse the repository at this point in the history
- Add and readapt the NSIS scripts
  - All bundled executables are now passed as parameters within the
    makensis call
- Add a workflow that build the NSIS packages in the GH CI
  • Loading branch information
folmos-at-orange committed Aug 23, 2023
1 parent ec6d314 commit 7c38fe0
Show file tree
Hide file tree
Showing 22 changed files with 1,306 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
name: Build development containers
name: Build Linux containers for packaging
on:
workflow_dispatch:
# DDD
push:
jobs:
build-container:
build-packaging-container:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -24,13 +26,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 }}
47 changes: 47 additions & 0 deletions .github/workflows/build-nsis-reqs-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Build NSIS requirements container
on:
workflow_dispatch:
jobs:
build-requirements-container:
name: "Build NSIS software requirements container"
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
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:
file: ./packaging/dockerfiles/windows/nsis-requirements/Dockerfile
tags: ghcr.io/khiopsml/khiops/khiops-nsis-requirements:latest
push: true
- name: Display the image digest
run: echo ${{ steps.docker-build.outputs.digest }}
test-requirements-container:
name: "Test NSIS software requirements container"
runs-on: ubuntu-latest
needs: build-requirements-container
container: ghcr.io/khiopsml/khiops/khiops-nsis-requirements:latest
permissions:
packages: read
steps:
- name: Test installer files existence
shell: bash
run: |-
cd /var/share/nsis-requirements
test -f $JRE_FILENAME
test -f $KHIOPS_VIZ_FILENAME
test -f $KHIOPS_COVIZ_FILENAME
test -f $MSMPI_FILENAME
96 changes: 96 additions & 0 deletions .github/workflows/pack-nsis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
name: Build NSIS Windows installer
on:
workflow_dispatch:
# DDD
push:
jobs:
retrieve-nsis-requirements:
name: Retrieve NSIS installer software requirements
runs-on: ubuntu-latest
container: ghcr.io/khiopsml/khiops/khiops-nsis-requirements:latest
outputs:
jre-filename: ${{ steps.save-file-data.outputs.jre-filename }}
jre-version: ${{ steps.save-file-data.outputs.jre-version }}
khiops-viz-filename: ${{ steps.save-file-data.outputs.khiops-viz-filename }}
khiops-viz-version: ${{ steps.save-file-data.outputs.khiops-viz-version }}
khiops-coviz-filename: ${{ steps.save-file-data.outputs.khiops-coviz-filename }}
khiops-coviz-version: ${{ steps.save-file-data.outputs.khiops-coviz-version }}
msmpi-filename: ${{ steps.save-file-data.outputs.msmpi-filename }}
msmpi-version: ${{ steps.save-file-data.outputs.msmpi-version }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Upload NSIS package requirements
uses: actions/[email protected]
with:
name: nsis-requirements
path: /var/share/nsis-requirements/*
retention-days: 7
- name: Save package file data to the environment
id: save-file-data
run: |
echo "jre-filename=$JRE_FILENAME" >> "$GITHUB_OUTPUT"
echo "jre-version=$JRE_VERSION" >> "$GITHUB_OUTPUT"
echo "khiops-viz-filename=$KHIOPS_VIZ_FILENAME" >> "$GITHUB_OUTPUT"
echo "khiops-viz-version=$KHIOPS_VIZ_VERSION" >> "$GITHUB_OUTPUT"
echo "khiops-coviz-filename=$KHIOPS_COVIZ_FILENAME" >> "$GITHUB_OUTPUT"
echo "khiops-coviz-version=$KHIOPS_COVIZ_VERSION" >> "$GITHUB_OUTPUT"
echo "msmpi-filename=$MSMPI_FILENAME" >> "$GITHUB_OUTPUT"
echo "msmpi-version=$MSMPI_VERSION" >> "$GITHUB_OUTPUT"
build-nsis-installer:
name: Build NSIS Windows installer
needs: retrieve-nsis-requirements
runs-on: windows-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Download NSIS requirements
uses: actions/[email protected]
with:
name: nsis-requirements
path: ./packaging/windows/nsis/nsis-requirements
- 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
- name: Build NSIS package
shell: pwsh
run: |-
cd ./packaging/windows/nsis
makensis `
/DKHIOPS_VERSION=10.1.5 `
/DKHIOPS_WINDOWS_BUILD_DIR=..\..\..\build\windows-msvc-release `
/DJRE_INSTALLER_PATH=.\nsis-requirements\${{ needs.retrieve-nsis-requirements.outputs.jre-filename }} `
/DMSMPI_INSTALLER_PATH=.\nsis-requirements\${{ needs.retrieve-nsis-requirements.outputs.msmpi-filename }} `
/DKHIOPS_VIZ_INSTALLER_PATH=.\nsis-requirements\${{ needs.retrieve-nsis-requirements.outputs.khiops-viz-filename }} `
/DKHIOPS_COVIZ_INSTALLER_PATH=.\nsis-requirements\${{ needs.retrieve-nsis-requirements.outputs.khiops-coviz-filename }} `
khiops.nsi
- name: Upload installer as artifact
uses: actions/[email protected]
with:
name: khiops-installer
path: ./packaging/windows/nsis/khiops-10.1.5-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
path: ./khiops-10.1.5-setup.exe
- name: Install Khiops
shell: pwsh
run: |
dir
Get-Host
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
Start-Process -FilePath .\khiops-10.1.5-setup.exe -ArgumentList '/S' -Wait
- name: Check the installation
run: |-
$Env:ProgramFiles\khiops\bin\khiops.cmd -v
Binary file added packaging/common/images/installer_khiops.ico
Binary file not shown.
Binary file added packaging/common/images/khiops.ico
Binary file not shown.
Binary file added packaging/common/images/khiops_coclustering.ico
Binary file not shown.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions packaging/dockerfiles/windows/nsis-requirements/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:22.04

ENV JRE_FILENAME="jre-8u371-windows-x64.exe"
ENV JRE_VERSION="8u371"
ENV KHIOPS_VIZ_FILENAME="khiops-visualization-Setup-10.2.8.exe"
ENV KHIOPS_VIZ_VERSION="10.2.8"
ENV KHIOPS_COVIZ_FILENAME="khiops-covisualization-Setup-10.2.4.exe"
ENV KHIOPS_COVIZ_VERSION="10.2.4"
ENV MSMPI_FILENAME="msmpisetup.exe"
ENV MSMPI_VERSION="10.1.3"

RUN true \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends wget ca-certificates \
&& mkdir -p /var/share/nsis-requirements \
&& cd /var/share/nsis-requirements \
&& wget -O ${JRE_FILENAME} \
https://javadl.oracle.com/webapps/download/AutoDL?BundleId=248242_ce59cff5c23f4e2eaf4e778a117d4c5b \
&& wget -O ${KHIOPS_VIZ_FILENAME} \
https://github.com/khiopsrelease/kv-release/releases/download/v10.2.8/khiops-visualization-Setup-10.2.8.exe \
&& wget -O ${KHIOPS_COVIZ_FILENAME} \
https://github.com/khiopsrelease/kc-release/releases/download/v10.2.4/khiops-covisualization-Setup-10.2.4.exe \
&& wget -O ${MSMPI_FILENAME} \
https://download.microsoft.com/download/7/2/7/72731ebb-b63c-4170-ade7-836966263a8f/msmpisetup.exe \
&& apt-get remove -y wget ca-certificates \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& true
119 changes: 119 additions & 0 deletions packaging/windows/nsis/CreateKhiopsCmdFileFunc.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
!include "FileFunc.nsh"
!include "x64.nsh"

# Macro to create the khiops.cmd script
# Example:
# ${CreateKhiopsCmdFile} "$INSTDIR\khiops.cmd" "MODL" "" "$INSTDIR" "scenario._kh" "log.txt" "1"
#
!define CreateKhiopsCmdFile "!insertmacro CreateKhiopsCmdFile"
!macro CreateKhiopsCmdFile FileName ToolName BinSuffix KhiopsHome ScenarioFileName LogFileName ParallelMode
Push "${ParallelMode}"
Push "${LogFileName}"
Push "${ScenarioFileName}"
Push "${KhiopsHome}"
Push "${BinSuffix}"
Push "${ToolName}"
Push "${FileName}"
Call CreateKhiopsCmdFile
!macroend


Function CreateKhiopsCmdFile
# Function parameters
Var /GLOBAL _FileName
Var /GLOBAL _ToolName
Var /GLOBAL _BinSuffix
Var /GLOBAL _KhiopsHome
Var /GLOBAL _ScenarioFileName
Var /GLOBAL _LogFileName
Var /GLOBAL _ParallelMode

# Retrieve parameters from stack
Pop $_FileName
Pop $_ToolName
Pop $_BinSuffix
Pop $_KhiopsHome
Pop $_ScenarioFileName
Pop $_LogFileName
Pop $_ParallelMode

# Open file to create
FileOpen $0 "$_FileName" w

# Write file
FileWrite $0 `@echo off$\r$\n`
FileWrite $0 `setlocal$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM ========================================================$\r$\n`
FileWrite $0 `REM See the khiops_env script for full documentation on the$\r$\n`
FileWrite $0 `REM environment variables used by Khiops$\r$\n`
FileWrite $0 `REM ========================================================$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM ========================================================$\r$\n`
FileWrite $0 `REM Initialization of the installation directory of Khiops$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM Test is Khiops environment already set up$\r$\n`
FileWrite $0 `if "%KHIOPS_HOME%".=="". set KHIOPS_HOME=$_KhiopsHome$\r$\n`
FileWrite $0 `if not exist "%KHIOPS_HOME%\bin$_BinSuffix\$_ToolName.exe" goto ERR_PATH$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM Test if batch mode from parameters$\r$\n`
FileWrite $0 `set _KHIOPS_BATCH_MODE=$\r$\n`
FileWrite $0 `for %%i in (%*) do if %%i.==-b. set _KHIOPS_BATCH_MODE=true$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM Initialize Khiops env variables$\r$\n`
FileWrite $0 `call "%KHIOPS_HOME%\bin\khiops_env" --env > NUL$\r$\n`
FileWrite $0 `if not %_KHIOPS_BATCH_MODE%.==true. if not exist "%KHIOPS_JAVA_PATH%\jvm.dll" goto ERR_JAVA$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM Set path$\r$\n`
FileWrite $0 `set path=%KHIOPS_PATH%;%KHIOPS_JAVA_PATH%;%path%$\r$\n`
FileWrite $0 `set classpath=%KHIOPS_CLASSPATH%;%classpath%$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM ========================================================$\r$\n`
FileWrite $0 `REM Start Khiops (with or without parameteres)$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `if %1.==. goto NOPARAMS$\r$\n`
FileWrite $0 `if not %1.==. goto PARAMS$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM Start without parameters$\r$\n`
FileWrite $0 `:NOPARAMS$\r$\n`
FileWrite $0 `if not exist "%KHIOPS_LAST_RUN_DIR%" md "%KHIOPS_LAST_RUN_DIR%"$\r$\n`
FileWrite $0 `if not exist "%KHIOPS_LAST_RUN_DIR%" goto PARAMS$\r$\n`
${If} $_ParallelMode == "0"
FileWrite $0 `"%KHIOPS_PATH%$_BinSuffix\$_ToolName" -o "%KHIOPS_LAST_RUN_DIR%\$_ScenarioFileName" -e "%KHIOPS_LAST_RUN_DIR%\$_LogFileName"$\r$\n`
${Else}
FileWrite $0 `%KHIOPS_MPI_COMMAND% "%KHIOPS_PATH%$_BinSuffix\$_ToolName" -o "%KHIOPS_LAST_RUN_DIR%\$_ScenarioFileName" -e "%KHIOPS_LAST_RUN_DIR%\$_LogFileName"$\r$\n`
${EndIf}
FileWrite $0 `goto END$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM Start with parameters$\r$\n`
FileWrite $0 `:PARAMS$\r$\n`
${If} $_ParallelMode == "0"
FileWrite $0 `"%KHIOPS_PATH%$_BinSuffix\$_ToolName" %*$\r$\n`
${Else}
FileWrite $0 `%KHIOPS_MPI_COMMAND% "%KHIOPS_PATH%$_BinSuffix\$_ToolName" %*$\r$\n`
${EndIf}
FileWrite $0 `goto END$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM ========================================================$\r$\n`
FileWrite $0 `REM Error messages$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `:ERR_PATH$\r$\n`
FileWrite $0 `start "KHIOPS CONFIG PROBLEM" echo ERROR Incorrect installation directory for Khiops (File $_ToolName.exe not found in directory %KHIOPS_PATH%$_BinSuffix)$\r$\n`
FileWrite $0 `exit /b 1$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `:ERR_JAVA$\r$\n`
FileWrite $0 `start "KHIOPS CONFIG PROBLEM" echo ERROR Java not correctly installed, jvm.dll not found under java directory tree %_KHIOPS_JAVA_HOME% (%_KHIOPS_JAVA_HOME_ORIGIN%): see khiops_env.cmd file in %KHIOPS_HOME%\bin, after line 'Set user Java Home'$\r$\n`
FileWrite $0 `exit /b 1$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `:END$\r$\n`
FileWrite $0 `endlocal$\r$\n`
FileWrite $0 `$\r$\n`
FileWrite $0 `REM Return 1 if fatal error, 2 if error(s), 0 otherwise$\r$\n`
FileWrite $0 `exit /b %errorlevel%$\r$\n`

# Close file
FileClose $0
FunctionEnd
Loading

0 comments on commit 7c38fe0

Please sign in to comment.