-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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
1 parent
26b99f6
commit 427dcab
Showing
15 changed files
with
1,458 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
--- | ||
name: Build NSIS Windows installer | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- '**CMakeLists.txt' | ||
- packaging/windows/nsis/*.nsh | ||
- packaging/windows/nsis/*.nsi | ||
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: Checkout sources | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 2 | ||
- name: Put the package version on the environment and output | ||
id: get-version | ||
shell: bash | ||
run: | | ||
# Obtain the ref name and type | ||
if [[ "${{ github.ref }}" =~ ^refs/pull ]] | ||
then | ||
ref_name="$(git rev-parse --short HEAD~1)" | ||
is_tag="false" | ||
elif [[ "${{ github.ref }}" =~ ^refs/heads ]] | ||
then | ||
ref_name="${{ github.ref_name }}" | ||
is_tag="false" | ||
elif [[ "${{ github.ref }}" =~ ^refs/tags ]] | ||
then | ||
ref_name="${{ github.ref_name }}" | ||
is_tag="true" | ||
else | ||
echo "::error Unsupported ref ${{ github.ref }}" | ||
false | ||
fi | ||
# Build the versions | ||
KHIOPS_PACKAGE_VERSION="$(./scripts/khiops-package-version $ref_name $is_tag)" | ||
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 ` | ||
/DKIHOPS_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: DDD | ||
shell: bash | ||
run: | | ||
echo $PATH | sed 's/:/\n/g' | ||
which khiops || true | ||
which khiops.cmd || true | ||
- name: DDD | ||
if: success() || failure() | ||
shell: pwsh | ||
run: | | ||
echo "$Env:PATH" | ||
ls "${Env:ProgramFiles}\khiops\bin" | ||
Get-Command khiops | ||
- name: Checkout the khiops sources | ||
# DDD | ||
if: success() || failure() | ||
uses: actions/checkout@v3 | ||
- name: Test the installation | ||
uses: ./.github/actions/test-khiops-install |
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.