Skip to content

build: Refactor Powershell script for Visual Studio setup #62

build: Refactor Powershell script for Visual Studio setup

build: Refactor Powershell script for Visual Studio setup #62

Workflow file for this run

name: MSVC
on:
pull_request:
branches:
- '*'
paths:
- 'develop.ps1'
- './.github/workflows/build/windows/action.yml'
jobs:
Checkout:
uses: "./.github/workflows/_checkout.yml"
with:
checkoutRef: ${{ github.event.pull_request.head.sha }}
MsvcDev:
runs-on: windows-latest
needs: [Checkout]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Set up Python 3.11'
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Install Downgraded MSVC'
shell: powershell
env:
msvcVersion: ${{ needs.Checkout.outputs.msvcVersion }}
run: |
# For versions update see here: https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToInstall= @(
"Microsoft.VisualStudio.Component.VC.$env:msvcVersion.x86.x64"
"Microsoft.VisualStudio.Component.VC.$env:msvcVersion.ATL"
)
[string]$workloadArgs = $componentsToInstall | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
- name: 'Set up MSVC toolchain'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: 'Install dependencies'
shell: pwsh
working-directory: ${{ github.workspace }}
env:
qtVersion: ${{ needs.Checkout.outputs.qtVersion }}
antlrVersion: ${{ needs.Checkout.outputs.antlrVersion }}
PythonPath: ${{ steps.setup-python.outputs.python-path }}
run: |
Write-Output $env:PythonPath
./develop.ps1 -release -qtVersion $env:qtVersion -antlrVersion $env:antlrVersion -pythonPath $env:PythonPath -setSystemEnvVars
- name: 'Configure and build with CMake'
shell: bash
run: |
git submodule update --init --recursive
export PATH="${{ github.workspace }}\msvc-env\Scripts;${{ github.workspace }}\dependencies\qt\${{ inputs.qtVersion }}\msvc2019_64\bin;$PATH"
cmake --preset GUI-Release-MSVC
cmake --build build