Opt, 避免msvcp14x_static_part/vcruntime静态库生成PBD #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
jobs: | |
Build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 恢复编译产物 | |
id: BinCache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
Release\**\*.* | |
x64\Release\**\*.* | |
key: BinCache_${{github.sha}} | |
- name: 初始化 | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
$ProgramFiles = ${env:ProgramFiles(x86)} | |
if (-not $ProgramFiles) | |
{ | |
$ProgramFiles = $env:ProgramFiles | |
} | |
$BuiltInVsWhereExe = "$ProgramFiles\Microsoft Visual Studio\Installer\vswhere.exe" | |
if (-not (Test-Path $BuiltInVsWhereExe)) | |
{ | |
throw "找不到vswhere.exe!" | |
} | |
Write-Output $BuiltInVsWhereExe | |
$LatestVisualStudioRoot = & $BuiltInVsWhereExe -latest -prerelease -property installationPath | |
if (-not (Test-Path $LatestVisualStudioRoot)) | |
{ | |
throw "找不到 VisualStudioRoot!" | |
} | |
echo "LatestVisualStudioRoot=$LatestVisualStudioRoot" >> $env:GITHUB_ENV | |
$MSBuildBinPath="$LatestVisualStudioRoot\MSBuild\Current\Bin" | |
if (-not (Test-Path $MSBuildBinPath)) | |
{ | |
$installationVersion = & $BuiltInVsWhereExe -latest -prerelease -property installationVersion | |
$majorVersion = "$installationVersion".Split('.')[0] | |
$MSBuildBinPath="$LatestVisualStudioRoot\MSBuild\$majorVersion.0\Bin" | |
} | |
if (-not (Test-Path $MSBuildBinPath)) | |
{ | |
throw "找不到 MSBuildBinPath!" | |
} | |
echo "MSBuildBinPath=$MSBuildBinPath" >> $env:GITHUB_ENV | |
if($env:GITHUB_REF.StartsWith("refs/tags/v", "CurrentCultureIgnoreCase")) | |
{ | |
$BuildVersion = $env:GITHUB_REF.Remove(0, 11); | |
echo "BuildVersion=$BuildVersion" >> $env:GITHUB_ENV | |
} | |
- name: 执行编译 | |
if: steps.BinCache.outputs.cache-hit != 'true' | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: cmd | |
run: | | |
git submodule update --depth 1 --init --recursive | |
set Path=%GITHUB_WORKSPACE%\Bin;${{env.MSBuildBinPath}};%Path% | |
set LatestVisualStudioRoot=${{env.LatestVisualStudioRoot}} | |
msbuild /m msvcr14x.sln /t:Build /p:Configuration=Release;Platform=x86 -r | |
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel% | |
msbuild /m msvcr14x.sln /t:Build /p:Configuration=AnsiRelease;Platform=x86 -r | |
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel% | |
msbuild /m msvcr14x.sln /t:Build /p:Configuration=Release;Platform=x64 -r | |
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel% | |
msbuild /m msvcr14x.sln /t:Build /p:Configuration=AnsiRelease;Platform=x64 -r | |
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel% | |
- name: 文件打包 | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: cmd | |
run: | | |
mkdir Dlls\x86 | |
mkdir Dlls\x64 | |
copy Release\*.dll Dlls\x86 | |
copy x64\Release\*.dll Dlls\x64 | |
7z a -tzip VC-LTL.Redist.Dlls.zip Dlls | |
mkdir PDBs\x86 | |
mkdir PDBs\x64 | |
copy Release\*.pdb PDBs\x86 | |
copy x64\Release\*.pdb PDBs\x64 | |
7z a -tzip VC-LTL.Redist.PDBs.zip PDBs | |
- uses: xresloader/upload-to-github-release@v1 | |
if: contains(github.ref, 'tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "VC-LTL.*.zip" | |
overwrite: true | |
tags: true | |
draft: false | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
*.zip | |