Skip to content

Build Artifacts (MinGW) #2350

Build Artifacts (MinGW)

Build Artifacts (MinGW) #2350

name: Build Artifacts (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
pull_request:
branches: [master, develop]
paths-ignore:
- '**/*.md'
- '.circleci/**'
- '.cirrus.yml'
push:
branches: [master, develop]
paths-ignore:
- '**/*.md'
- '.circleci/**'
- '.cirrus.yml'
release:
types: [published]
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') }}
env:
CACHE_EPOCH: 131-1
GOPROXY: direct
jobs:
mingw64-release:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- arch: i686
variant: msvcrt
- arch: x86_64
variant: ucrt
- arch: aarch64
variant: ucrt
env:
BUILD_TYPE: 'Release'
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
id: toolchain-cache
uses: actions/cache@v4
with:
path: |
third_party/llvm-build/Release+Asserts
key: ${{ runner.os }}-toolchain-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }}
- name: Cache mingw64 llvm sysroot
id: sysroot-cache
uses: actions/cache@v4
with:
path: |
third_party/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64
key: ${{ runner.os }}-mingw64-sysroot-third_party-llvm-20240619-${{ matrix.variant }}-v1
- name: Cache mingw64 curl
id: curl-cache
uses: actions/cache@v4
with:
path: |
third_party/curl-8.4.0_7-win64a-mingw
third_party/curl-8.4.0_7-win64-mingw
third_party/curl-8.4.0_7-win32-mingw
key: ${{ runner.os }}-mingw64-curl-and-aarch64-v1
- 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: prebuilt clang and clang-tidy binaries"
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }}
run: |
./scripts/download-clang-prebuilt-binaries.py
rm -f third_party/llvm-build/Release+Asserts/*.tgz
- name: "Install dependency: llvm-mingw sysroot"
if: ${{ steps.sysroot-cache.outputs.cache-hit != 'true' }}
run: |
pushd third_party
curl -L -O https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64.tar.xz
tar -xf llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64.tar.xz
rm -vf llvm-mingw-*.xz
popd
- name: "Install dependency: curl"
if: ${{ steps.curl-cache.outputs.cache-hit != 'true' }}
run: |
./scripts/download-curl-mingw.sh i686
./scripts/download-curl-mingw.sh x86_64
./scripts/download-curl-mingw.sh aarch64
- name: Change ubuntu mirror
run: |
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update -qq
- name: Populate depedencies
run: |
sudo apt-get update -qq
sudo apt-get install -y cmake ninja-build nasm zip nsis locales-all
- name: Populate dependencie (cmake, overwrite)
run: |
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.29.8/cmake-3.29.8-linux-x86_64.tar.gz
sudo tar -C /usr/local --strip-components=1 -xf cmake-3.29.8-linux-x86_64.tar.gz
cmake --version
rm -f *.tar.gz
- name: Populate depedencies (i686)
if: ${{ matrix.arch == 'i686' }}
run: |
sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -y wine wine32
- name: Populate depedencies (x86_64)
if: ${{ matrix.arch == 'x86_64' }}
run: |
sudo apt-get update -qq
sudo apt-get install -y wine wine64
- name: Patch libcxx for windows xp
if: ${{ matrix.arch == 'i686' || matrix.arch == 'x86_64' }}
run: |
pushd third_party/libc++/trunk
patch -p1 < ../winxp.patch
popd
pushd third_party/libc++abi/trunk
patch -p1 < ../winxp.patch
popd
echo "BUILD_OPTIONS=-mingw-allow-xp -enable-lto=false" >> $GITHUB_ENV
- name: Build Binary
run: |
# fix cpack error on C.UTF-8 locale
# see https://github.com/lightspark/lightspark/discussions/604#discussioncomment-1034262
export LC_ALL=en_US.UTF-8
./tools/build --variant gui --arch ${{ matrix.arch }} --system mingw \
-build-test -build-benchmark \
-mingw-dir $PWD/third_party/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64 \
${{ env.BUILD_OPTIONS }}
- name: Populate depedencies (Tests-i686)
if: ${{ matrix.arch == 'i686' }}
run: |
# copy curl dll required by yass_test
cp -v third_party/curl-8.4.0_7-win32-mingw/bin/libcurl.dll build-mingw-winxp-${{ matrix.arch }}/
- name: Populate depedencies (Tests-x86_64)
if: ${{ matrix.arch == 'x86_64' }}
run: |
# copy curl dll required by yass_test
cp -v third_party/curl-8.4.0_7-win64-mingw/bin/libcurl-x64.dll build-mingw-winxp-${{ matrix.arch }}/
- name: Run tests
if: ${{ matrix.arch == 'i686' || matrix.arch == 'x86_64' }}
run: |
cd build-mingw-winxp-${{ matrix.arch }}
wine yass_test.exe
wine yass_benchmark.exe
- name: Upload dist tarball
if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} *.zip *.exe