|
1 | 1 | name: Build release (Windows) |
2 | 2 |
|
3 | | -on: |
4 | | - push: |
| 3 | +on: |
| 4 | + push: |
5 | 5 | branches: [master] |
6 | | - pull_request: |
| 6 | + pull_request: |
7 | 7 | branches: [master] |
8 | 8 |
|
9 | 9 | env: |
10 | | - # Path to the solution file relative to the root of the project. |
11 | | - SOLUTION_FILE_PATH: ./dynadjust/dynadjust_1_02_04.sln |
12 | | - |
13 | | - # Configuration type to build. |
14 | | - # You can convert this to a build matrix if you need coverage of multiple configuration types. |
15 | | - # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
16 | | - BUILD_CONFIGURATION: Release |
17 | | - # Platform to build. |
| 10 | + BUILD_CONFIGURATION: Release |
18 | 11 | ARCH: x64 |
19 | | - |
20 | 12 | VCPKG_INSTALL_FOLDER: c:/vcpkg/installed |
21 | 13 | CS_XSD_INSTALL_FOLDER: xsd/xsd-4.0.0-i686-windows/libxsd |
| 14 | + 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 |
| 15 | + 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 |
| 16 | + WINDOWS_CPP_COMPONENTS: intel.oneapi.win.cpp-dpcpp-common |
| 17 | + CACHE_NUMBER: 4 |
22 | 18 |
|
23 | 19 | jobs: |
24 | 20 | build: |
25 | 21 | runs-on: windows-latest |
26 | | - |
27 | 22 | steps: |
28 | | - - uses: actions/checkout@v2 |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Cache Intel OneAPI |
| 26 | + id: cache-oneapi |
| 27 | + uses: actions/cache@v3 |
| 28 | + with: |
| 29 | + path: | |
| 30 | + C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat |
| 31 | + C:\Program Files (x86)\Intel\oneAPI\compiler |
| 32 | + key: install-${{ env.CACHE_NUMBER }}-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_CPP_COMPONENTS }}-compiler-${{ hashFiles('**/scripts/cache_exclude_windows.sh') }} |
| 33 | + |
| 34 | + - name: Install Intel OneAPI |
| 35 | + if: steps.cache-oneapi.outputs.cache-hit != 'true' |
| 36 | + shell: powershell |
| 37 | + run: | |
| 38 | + Write-Host "Installing Intel OneAPI..." |
| 39 | + # Set URL and COMPONENTS from environment variables |
| 40 | + $url = $env:WINDOWS_HPCKIT_URL |
| 41 | + $components = $env:WINDOWS_CPP_COMPONENTS |
| 42 | + $tempExe = Join-Path $env:TEMP "webimage.exe" |
| 43 | + |
| 44 | + # Download the installer with retry logic |
| 45 | + $maxRetries = 5 |
| 46 | + $retryDelay = 5 |
| 47 | + $attempt = 0 |
| 48 | + do { |
| 49 | + try { |
| 50 | + Write-Host "Downloading installer from $url (attempt $($attempt+1))..." |
| 51 | + Invoke-WebRequest -Uri $url -OutFile $tempExe -ErrorAction Stop |
| 52 | + break |
| 53 | + } catch { |
| 54 | + $attempt++ |
| 55 | + if ($attempt -ge $maxRetries) { |
| 56 | + throw "Failed to download file after $maxRetries attempts" |
| 57 | + } |
| 58 | + Write-Host "Download failed, retrying in $retryDelay seconds..." |
| 59 | + Start-Sleep -Seconds $retryDelay |
| 60 | + } |
| 61 | + } while ($true) |
| 62 | + |
| 63 | + # Execute the downloaded installer to extract files |
| 64 | + Write-Host "Extracting installer..." |
| 65 | + $installerArgs = "-s -x -f webimage_extracted --log extract.log" |
| 66 | + $proc = Start-Process -FilePath $tempExe -ArgumentList $installerArgs -NoNewWindow -Wait -PassThru |
| 67 | + if ($proc.ExitCode -ne 0) { |
| 68 | + throw "Installer execution failed with exit code $($proc.ExitCode)" |
| 69 | + } |
| 70 | + |
| 71 | + # Delete the installer file |
| 72 | + Remove-Item $tempExe -Force |
| 73 | + |
| 74 | + # Build bootstrapper arguments based on whether COMPONENTS is empty |
| 75 | + if ([string]::IsNullOrEmpty($components)) { |
| 76 | + $bootstrapArgs = "-s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=." |
| 77 | + } else { |
| 78 | + $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=." |
| 79 | + } |
| 80 | + |
| 81 | + # Execute the bootstrapper |
| 82 | + Write-Host "Running bootstrapper..." |
| 83 | + $bootstrapperPath = Join-Path -Path (Join-Path $PWD "webimage_extracted") "bootstrapper.exe" |
| 84 | + if (-Not (Test-Path $bootstrapperPath)) { |
| 85 | + throw "Bootstrapper not found at $bootstrapperPath" |
| 86 | + } |
| 87 | + $procBootstrap = Start-Process -FilePath $bootstrapperPath -ArgumentList $bootstrapArgs -NoNewWindow -Wait -PassThru |
| 88 | + if ($procBootstrap.ExitCode -ne 0) { |
| 89 | + throw "Bootstrapper installation failed with exit code $($procBootstrap.ExitCode)" |
| 90 | + } |
| 91 | + |
| 92 | + # Clean up extracted files |
| 93 | + Remove-Item -Recurse -Force "webimage_extracted" |
| 94 | + |
| 95 | + - name: Find solution file |
| 96 | + id: find_sln |
| 97 | + shell: powershell |
| 98 | + run: | |
| 99 | + $sln = Get-ChildItem -Path $env:GITHUB_WORKSPACE -Filter *.sln -Recurse | Select-Object -First 1 |
| 100 | + if (-not $sln) { Write-Error "Solution file not found" } |
| 101 | + Write-Host "Solution file: $($sln.FullName)" |
| 102 | + echo "::set-output name=sln::$($sln.FullName)" |
29 | 103 |
|
30 | | - - name: Add MSBuild to PATH |
31 | | - |
| 104 | + - name: Add MSBuild to PATH |
| 105 | + |
32 | 106 |
|
33 | | - - name: Restore NuGet packages |
34 | | - working-directory: ${{env.GITHUB_WORKSPACE}} |
35 | | - run: nuget restore ${{env.SOLUTION_FILE_PATH}} |
| 107 | + - name: Restore NuGet packages |
| 108 | + working-directory: ${{ env.GITHUB_WORKSPACE }} |
| 109 | + run: nuget restore "${{ steps.find_sln.outputs.sln }}" |
36 | 110 |
|
37 | | - - name: Cache vcpkg packages |
38 | | - uses: actions/cache@v2 |
39 | | - id: cache |
40 | | - with: |
41 | | - path: ${{env.VCPKG_INSTALL_FOLDER}} |
| 111 | + - name: Cache vcpkg packages |
| 112 | + uses: actions/cache@v2 |
| 113 | + id: cache-vcpkg |
| 114 | + with: |
| 115 | + path: ${{ env.VCPKG_INSTALL_FOLDER }} |
42 | 116 | key: ${{ runner.os }}-vcpkg-${{ hashFiles('.github/workflows/msvc_build.yml') }} |
43 | | - |
44 | | - # Install prerequisites available from vcpkg |
45 | | - - name: Install vcpkg prerequisites |
46 | | - shell: cmd |
47 | | - if: steps.cache.outputs.cache-hit != 'true' |
48 | | - run: | |
49 | | - vcpkg update |
50 | | - vcpkg install boost-process boost-iostreams boost-spirit boost-system boost-filesystem boost-timer boost-thread boost-program-options --triplet=${{env.ARCH}}-windows |
51 | | - vcpkg install 7zip --triplet=${{env.ARCH}}-windows |
52 | | - vcpkg install xerces-c --triplet=${{env.ARCH}}-windows |
53 | | - vcpkg integrate install |
54 | | - vcpkg list |
55 | | - |
56 | | - # Install Codesynthesis xsd (not available from vcpkg) |
57 | | - - name: Download xsd |
58 | | - uses: carlosperate/[email protected] |
59 | | - id: download-xsd |
60 | | - with: |
61 | | - file-url: 'https://www.codesynthesis.com/download/xsd/4.0/windows/i686/xsd-4.0.0-i686-windows.zip' |
62 | | - file-name: 'xsd-4.0.0-i686-windows.zip' |
63 | | - location: './' |
64 | | - |
65 | | - - name: Install xsd |
66 | | - shell: cmd |
67 | | - run: 7z x xsd-4.0.0-i686-windows.zip -y -o./xsd |
68 | | - |
69 | | - # Build Dynadjust using msbuild |
70 | | - - name: Build DynAdjust |
71 | | - shell: cmd |
72 | | - working-directory: ${{env.GITHUB_WORKSPACE}} |
73 | | - # Add additional options to the MSBuild command line here (like platform or verbosity level). |
74 | | - # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference |
75 | | - run: | |
76 | | - set DEPS_DIR=${{env.VCPKG_INSTALL_FOLDER}}/${{env.ARCH}}-windows/include |
77 | | - set XSD_DIR=%GITHUB_WORKSPACE%/${{env.CS_XSD_INSTALL_FOLDER}} |
78 | | - set SLN_DIR=%GITHUB_WORKSPACE%/dynadjust |
79 | | - set PATH=%DEPS_DIR%;%XSD_DIR%;%SLN_DIR%;%PATH% |
80 | | - echo %PATH% |
81 | | - # msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.ARCH}} /p:"VCBuildAdditionalOptions= /useenv" ${{env.SOLUTION_FILE_PATH}} |
| 117 | + |
| 118 | + - name: Install vcpkg prerequisites |
| 119 | + shell: cmd |
| 120 | + if: steps.cache-vcpkg.outputs.cache-hit != 'true' |
| 121 | + run: | |
| 122 | + vcpkg update |
| 123 | + vcpkg install boost-process boost-iostreams boost-spirit boost-system boost-filesystem boost-timer boost-thread boost-program-options openblas 7zip xerces-c --triplet=%ARCH%-windows |
| 124 | + vcpkg integrate install |
| 125 | + vcpkg list |
| 126 | +
|
| 127 | + - name: Download and install xsd |
| 128 | + shell: powershell |
| 129 | + run: | |
| 130 | + Invoke-WebRequest -Uri "https://www.codesynthesis.com/download/xsd/latest/windows/i686/xsd-latest-i686-windows.zip" -OutFile "./xsd-latest-i686-windows.zip" |
| 131 | + Write-Host "Extracting xsd..." |
| 132 | + & "7z" x "xsd-latest-i686-windows.zip" -y -o"./xsd" |
| 133 | +
|
| 134 | + - name: Build DynAdjust |
| 135 | + shell: cmd |
| 136 | + working-directory: ${{ env.GITHUB_WORKSPACE }} |
| 137 | + run: | |
| 138 | + call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" |
| 139 | + set DEPS_DIR=%VCPKG_INSTALL_FOLDER%\%ARCH%-windows\include |
| 140 | + set XSD_DIR=%GITHUB_WORKSPACE%\%CS_XSD_INSTALL_FOLDER% |
| 141 | + set PATH=%DEPS_DIR%;%XSD_DIR%;%PATH% |
| 142 | + echo %PATH% |
| 143 | + msbuild /m /p:Configuration=%BUILD_CONFIGURATION% /p:Platform=%ARCH% /p:"VCBuildAdditionalOptions= /useenv" "${{ steps.find_sln.outputs.sln }}" |
0 commit comments