Optimizing out a VS 2022 dependency in a Github CI action

55 views Asked by At

I've made some Github CI actions, but I was having trouble compiling my project on windows using the Visual Studio version (VS2019). Specifically, I was getting errors related to std::format_strings not being defined (The local build on my PC works just fine, although I'm using VS 2022 here).

To remedy this issue I've proceeded to download VS 2022 into my action. While this does work, and my project compiles just fine, it obviously takes very long and isn't optimal at all (the action takes roughly 10 minutes, where 8 minutes are taken by the VS install).

Is there a way to optimize my GitHub action for the windows environment so that I can get closer to the performance of my Linux builds (~2 minutes)?

name: Windows

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Install Visual Studio Build Tools
      run: |
        choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.TestTools.BuildTools --includeOptional" -y
        choco install visualstudio2022-workload-vctools -y
    - name: Add MSBuild to PATH
      run: |
        echo "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" | Out-File -Append -FilePath $env:GITHUB_PATH
    - name: Print MSBuild Version
      run: |
        msbuild -version
    - name: Run Premake for Visual Studio
      run: .\setup.bat

    - name: Compile Project with MSBuild
      run: |
        msbuild sigma.sln /p:Configuration=Debug /p:Platform="x64" /p:stdcpp=latest
1

There are 1 answers

0
Goubermouche On

Solved - windows-2022 provides a VS2022 install, I just misread another error and thought that it does not.