Skip to content

Commit

Permalink
ci: Fix Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
vasylskorych committed Oct 8, 2024
1 parent e7fdb85 commit 3bb014f
Showing 1 changed file with 43 additions and 38 deletions.
81 changes: 43 additions & 38 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,8 @@ name: Windows
on: [push]

env:
# Path to the solution/project files relative to the root of the project.
SOLUTION_FILE_PATH: .
SOLUTION_FILE_NAME: musen.sln
INSTALLER_PROJECT_PATH: ./Installers/InstallerProject/

# Configuration type to build.
BUILD_CONFIGURATION: Release
BUILD_PLATFORM: x64

# Versions
QT_VERSION: 5.15.2
QT_VS_VERSION: msvc2019_64
QT_VS_ADDIN_VERSION: 3.2.0
QT_VS_ADDIN_URL: https://ftp.fau.de/qtproject/archive/vsaddin/3.2.0/qt-vsaddin-msvc2022-x64-3.2.0-rev.47.vsix

jobs:
build:
Expand All @@ -42,7 +31,7 @@ jobs:
# If cached, only install essential build tools and set environmental variables.
cache-key-prefix: 'cache-qt'
# Version of Qt to install.
version: ${{env.QT_VERSION}}
version: 5.15.2
# Architecture.
arch: win64_msvc2019_64
# Directory to install.
Expand All @@ -64,7 +53,7 @@ jobs:
# Also, it installs them to %LOCALAPPDATA%\QtMsBuild, so they can not be used by other Windows users.
# Download the extension and extract requited files to the project directory.
run: |
Invoke-WebRequest -Uri https://ftp.fau.de/qtproject/archive/vsaddin/${{env.QT_VS_ADDIN_VERSION}}/qt-vsaddin-msvc2022-x64-${{env.QT_VS_ADDIN_VERSION}}-rev.47.vsix -MaximumRetryCount 10 -RetryIntervalSec 30 -OutFile vspackage.vsix
Invoke-WebRequest -Uri ${{env.QT_VS_ADDIN_URL}} -MaximumRetryCount 10 -RetryIntervalSec 30 -OutFile vspackage.vsix
Expand-Archive vspackage.vsix -DestinationPath ${{github.workspace}}/ExternalLibraries/qtvsaddin
- name: Cache ZLib
Expand Down Expand Up @@ -108,24 +97,36 @@ jobs:
id: install-cuda
with:
cuda: '11.8.0'
sub-packages: '["cudart", "curand_dev", "nvcc", "thrust"]'
sub-packages: '["cudart", "curand_dev", "nvcc", "thrust", "visual_studio_integration"]'
method: 'network'

- name: Install CUDA VS integration
uses: Jimver/cuda-toolkit@v0.2.17
id: install-cuda-vs
with:
cuda: '11.8.0'
sub-packages: '["visual_studio_integration"]'
method: 'network'
# - name: Install CUDA VS integration
# uses: Jimver/cuda-toolkit@v0.2.17
# id: install-cuda-vs
# with:
# cuda: '11.8.0'
# sub-packages: '["visual_studio_integration"]'
# method: 'network'

- name: Build
working-directory: ${{github.workspace}}
env:
QtToolsPath: ${{env.QT_ROOT_DIR}}/bin
QtMsBuild: ${{github.workspace}}/ExternalLibraries/qtvsaddin/QtMsBuild
# Add additional options to the MSBuild command line here: see https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference.
run: msbuild -maxCpuCount -verbosity:minimal -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}/${{env.SOLUTION_FILE_NAME}}
run: msbuild -maxCpuCount -verbosity:minimal -p:Zm=100 -property:Configuration=Release -property:Platform=x64 ${{github.workspace}}/musen.sln

