From 76b15e79c4a716bf34c051e7890b4575f15b9a14 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sat, 5 Dec 2026 15:20:56 +0300 Subject: [PATCH] ci: platform x variant matrix with Windows lanes and packages Split the pipeline into Linux native (Debug, RelWithDebInfo, ASan, UBSan), Windows Wine (Debug, RelWithDebInfo) and Windows native MSYS2 UCRT64 lanes, each with its own test and package jobs whose packages are downloadable from the run. The release publishes only the RelWithDebInfo packages of Linux native and Windows native. Native Windows stays non-blocking until the Track C3 port lands: VBS's platform backends are Linux-only and VoidLibrary does not qualify Archive/Configuration/Crypto/System for Windows yet (Void/Library issue #65). --- .gitea/scripts/windows-native.sh | 43 +++++ .gitea/workflows/ci.yml | 262 ++++++++++++++++++++----------- 2 files changed, 212 insertions(+), 93 deletions(-) create mode 100644 .gitea/scripts/windows-native.sh diff --git a/.gitea/scripts/windows-native.sh b/.gitea/scripts/windows-native.sh new file mode 100644 index 0000000..a68f1f8 --- /dev/null +++ b/.gitea/scripts/windows-native.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Native Windows build, test and package for one variant. +# +# Runs inside MSYS2 UCRT64 (invoked from the ci.yml windows-native job): +# windows-native.sh +# +# Track C3 caveat: the VBS platform backends are Linux-only today and +# VoidLibrary does not qualify Archive/Configuration/Crypto/System for Windows +# yet (Void/Library issue #65), so this lane fails until that port lands. +set -euo pipefail + +variant="${1:?variant}" +build_type="${2:?build type}" + +root="$(cd "$(dirname "$0")/../.." && pwd)" +cd "${root}" + +build="build/windows-${variant}" +out="dist-windows-${variant}" + +cmake -S . -B "${build}" -G Ninja \ + -DCMAKE_BUILD_TYPE="${build_type}" \ + -DCMAKE_CXX_COMPILER=g++ \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +cmake --build "${build}" --parallel 4 +ctest --test-dir "${build}" --output-on-failure + +label="${VBS_RELEASE_TAG:-}" +if [ -z "${label}" ]; then + case "${GITHUB_REF_NAME:-}" in + v*) label="${GITHUB_REF_NAME}" ;; + *) label="dev-$(printf '%s' "${GITHUB_SHA:-local}" | cut -c1-7)" ;; + esac +fi + +stage="$(mktemp -d)" +mkdir -p "${stage}/bin" "${stage}/include" "${stage}/lib" "${out}" +cp "${build}"/bin/*.exe "${stage}/bin/" 2>/dev/null || true +cp -r include/Void "${stage}/include/" +find "${build}" -maxdepth 1 -name 'libVoidBuild_Sdk.a' -exec cp {} "${stage}/lib/" \; +cp README.md LICENSE "${stage}/" +tar -czf "${out}/vbs-${label}-windows-x86_64-${variant}.tar.gz" -C "${stage}" . +ls -l "${out}/" diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 23915f4..924bb1b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,21 +1,28 @@ # VoidBuildSystem CI (Gitea Actions). # -# Multi-stage pipeline with one job per stage step: +# Platform x variant pipeline: # -# 1. requirements verify the GCC 16 toolchain and install development headers -# 2. build one job per configuration (Debug, RelWithDebInfo, ASan, UBSan) -# 3. test one job per build configuration, consuming its build artifact -# 4. package bundle the RelWithDebInfo binaries, the SDK and the source archive -# 5. release optional: publish the packages as a Gitea release (v* tag or -# a manual dispatch with publish=true) +# 1. requirements verify the GCC 16 toolchain and install development headers +# 2. build Linux native (Debug, RelWithDebInfo, ASan, UBSan) +# Windows Wine (Debug, RelWithDebInfo) - cross-built targets +# Windows native MSYS2 UCRT64 (Debug, RelWithDebInfo) +# 3. test one job per build configuration +# 4. package one downloadable package per configuration (run artifacts) +# 5. release publishes ONLY the RelWithDebInfo packages of Linux native +# and Windows native (v* tag or a manual publish dispatch) # -# Runner: `echoion-release-serial` - the GCC 16 builder container (Debian-based, -# with CMake, Ninja, Node and pkg-config). GCC 16 is required for C++26. +# Runner: `echoion-release-serial` (GCC 16 builder container, Debian-based) and +# `windows-x64` (native Windows runner with MSYS2 at C:\msys64). # # Jobs are isolated, so build outputs travel between stages as artifacts. The # artifact paths are uploaded relative to the build directory and restored under # the same workspace-relative location, keeping the absolute paths recorded in # the CTest files valid. +# +# Native Windows is gated on the Track C3 port: VBS's platform backends are +# Linux-only today and VoidLibrary does not qualify Archive/Configuration/ +# Crypto/System for Windows yet (Void/Library issue #65). The windows-native +# lane is non-blocking until that port lands. name: VoidBuildSystem CI on: @@ -84,27 +91,27 @@ jobs: echo "all development packages are already installed" fi - build: - name: "2 · Build (${{ matrix.name }})" + linux-build: + name: "2 · Linux build (${{ matrix.variant }})" needs: requirements runs-on: echoion-release-serial strategy: fail-fast: false matrix: include: - - name: debug + - variant: debug build_type: Debug cxx_flags: "" linker_flags: "" - - name: relwithdebinfo + - variant: relwithdebinfo build_type: RelWithDebInfo cxx_flags: "" linker_flags: "" - - name: asan + - variant: asan build_type: Debug cxx_flags: "-fsanitize=address -fno-omit-frame-pointer" linker_flags: "-fsanitize=address" - - name: ubsan + - variant: ubsan build_type: Debug cxx_flags: "-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" linker_flags: "-fsanitize=undefined" @@ -112,43 +119,43 @@ jobs: - uses: actions/checkout@v4 - name: Configure run: | - cmake -S . -B "build/${{ matrix.name }}" -G Ninja \ + cmake -S . -B "build/linux-${{ matrix.variant }}" -G Ninja \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \ -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.linker_flags }}" \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Build - run: cmake --build "build/${{ matrix.name }}" --parallel 4 + run: cmake --build "build/linux-${{ matrix.variant }}" --parallel 4 - name: Upload the build uses: actions/upload-artifact@v3 with: - name: vbs-build-${{ matrix.name }} + name: vbs-linux-build-${{ matrix.variant }} path: | - build/${{ matrix.name }}/bin/ - build/${{ matrix.name }}/CTestTestfile.cmake - build/${{ matrix.name }}/tests/CTestTestfile.cmake - build/${{ matrix.name }}/_deps/voidlibrary-src/ - !build/${{ matrix.name }}/_deps/voidlibrary-src/.git/ - build/${{ matrix.name }}/libVoidBuild_Sdk.a - build/${{ matrix.name }}/compile_commands.json + build/linux-${{ matrix.variant }}/bin/ + build/linux-${{ matrix.variant }}/CTestTestfile.cmake + build/linux-${{ matrix.variant }}/tests/CTestTestfile.cmake + build/linux-${{ matrix.variant }}/_deps/voidlibrary-src/ + !build/linux-${{ matrix.variant }}/_deps/voidlibrary-src/.git/ + build/linux-${{ matrix.variant }}/libVoidBuild_Sdk.a + build/linux-${{ matrix.variant }}/compile_commands.json retention-days: 7 - test: - name: "3 · Test (${{ matrix.name }})" - needs: build + linux-test: + name: "3 · Linux test (${{ matrix.variant }})" + needs: linux-build runs-on: echoion-release-serial strategy: fail-fast: false matrix: include: - - name: debug + - variant: debug test_regex: "" - - name: relwithdebinfo + - variant: relwithdebinfo test_regex: "" - - name: asan + - variant: asan test_regex: "vbs_sdk_tests|vbs_core_tests" - - name: ubsan + - variant: ubsan test_regex: "vbs_sdk_tests|vbs_core_tests" env: ASAN_OPTIONS: detect_leaks=1 @@ -158,46 +165,105 @@ jobs: - name: Download the build uses: actions/download-artifact@v3 with: - name: vbs-build-${{ matrix.name }} - path: build/${{ matrix.name }} + name: vbs-linux-build-${{ matrix.variant }} + path: build/linux-${{ matrix.variant }} - name: Make the restored binaries executable - run: chmod +x "build/${{ matrix.name }}/bin/"* + run: chmod +x "build/linux-${{ matrix.variant }}/bin/"* - name: Run CTest run: | set -o pipefail if [ -n "${{ matrix.test_regex }}" ]; then - ctest --test-dir "build/${{ matrix.name }}" --output-on-failure \ - --no-tests=error -R "${{ matrix.test_regex }}" 2>&1 | tee "ctest-${{ matrix.name }}.log" + ctest --test-dir "build/linux-${{ matrix.variant }}" --output-on-failure \ + --no-tests=error -R "${{ matrix.test_regex }}" 2>&1 | tee "ctest-linux-${{ matrix.variant }}.log" else - ctest --test-dir "build/${{ matrix.name }}" --output-on-failure \ - --no-tests=error 2>&1 | tee "ctest-${{ matrix.name }}.log" + ctest --test-dir "build/linux-${{ matrix.variant }}" --output-on-failure \ + --no-tests=error 2>&1 | tee "ctest-linux-${{ matrix.variant }}.log" fi - name: Benchmark smoke run - if: matrix.name == 'debug' - run: build/debug/bin/vbs_benchmarks --files 15 + if: matrix.variant == 'debug' + run: build/linux-debug/bin/vbs_benchmarks --files 15 - name: Upload the test log if: always() uses: actions/upload-artifact@v3 with: - name: vbs-test-${{ matrix.name }} - path: ctest-${{ matrix.name }}.log + name: vbs-linux-test-${{ matrix.variant }} + path: ctest-linux-${{ matrix.variant }}.log retention-days: 14 - windows: - name: "3b · Windows (MinGW-w64 + Wine)" - needs: build + linux-package: + name: "4 · Linux package (${{ matrix.variant }})" + needs: linux-test runs-on: echoion-release-serial + strategy: + fail-fast: false + matrix: + include: + - variant: debug + - variant: relwithdebinfo + - variant: asan + - variant: ubsan + steps: + - uses: actions/checkout@v4 + - name: Download the build + uses: actions/download-artifact@v3 + with: + name: vbs-linux-build-${{ matrix.variant }} + path: build/linux-${{ matrix.variant }} + - name: Make the restored binaries executable + run: chmod +x "build/linux-${{ matrix.variant }}/bin/"* + - name: Package the binaries, the SDK and the headers + run: | + set -eu + label="${{ github.event.inputs.tag }}" + if [ -z "${label}" ]; then + case "${GITHUB_REF_NAME}" in + v*) label="${GITHUB_REF_NAME}" ;; + *) label="dev-$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" ;; + esac + fi + stage="$(mktemp -d)" + out="dist-linux-${{ matrix.variant }}" + mkdir -p "${stage}/bin" "${stage}/include" "${stage}/lib" "${out}" + cp "build/linux-${{ matrix.variant }}/bin/vbs" \ + "build/linux-${{ matrix.variant }}/bin/vbs-registry" "${stage}/bin/" + cp -r include/Void "${stage}/include/" + cp "build/linux-${{ matrix.variant }}/libVoidBuild_Sdk.a" "${stage}/lib/" + cp README.md LICENSE "${stage}/" + tar --sort=name --mtime='@0' --owner=0 --group=0 --numeric-owner \ + -czf "${out}/vbs-${label}-linux-x86_64-${{ matrix.variant }}.tar.gz" -C "${stage}" . + if [ "${{ matrix.variant }}" = "relwithdebinfo" ]; then + "build/linux-${{ matrix.variant }}/bin/vbs" pack --project . \ + --output "${out}/vbs-${label}-source.tar" + fi + ls -l "${out}/" + - name: Upload the package + uses: actions/upload-artifact@v3 + with: + name: vbs-linux-package-${{ matrix.variant }} + path: dist-linux-${{ matrix.variant }}/ + retention-days: 30 + + windows-wine: + name: "3b · Windows Wine test (${{ matrix.variant }})" + needs: linux-build + runs-on: echoion-release-serial + strategy: + fail-fast: false + matrix: + include: + - variant: debug + - variant: relwithdebinfo env: WINEDEBUG: "-all" steps: - uses: actions/checkout@v4 - - name: Download the debug build + - name: Download the Linux build uses: actions/download-artifact@v3 with: - name: vbs-build-debug - path: build/debug + name: vbs-linux-build-${{ matrix.variant }} + path: build/linux-${{ matrix.variant }} - name: Make the restored binaries executable - run: chmod +x build/debug/bin/* + run: chmod +x "build/linux-${{ matrix.variant }}/bin/"* - name: Install the MinGW-w64 cross toolchain and Wine run: | sudo="" @@ -226,70 +292,77 @@ jobs: - name: Cross-build a Windows target and run it under Wine run: | set -o pipefail - build/debug/bin/vbs_v1_tests --no-color \ + "build/linux-${{ matrix.variant }}/bin/vbs_v1_tests" --no-color \ --filter track_c_windows_target_cross_build_and_wine_test \ - 2>&1 | tee ctest-windows.log - - name: Upload the Windows log + 2>&1 | tee "ctest-wine-${{ matrix.variant }}.log" + - name: Upload the Wine log if: always() uses: actions/upload-artifact@v3 with: - name: vbs-test-windows - path: ctest-windows.log + name: vbs-wine-test-${{ matrix.variant }} + path: ctest-wine-${{ matrix.variant }}.log retention-days: 14 - package: - name: "4 · Package" - needs: test - runs-on: echoion-release-serial + windows-native: + name: "2b · Windows native (${{ matrix.variant }})" + needs: requirements + runs-on: windows-x64 + # Track C3 port in progress: the VBS platform backends are Linux-only and + # VoidLibrary does not qualify Archive/Configuration/Crypto/System for + # Windows yet (Void/Library issue #65). Non-blocking until that lands. + continue-on-error: true + strategy: + fail-fast: false + matrix: + include: + - variant: debug + build_type: Debug + - variant: relwithdebinfo + build_type: RelWithDebInfo steps: - uses: actions/checkout@v4 - - name: Download the RelWithDebInfo build - uses: actions/download-artifact@v3 - with: - name: vbs-build-relwithdebinfo - path: build/relwithdebinfo - - name: Make the restored binaries executable - run: chmod +x build/relwithdebinfo/bin/* - - name: Package the binaries, the SDK and the source + - name: Configure, build, test and package with MSYS2 UCRT64 + shell: cmd + env: + VBS_MSYS2_ROOT: ${{ vars.VBS_MSYS2_ROOT || 'C:\msys64' }} + VBS_RELEASE_TAG: ${{ github.event.inputs.tag }} run: | - set -eu - label="${{ github.event.inputs.tag }}" - if [ -z "${label}" ]; then - case "${GITHUB_REF_NAME}" in - v*) label="${GITHUB_REF_NAME}" ;; - *) label="dev-$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" ;; - esac - fi - stage="$(mktemp -d)" - mkdir -p "${stage}/bin" "${stage}/include" "${stage}/lib" dist - cp build/relwithdebinfo/bin/vbs build/relwithdebinfo/bin/vbs-registry "${stage}/bin/" - cp -r include/Void "${stage}/include/" - cp build/relwithdebinfo/libVoidBuild_Sdk.a "${stage}/lib/" - cp README.md LICENSE "${stage}/" - tar --sort=name --mtime='@0' --owner=0 --group=0 --numeric-owner \ - -czf "dist/vbs-${label}-linux-x86_64.tar.gz" -C "${stage}" . - build/relwithdebinfo/bin/vbs pack --project . --output "dist/vbs-${label}-source.tar" - rm -f dist/SHA256SUMS - (cd dist && sha256sum ./* > SHA256SUMS) - ls -l dist/ - - name: Upload the packages + @echo off + setlocal EnableExtensions + if not exist "%VBS_MSYS2_ROOT%\usr\bin\bash.exe" ( + echo Windows CI: MSYS2 bash.exe was not found under VBS_MSYS2_ROOT. 1>&2 + exit /b 1 + ) + set "MSYSTEM=UCRT64" + set "CHERE_INVOKING=1" + set "MSYS2_PATH_TYPE=strict" + "%VBS_MSYS2_ROOT%\usr\bin\bash.exe" --login -c "tr -d '\r' < .gitea/scripts/windows-native.sh | bash -s -- ${{ matrix.variant }} ${{ matrix.build_type }}" + - name: Upload the Windows package + if: always() uses: actions/upload-artifact@v3 with: - name: vbs-packages - path: dist/ + name: vbs-windows-package-${{ matrix.variant }} + path: dist-windows-${{ matrix.variant }}/ + if-no-files-found: ignore retention-days: 30 release: name: "5 · Release" - needs: package + needs: linux-package if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true' runs-on: echoion-release-serial steps: - uses: actions/checkout@v4 - - name: Download the packages + - name: Download the RelWithDebInfo Linux package uses: actions/download-artifact@v3 with: - name: vbs-packages + name: vbs-linux-package-relwithdebinfo + path: dist + - name: Download the RelWithDebInfo Windows package (when available) + continue-on-error: true + uses: actions/download-artifact@v3 + with: + name: vbs-windows-package-relwithdebinfo path: dist - name: Verify the tag matches the project version run: | @@ -316,6 +389,9 @@ jobs: v*) ;; *) echo "not a release tag (${tag}); skipping the release upload" ; exit 0 ;; esac + rm -f dist/SHA256SUMS + (cd dist && sha256sum ./* > SHA256SUMS) + ls -l dist/ api="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" body="$(printf 'Release %s\n\nBuilt from %s with the full CTest suite green.\nSee SHA256SUMS for artifact digests.' "${tag}" "${GITHUB_SHA}")" payload="$(printf '{"tag_name":"%s","name":"%s","body":"%s","draft":false,"prerelease":false}' \