OnDemand Build Artifacts (Old MinGW) #2247
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: OnDemand Build Artifacts (Old MinGW) | |
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 * * *' | |
env: | |
CACHE_EPOCH: 131-1 | |
GOPROXY: direct | |
jobs: | |
mingw64-release: | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- arch: i686 | |
mingw_dir: mingw32 | |
build_type: Release | |
gcc_ver: 7.5.0 | |
- arch: x86_64 | |
mingw_dir: mingw64 | |
build_type: Release | |
gcc_ver: 7.5.0 | |
defaults: | |
run: | |
shell: cmd | |
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 mingw64 sysroot | |
id: sysroot-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
third_party/mingw64 | |
third_party/mingw32 | |
key: ${{ runner.os }}-mingw64-sysroot-${{ matrix.arch }}-v1 | |
- name: Cache mingw64 curl | |
id: curl-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
third_party/curl-8.4.0_7-win64-mingw | |
third_party/curl-8.4.0_7-win32-mingw | |
key: ${{ runner.os }}-mingw64-curl-${{ matrix.arch }}-v1 | |
- name: "Install dependency: clang (chocolatey)" | |
run: | | |
REM choco upgrade -y llvm --version=18.1.8 | |
clang -v | |
- name: "Install dependency: mingw64 sysroot" | |
if: ${{ steps.sysroot-cache.outputs.cache-hit != 'true' }} | |
run: | | |
scripts\download-toolchain-mingw.bat ${{ matrix.arch }} | |
- name: "Install dependency: curl" | |
if: ${{ steps.curl-cache.outputs.cache-hit != 'true' }} | |
shell: bash | |
run: | | |
./scripts/download-curl-mingw.sh ${{ matrix.arch }} | |
- name: "Install dependency: nasm (chocolatey)" | |
run: | | |
choco install -y nasm | |
"C:\Program Files\NASM\nasm" --version | |
- 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 | |
pushd third_party/libc++abi/trunk | |
patch -p1 < ../winxp.patch | |
popd | |
echo "CMAKE_OPTIONS=-DALLOW_XP=on" >> $GITHUB_ENV | |
- name: Build Binary | |
run: | | |
set CC=clang | |
set CXX=clang++ | |
set "CFLAGS=-I %CD%\third_party\${{ matrix.mingw_dir }}\lib\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}\include" | |
set "CXXFLAGS=-I %CD%\third_party\${{ matrix.mingw_dir }}\lib\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}\include" | |
set "LDFLAGS=-Wl,-L%CD%\third_party\${{ matrix.mingw_dir }}\lib -Wl,-L%CD%\third_party\${{ matrix.mingw_dir }}\lib\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}" | |
set "Path=%CD%\third_party\${{ matrix.mingw_dir }}\bin;%Path%" | |
set "Path=C:\Program Files\NASM\nasm;%Path%" | |
REM for clang.exe and clang++.exe | |
REM set "Path=C:\Program Files\LLVM\bin;%Path%" | |
REM remove conflicting heaaders | |
del "%CD%\third_party\${{ matrix.mingw_dir }}\lib\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}\include\std*.h" | |
del "%CD%\third_party\${{ matrix.mingw_dir }}\lib\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}\include\*intrin.h" | |
del "%CD%\third_party\${{ matrix.mingw_dir }}\lib\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}\include\mm3dnow.h" | |
REM start to build with workaround | |
mkdir build-mingw | |
cd build-mingw | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_BENCHMARKS=on -DBUILD_TESTS=on -DGUI=on -DMINGW_MSVCRT100=on -DMINGW_WORKAROUND=on .. ${{ env.CMAKE_OPTIONS }} -DCMAKE_C_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DCMAKE_CXX_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DCMAKE_ASM_COMPILER_TARGET=${{ matrix.arch }}-pc-windows-gnu -DCMAKE_SYSROOT="%CD%\..\third_party\${{ matrix.mingw_dir }}\${{ matrix.arch }}-w64-mingw32" -DUSE_LIBCXX=on -DENABLE_LLD=on -DUSE_ZLIB=on -DUSE_JSONCPP=on -DUSE_CARES=on | |
ninja yass yass_benchmark yass_test | |
- name: Populate depedencies (libgcc-i686) | |
if: ${{ matrix.arch == 'i686' }} | |
run: | | |
REM copy libgcc runtime | |
xcopy /F third_party\${{ matrix.mingw_dir }}\libexec\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}\libgcc_s_dw2-1.dll build-mingw | |
- name: Populate depedencies (libgcc-x86_64) | |
if: ${{ matrix.arch == 'x86_64' }} | |
run: | | |
REM copy libgcc runtime | |
xcopy /F third_party\${{ matrix.mingw_dir }}\libexec\gcc\${{ matrix.arch }}-w64-mingw32\${{ matrix.gcc_ver }}\libgcc_s_seh-1.dll build-mingw | |
- name: Packaging | |
shell: bash | |
run: | | |
cd build-mingw | |
# https://www.systutorials.com/docs/linux/man/1-x86_64-w64-mingw32-objcopy/ | |
# create a file containing the debugging info. | |
llvm-objcopy --only-keep-debug yass.exe yass.exe.dbg | |
# stripped executable. | |
llvm-objcopy --strip-debug yass.exe | |
# to add a link to the debugging info into the stripped executable. | |
llvm-objcopy --add-gnu-debuglink=yass.exe.dbg yass.exe | |
export PREFIX=yass-win-mingw64-${{ matrix.arch }}-${{ github.event.release.tag_name }} | |
# generate archive | |
rm -rf $PREFIX | |
mkdir $PREFIX | |
cp -f yass.exe $PREFIX/ | |
cp -fv *.dll $PREFIX/ | |
"/c/Program Files/7-Zip/7z.exe" a -tzip ../$PREFIX.zip $PREFIX | |
# generate debuginfo archive | |
rm -rf $PREFIX | |
mkdir $PREFIX | |
cp -f yass.exe.dbg $PREFIX/ | |
"/c/Program Files/7-Zip/7z.exe" a -tzip ../$PREFIX-debuginfo.zip $PREFIX | |
- name: Populate depedencies (Tests-i686) | |
if: ${{ matrix.arch == 'i686' }} | |
run: | | |
xcopy /F third_party\curl-8.4.0_7-win32-mingw\bin\libcurl.dll build-mingw | |
REM Install vcredist2010 | |
curl -L -O https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe | |
vcredist_x86.exe /install /quiet /norestart | |
del vcredist_x86.exe | |
- name: Populate depedencies (Tests-x86_64) | |
if: ${{ matrix.arch == 'x86_64' }} | |
run: | | |
xcopy /F third_party\curl-8.4.0_7-win64-mingw\bin\libcurl-x64.dll build-mingw | |
REM Install vcredist2010 | |
curl -L -O https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe | |
vcredist_x64.exe /install /quiet /norestart | |
del vcredist_x64.exe | |
- name: Run unittests | |
shell: bash | |
run: | | |
cd build-mingw | |
./yass_test | |
./yass_benchmark | |
- name: Upload dist tarball | |
if: ${{ github.event_name == 'release' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
gh release upload ${{ github.event.release.tag_name }} *.zip |