- name: Upload Build Artifact
# if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: build-artifact
if-no-files-found: error
retention-days: 1
compression-level: 1
path: |
${{github.workspace}}/x64/Release/*.exe
${{github.workspace}}/x64/Release/*.dll
installer:
runs-on: windows-latest
Expand All @@ -150,7 +151,7 @@ jobs:
# If cached, only install essential build tools and set environmental variables.
cache-key-prefix: 'cache-qt'
# Version of Qt to install.
version: ${{env.QT_VERSION}}
version: 5.15.2
# Architecture.
arch: win64_msvc2019_64
# Directory to install.
Expand All @@ -172,7 +173,7 @@ jobs:
# Also, it installs them to %LOCALAPPDATA%\QtMsBuild, so they can not be used by other Windows users.
# Download the extension and extract requited files to the project directory.
run: |
Invoke-WebRequest -Uri https://ftp.fau.de/qtproject/archive/vsaddin/${{env.QT_VS_ADDIN_VERSION}}/qt-vsaddin-msvc2022-x64-${{env.QT_VS_ADDIN_VERSION}}-rev.47.vsix -MaximumRetryCount 10 -RetryIntervalSec 30 -OutFile vspackage.vsix
Invoke-WebRequest -Uri ${{env.QT_VS_ADDIN_URL}} -MaximumRetryCount 10 -RetryIntervalSec 30 -OutFile vspackage.vsix
Expand-Archive vspackage.vsix -DestinationPath ${{github.workspace}}/ExternalLibraries/qtvsaddin
- name: Cache ZLib
Expand Down Expand Up @@ -216,32 +217,36 @@ jobs:
id: install-cuda
with:
cuda: '11.8.0'
sub-packages: '["cudart", "curand_dev", "nvcc", "thrust"]'
sub-packages: '["cudart", "curand_dev", "nvcc", "thrust", "visual_studio_integration"]'
method: 'network'

- name: Install CUDA VS integration
uses: Jimver/cuda-toolkit@v0.2.17
id: install-cuda-vs
# - name: Install CUDA VS integration
# uses: Jimver/cuda-toolkit@v0.2.17
# id: install-cuda-vs
# with:
# cuda: '11.8.0'
# sub-packages: '["visual_studio_integration"]'
# method: 'network'

- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
cuda: '11.8.0'
sub-packages: '["visual_studio_integration"]'
method: 'network'
name: build-artifact
path: ${{github.workspace}}/x64/Release

- name: Build
- name: Build Debug
working-directory: ${{github.workspace}}
env:
QtToolsPath: ${{env.QT_ROOT_DIR}}/bin
QtMsBuild: ${{github.workspace}}/ExternalLibraries/qtvsaddin/QtMsBuild
run: |
msbuild -maxCpuCount -verbosity:minimal -property:Configuration=Debug -property:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}/${{env.SOLUTION_FILE_NAME}}
msbuild -maxCpuCount -verbosity:minimal -property:Configuration=Release -property:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}/${{env.SOLUTION_FILE_NAME}}
run: msbuild -maxCpuCount:2 -verbosity:minimal -p:Zm=100 -property:Configuration=Debug -property:Platform=x64 ${{github.workspace}}/musen.sln

- name: Build Installer
working-directory: ${{github.workspace}}
env:
QtToolsPath: ${{env.QT_ROOT_DIR}}/bin
QtMsBuild: ${{github.workspace}}/ExternalLibraries/qtvsaddin/QtMsBuild
run: msbuild -maxCpuCount -verbosity:minimal -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}} -property:SolutionDir=${{github.workspace}}/ -property:SolutionPath=${{github.workspace}}/${{env.SOLUTION_FILE_NAME}} -property:QtInstallDir=${{github.workspace}}/ExternalLibraries/qt/Qt/${{env.QT_VERSION}}/${{env.QT_VS_VERSION}}/ ${{env.INSTALLER_PROJECT_PATH}}
run: msbuild -maxCpuCount -verbosity:minimal -p:Zm=100 -property:Configuration=Release -property:Platform=x64 -property:SolutionDir=${{github.workspace}}/ -property:SolutionPath=${{github.workspace}}/musen.sln -property:QtInstallDir=${{github.workspace}}/ExternalLibraries/qt/Qt/5.15.2/msvc2019_64/ ${{github.workspace}}/Installers/InstallerProject/

- name: Run Installer
shell: pwsh
Expand Down Expand Up @@ -271,7 +276,7 @@ jobs:
shell: pwsh
run: |
$UnInstallerFile = Resolve-Path "${{ env.LOCALAPPDATA_DIR }}/Programs/MUSEN/unins000.exe"
Start-Process -FilePath $UnInstallerFile -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /skipaskconfig=yes" -Wait
Start-Process -FilePath $UnInstallerFile -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART" -Wait
release:
runs-on: windows-latest
Expand Down

0 comments on commit 3bb014f

Please sign in to comment.