Skip to content

OnDemand Build Artifacts (MSVC) #2428

OnDemand Build Artifacts (MSVC)

OnDemand Build Artifacts (MSVC) #2428

name: OnDemand Build Artifacts (MSVC)
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
schedule:
- cron: '0 16 * * *'
concurrency:
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
defaults:
run:
shell: cmd
env:
CACHE_EPOCH: 131-1
GOPROXY: direct
jobs:
windows-release:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
arch: [x64, x86, arm64]
crt-linkage: [dynamic]
build_type: [Release]
env:
BUILD_TYPE: '${{ matrix.build_type }}'
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Cache toolchain, nasm, nsis and wixtoolset 3
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
third_party/nasm
third_party/llvm-build/Release+Asserts
third_party/wix311
third_party/nsis
key: ${{ runner.os }}-toolchain-nsis-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- name: Cache msvc curl
id: curl-cache
uses: actions/cache@v4
with:
path: |
third_party/libcurl-vc16-arm64-release-static-ipv6-sspi-schannel
third_party/libcurl-vc16-x64-release-static-ipv6-sspi-schannel
third_party/libcurl-vc16-x86-release-static-ipv6-sspi-schannel
key: ${{ runner.os }}-msvc-dynamic-curl-vc16-${{ matrix.arch }}-v2
- name: Cache crashpad build stage
id: crashpad-cache
uses: actions/cache@v4
with:
path: |
third_party/crashpad
key: ${{ runner.os }}-msvc-dynamic-${{ matrix.arch }}-crashpad-${{ hashFiles('CRASHPAD_COMMIT') }}-v${{ env.CACHE_EPOCH }}-stripped
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.0'
cache-dependency-path: |
tools/go.sum
third_party/boringssl/src/go.sum
- name: Build build tool
run: |
cd tools
go build
- name: "Install dependency: clang, nasm, nsis and wixtoolset 3"
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }}
run: |
scripts\download-toolchain.bat
- name: "Install dependency: curl"
if: ${{ steps.curl-cache.outputs.cache-hit != 'true' }}
run: |
scripts\download-curl-msvc.bat ${{ matrix.arch }}
- name: "Install dependency: cmake (chocolatey)"
run: |
REM choco install -y cmake.portable --version=3.29.8
cmake --version
- name: "Install dependency: ninja (chocolatey)"
run: |
choco install -y ninja
ninja --version
- name: Build Binary (crashpad)
if: ${{ steps.crashpad-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
WITH_CPU=${{ matrix.arch }} SKIP_STRIP=1 ./scripts/build-crashpad.sh
- name: Build Binary
run: |
set VCToolsVersion=
set Winsdk=10.0.22621.0
set "WindowsSDKVersion=%Winsdk%\"
if "${{ matrix.arch }}" == "arm64" (call :SetNewVCToolsVersion)
set vsdevcmd=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat
set "VSCMD_START_DIR=%CD%"
set Platform=${{ matrix.arch }}
call "%vsdevcmd%" -arch=%Platform% -host_arch=amd64 -winsdk=%Winsdk% -no_logo -vcvars_ver=%VCToolsVersion%
tools\build -msvc-tgt-arch=${{ matrix.arch }} -msvc-crt-linkage=${{ matrix.crt-linkage }} -build-benchmark -build-test || exit /b
exit /b 0
:SetNewVCToolsVersion
set VCToolsVersion=
- name: Run tests
if: ${{ matrix.arch == 'x64' || matrix.arch == 'x86' }}
run: |
build-msvc-${{ matrix.arch }}-${{ matrix.crt-linkage }}\yass_test || exit /b
build-msvc-${{ matrix.arch }}-${{ matrix.crt-linkage }}\yass_benchmark || exit /b
- name: Upload dist tarball (including debuginfo)
if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release upload ${{ github.event.release.tag_name }} *.zip *.exe
- name: Upload dist installers
if: ${{ github.event_name == 'release' && matrix.arch != 'arm64' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release upload ${{ github.event.release.tag_name }} *.msi
windows-xp-release:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
crt-linkage: [static]
build_type: [Release]
env:
BUILD_TYPE: '${{ matrix.build_type }}'
steps:
- uses: actions/checkout@v4
- name: Checkout with shallow submodules
run: |
# unshallow must come first otherwise submodule may be get unshallowed
git fetch --tags --unshallow
git submodule update --init --depth 1
- name: Install WinXP support (Visual Studio 2022)
# see https://github.com/actions/runner-images/issues/5143
shell: pwsh
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToAdd = @(
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.VisualStudio.Component.WinXP"
)
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
if ($process.ExitCode -eq 0)
{
Write-Host "components have been successfully added"
}
else
{
Write-Host "components were not installed"
exit 1
}
- name: Cache toolchain, nasm, nsis and wixtoolset 3
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
third_party/nasm
third_party/llvm-build/Release+Asserts
third_party/wix311
third_party/nsis
key: ${{ runner.os }}-toolchain-nsis-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.0'
cache-dependency-path: |
tools/go.sum
third_party/boringssl/src/go.sum
- name: Build build tool
run: |
cd tools
go build
- name: "Install dependency: clang, nasm, nsis and wixtoolset 3"
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }}
run: |
scripts\download-toolchain.bat
- name: "Install dependency: cmake (chocolatey)"
run: |
REM choco install -y cmake.portable --version=3.29.8
cmake --version
- name: "Install dependency: ninja (chocolatey)"
run: |
choco install -y ninja
ninja --version
- name: Patch libcxx for windows xp
shell: bash
run: |
pushd third_party/libc++/trunk
patch -p1 < ../winxp.patch
popd
- name: Build Binary
run: |
set VCToolsVersion=14.16.27012
set "VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC"
set "WindowsSDKVersion=10.0.10240.0\"
set "WindowsSdkDir=C:\Program Files (x86)\Windows Kits\10"
set Platform=${{ matrix.arch }}
set VSCMD_ARG_TGT_ARCH=${{ matrix.arch }}
call "scripts\callxp-%Platform%.cmd"
tools\build -msvc-tgt-arch=${{ matrix.arch }} -msvc-crt-linkage=${{ matrix.crt-linkage }} -msvc-allow-xp -build-test -build-benchmark || exit /b
goto :eof
- name: Run tests
run: |
build-msvc-winxp-${{ matrix.arch }}-${{ matrix.crt-linkage }}\yass_test || exit /b
build-msvc-winxp-${{ matrix.arch }}-${{ matrix.crt-linkage }}\yass_benchmark || exit /b
- name: Upload dist tarball (including debuginfo)
if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release upload ${{ github.event.release.tag_name }} *.msi *.exe *.zip