Skip to content

Build release (Windows) #56

Build release (Windows)

Build release (Windows) #56

Workflow file for this run

name: Build release (Windows)
on:
workflow_dispatch:
env:
BUILD_CONFIGURATION: Release
ARCH: x64
VCPKG_COMMIT: 'HEAD'
VCPKG_ROOT: ./vcpkg
VCPKG_INSTALL_FOLDER: ./vcpkg/installed
CS_XSD_INSTALL_FOLDER: xsd/libxsd-4.2.0
XSD_URL: https://www.codesynthesis.com/download/xsd/4.2/libxsd-4.2.0.tar.gz
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/487fd8c3-a3d8-4c22-a903-f8d54c2c57be/intel-oneapi-base-toolkit-2025.1.0.650_offline.exe
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/0ba263f5-de00-4e91-a780-fdb9e131c1e8/intel-oneapi-hpc-toolkit-2025.1.0.665_offline.exe
WINDOWS_CPP_COMPONENTS: intel.oneapi.win.cpp-dpcpp-common
CACHE_NUMBER: 3
VCPKG_PACKAGES: boost-process boost-iostreams boost-spirit boost-system boost-filesystem boost-timer boost-thread boost-program-options openblas 7zip xerces-c curl
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Prepare vcpkg
shell: powershell
run: |
if (-not (Test-Path $env:VCPKG_ROOT)) {
Write-Host "Cloning vcpkg repository..."
git clone https://github.com/microsoft/vcpkg $env:VCPKG_ROOT
} else {
Write-Host "vcpkg repository folder already exists."
}
if ($env:VCPKG_COMMIT -ne 'HEAD') {
Write-Host "Checking out vcpkg commit $env:VCPKG_COMMIT..."
git -C $env:VCPKG_ROOT checkout $env:VCPKG_COMMIT
}
# Bootstrap if needed
if (-not (Test-Path (Join-Path $env:VCPKG_ROOT 'vcpkg.exe'))) {
Write-Host "Bootstrapping vcpkg..."
& (Join-Path $env:VCPKG_ROOT 'bootstrap-vcpkg.bat') -disableMetrics
} else {
Write-Host "vcpkg.exe already exists; skipping bootstrap."
}
- name: Cache vcpkg
id: cache-vcpkg
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}/downloads
${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ env.CACHE_NUMBER }}-${{ env.VCPKG_PACKAGES }}
- name: Install vcpkg prerequisites
shell: cmd
run: |
echo Installing packages: %VCPKG_PACKAGES%
.\vcpkg\vcpkg.exe install %VCPKG_PACKAGES% --triplet=%ARCH%-windows
.\vcpkg\vcpkg.exe integrate install
.\vcpkg\vcpkg.exe list
- name: Cache Intel OneAPI
id: cache-oneapi
uses: actions/cache@v3
with:
path: |
C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat
C:\Program Files (x86)\Intel\oneAPI\compiler
key: oneapi-${{ env.CACHE_NUMBER }}-${{ env.WINDOWS_BASEKIT_URL }}-${{ env.WINDOWS_HPCKIT_URL }}
- name: Install Intel OneAPI
if: steps.cache-oneapi.outputs.cache-hit != 'true'
shell: powershell
run: |
Write-Host "Installing Intel OneAPI..."
$url = $env:WINDOWS_HPCKIT_URL
$components = $env:WINDOWS_CPP_COMPONENTS
$tempExe = Join-Path $env:TEMP "webimage.exe"
Write-Host "Downloading installer from $url..."
curl.exe -L $url -o $tempExe
Write-Host "Extracting installer..."
$installerArgs = "-s -x -f webimage_extracted --log extract.log"
$proc = Start-Process -FilePath $tempExe -ArgumentList $installerArgs -NoNewWindow -Wait -PassThru
if ($proc.ExitCode -ne 0) {
throw "Installer execution failed with exit code $($proc.ExitCode)"
}
Remove-Item $tempExe -Force
if ([string]::IsNullOrEmpty($components)) {
$bootstrapArgs = "-s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=."
} else {
$bootstrapArgs = "-s --action install --components=$components --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=."
}
Write-Host "Running bootstrapper..."
$bootstrapperPath = Join-Path -Path (Join-Path $PWD "webimage_extracted") "bootstrapper.exe"
if (-Not (Test-Path $bootstrapperPath)) {
throw "Bootstrapper not found at $bootstrapperPath"
}
$procBootstrap = Start-Process -FilePath $bootstrapperPath -ArgumentList $bootstrapArgs -NoNewWindow -Wait -PassThru
if ($procBootstrap.ExitCode -ne 0) {
throw "Bootstrapper installation failed with exit code $($procBootstrap.ExitCode)"
}
Remove-Item -Recurse -Force "webimage_extracted"
- name: Find solution file
id: find_sln
shell: powershell
run: |
$sln = Get-ChildItem -Path $env:GITHUB_WORKSPACE -Filter *.sln -Recurse | Select-Object -First 1
if (-not $sln) { Write-Error "Solution file not found" }
Write-Host "Solution file: $($sln.FullName)"
echo "::set-output name=sln::$($sln.FullName)"
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Restore NuGet packages
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: nuget restore "${{ steps.find_sln.outputs.sln }}"
- name: Download and install xsd
shell: powershell
run: |
Write-Host "Downloading xsd from $env:XSD_URL..."
curl.exe -L $env:XSD_URL -o "./libxsd-4.2.0.tar.gz"
Write-Host "Extracting xsd..."
tar -xzf "./libxsd-4.2.0.tar.gz" -C "./xsd"
- name: Build DynAdjust
shell: cmd
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
set DEPS_DIR=%VCPKG_INSTALL_FOLDER%\%ARCH%-windows\include
set XSD_DIR=%GITHUB_WORKSPACE%\%CS_XSD_INSTALL_FOLDER%
set PATH=%DEPS_DIR%;%XSD_DIR%;%PATH%
echo %PATH%
msbuild /m /p:Configuration=%BUILD_CONFIGURATION% /p:Platform=%ARCH% /p:"VCBuildAdditionalOptions= /useenv" "${{ steps.find_sln.outputs.sln }}"