Skip to content

Commit b039b87

Browse files
authored
migrate msvc ci to windows-2022 (#6210)
1 parent 2f34e7f commit b039b87

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

.github/workflows/windows.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,47 @@ permissions:
3737
jobs:
3838
windows-gpu:
3939
name: ${{ matrix.vs-version }}
40-
runs-on: ${{ matrix.os }}
40+
runs-on: windows-2022
4141
strategy:
4242
matrix:
4343
include:
4444
- vs-version: vs2015
4545
toolset-version: v140
46-
os: windows-2019
47-
4846
- vs-version: vs2017
4947
toolset-version: v141
50-
os: windows-2019
51-
5248
- vs-version: vs2019
5349
toolset-version: v142
54-
os: windows-2022
55-
5650
- vs-version: vs2022
5751
toolset-version: v143
58-
os: windows-2022
5952

6053
env:
6154
UseMultiToolTask: true
6255
steps:
6356
- uses: actions/checkout@v4
6457
with:
6558
submodules: true
59+
60+
- name: Install VS 2017 (v141) Build Tools
61+
if: matrix.vs-version == 'vs2017'
62+
run: |
63+
$vsInstallPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
64+
Start-Process -FilePath "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "modify --installPath `"$vsInstallPath`" --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --quiet --norestart --nocache" -Wait
65+
- name: Install and Setup VS 2015 (v140) Build Tools
66+
if: matrix.vs-version == 'vs2015'
67+
run: |
68+
$vs140Path = "C:/vs140_build_tools"
69+
Invoke-WebRequest -Uri "https://aka.ms/vs/15/release/vs_buildtools.exe" -OutFile vs_buildtools.exe
70+
Start-Process -FilePath "vs_buildtools.exe" -ArgumentList "--installPath `"$vs140Path`" --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.140 --quiet --wait --norestart --nocache" -Wait
71+
72+
$vcvarsPath = (Get-ChildItem -Path $vs140Path -Filter "vcvars64.bat" -Recurse | Select-Object -First 1).FullName
73+
$cmd = "`"$vcvarsPath`" && powershell -Command `"`$env:PATH;`$env:INCLUDE;`$env:LIB`""
74+
$output = cmd.exe /c $cmd
75+
$lines = $output -split "`r`n"
76+
77+
echo "PATH=$($lines[0]);$($env:PATH)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
78+
echo "INCLUDE=$($lines[1])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
79+
echo "LIB=$($lines[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
80+
6681
- name: cache-protobuf
6782
id: cache-protobuf
6883
uses: actions/cache@v4
@@ -75,7 +90,8 @@ jobs:
7590
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7691
7z x ./protobuf-3.11.2.zip
7792
cd protobuf-3.11.2
78-
mkdir build-${{ matrix.vs-version }}; cd build-${{ matrix.vs-version }}; cmake -T ${{ matrix.toolset-version }},host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DNCNN_BUILD_TESTS=ON ../cmake
93+
mkdir build-${{ matrix.vs-version }}; cd build-${{ matrix.vs-version }}
94+
cmake -T ${{ matrix.toolset-version }},host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DNCNN_BUILD_TESTS=ON ../cmake
7995
cmake --build . --config Release -j 4
8096
cmake --build . --config Release --target install
8197
- name: cache-swiftshader

0 commit comments

Comments
 (0)