diff --git a/.gitea/scripts/windows-native.sh b/.gitea/scripts/windows-native.sh index 7f9bce2..8b82049 100644 --- a/.gitea/scripts/windows-native.sh +++ b/.gitea/scripts/windows-native.sh @@ -1,22 +1,22 @@ #!/usr/bin/env bash -# Native Windows build, test and package for one variant. +# Native Windows lane for one variant, driven inside MSYS2 UCRT64. # -# Runs inside MSYS2 UCRT64 (invoked from the ci.yml windows-native job): -# windows-native.sh +# windows-native.sh build configure + build +# windows-native.sh test test + package # # 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}" +phase="${1:?phase (build or test)}" +variant="${2:?variant}" +build_type="${3:?build type}" root="$(cd "$(dirname "$0")/../.." && pwd)" cd "${root}" build="build/windows-${variant}" -out="dist-windows-${variant}" # Make sure the UCRT64 environment provides the build tools. if ! command -v cmake >/dev/null 2>&1 || ! command -v ninja >/dev/null 2>&1; then @@ -28,26 +28,37 @@ if ! command -v cmake >/dev/null 2>&1 || ! command -v ninja >/dev/null 2>&1; the fi fi -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 +case "${phase}" in +build) + 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 + ;; +test) + ctest --test-dir "${build}" --output-on-failure --no-tests=error -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 + out="dist-windows-${variant}" + 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}/" + 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}/" + ;; +*) + echo "unknown phase '${phase}' (expected build or test)" >&2 + exit 2 + ;; +esac diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index b8b8032..cbfc5da 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,15 +1,13 @@ # VoidBuildSystem CI (Gitea Actions). # -# Platform x variant pipeline: +# Graph: # -# 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) +# 1. Requirements +# 2A. Linux build (Debug, RelWithDebInfo, Sanitizers) -> 3A. Linux tests +# 2B. Windows Wine build (same variants) -> 3B. Windows Wine tests +# 2C. Windows Native build (same variants) -> 3C. Windows Native tests +# 4. Packages (one downloadable package per configuration) +# 5. Release (RelWithDebInfo Linux + Windows packages) # # Runner: `echoion-release-serial` (GCC 16 builder container, Debian-based) and # `windows-x64` (native Windows runner with MSYS2 at C:\msys64). @@ -21,7 +19,7 @@ # # 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 +# Crypto/System for Windows yet (Void/Library issue #65). The Windows native # lane is non-blocking until that port lands. name: VoidBuildSystem CI @@ -91,8 +89,11 @@ jobs: echo "all development packages are already installed" fi + # --------------------------------------------------------------------------- + # 2A / 3A - Linux native + # --------------------------------------------------------------------------- linux-build: - name: "2 · Linux build (${{ matrix.variant }})" + name: "2A · Linux build (${{ matrix.variant }})" needs: requirements runs-on: echoion-release-serial strategy: @@ -107,14 +108,10 @@ jobs: build_type: RelWithDebInfo cxx_flags: "" linker_flags: "" - - variant: asan + - variant: sanitizers build_type: Debug - cxx_flags: "-fsanitize=address -fno-omit-frame-pointer" - linker_flags: "-fsanitize=address" - - variant: ubsan - build_type: Debug - cxx_flags: "-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" - linker_flags: "-fsanitize=undefined" + cxx_flags: "-fsanitize=address,undefined -fno-omit-frame-pointer" + linker_flags: "-fsanitize=address,undefined" steps: - uses: actions/checkout@v4 - name: Configure @@ -142,7 +139,7 @@ jobs: retention-days: 7 linux-test: - name: "3 · Linux test (${{ matrix.variant }})" + name: "3A · Linux test (${{ matrix.variant }})" needs: linux-build runs-on: echoion-release-serial strategy: @@ -153,9 +150,7 @@ jobs: test_regex: "" - variant: relwithdebinfo test_regex: "" - - variant: asan - test_regex: "vbs_sdk_tests|vbs_core_tests" - - variant: ubsan + - variant: sanitizers test_regex: "vbs_sdk_tests|vbs_core_tests" env: ASAN_OPTIONS: detect_leaks=1 @@ -191,7 +186,7 @@ jobs: retention-days: 14 linux-package: - name: "4 · Linux package (${{ matrix.variant }})" + name: "4A · Linux package (${{ matrix.variant }})" needs: linux-test runs-on: echoion-release-serial strategy: @@ -200,8 +195,7 @@ jobs: include: - variant: debug - variant: relwithdebinfo - - variant: asan - - variant: ubsan + - variant: sanitizers steps: - uses: actions/checkout@v4 - name: Download the build @@ -243,9 +237,55 @@ jobs: path: dist-linux-${{ matrix.variant }}/ retention-days: 30 - windows-wine: - name: "3b · Windows Wine test (${{ matrix.variant }})" - needs: linux-build + # --------------------------------------------------------------------------- + # 2B / 3B - Windows Wine (Linux host, MinGW-w64 cross build, Wine execution) + # --------------------------------------------------------------------------- + wine-build: + name: "2B · Windows Wine build (${{ matrix.variant }})" + needs: requirements + runs-on: echoion-release-serial + strategy: + fail-fast: false + matrix: + include: + - variant: debug + build_type: Debug + cxx_flags: "" + linker_flags: "" + - variant: relwithdebinfo + build_type: RelWithDebInfo + cxx_flags: "" + linker_flags: "" + - variant: sanitizers + build_type: Debug + cxx_flags: "-fsanitize=address,undefined -fno-omit-frame-pointer" + linker_flags: "-fsanitize=address,undefined" + steps: + - uses: actions/checkout@v4 + - name: Configure + run: | + cmake -S . -B "build/wine-${{ 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 }}" + - name: Build the orchestrator and its tests + run: | + cmake --build "build/wine-${{ matrix.variant }}" \ + --target vbs vbs_v1_tests --parallel 4 + - name: Upload the build + uses: actions/upload-artifact@v3 + with: + name: vbs-wine-build-${{ matrix.variant }} + path: | + build/wine-${{ matrix.variant }}/bin/ + build/wine-${{ matrix.variant }}/_deps/voidlibrary-src/ + !build/wine-${{ matrix.variant }}/_deps/voidlibrary-src/.git/ + retention-days: 7 + + wine-test: + name: "3B · Windows Wine test (${{ matrix.variant }})" + needs: wine-build runs-on: echoion-release-serial strategy: fail-fast: false @@ -253,17 +293,18 @@ jobs: include: - variant: debug - variant: relwithdebinfo + - variant: sanitizers env: WINEDEBUG: "-all" steps: - uses: actions/checkout@v4 - - name: Download the Linux build + - name: Download the build uses: actions/download-artifact@v3 with: - name: vbs-linux-build-${{ matrix.variant }} - path: build/linux-${{ matrix.variant }} + name: vbs-wine-build-${{ matrix.variant }} + path: build/wine-${{ matrix.variant }} - name: Make the restored binaries executable - run: chmod +x "build/linux-${{ matrix.variant }}/bin/"* + run: chmod +x "build/wine-${{ matrix.variant }}/bin/"* - name: Install the MinGW-w64 cross toolchain and Wine run: | sudo="" @@ -292,7 +333,7 @@ jobs: - name: Cross-build a Windows target and run it under Wine run: | set -o pipefail - "build/linux-${{ matrix.variant }}/bin/vbs_v1_tests" --no-color \ + "build/wine-${{ matrix.variant }}/bin/vbs_v1_tests" --no-color \ --filter track_c_windows_target_cross_build_and_wine_test \ 2>&1 | tee "ctest-wine-${{ matrix.variant }}.log" - name: Upload the Wine log @@ -303,8 +344,11 @@ jobs: path: ctest-wine-${{ matrix.variant }}.log retention-days: 14 - windows-native: - name: "2b · Windows native (${{ matrix.variant }})" + # --------------------------------------------------------------------------- + # 2C / 3C - Windows native (MSYS2 UCRT64) + # --------------------------------------------------------------------------- + windows-native-build: + name: "2C · Windows native build (${{ matrix.variant }})" needs: requirements runs-on: windows-x64 # Track C3 port in progress: the VBS platform backends are Linux-only and @@ -319,9 +363,57 @@ jobs: build_type: Debug - variant: relwithdebinfo build_type: RelWithDebInfo + - variant: sanitizers + build_type: Debug steps: - uses: actions/checkout@v4 - - name: Configure, build, test and package with MSYS2 UCRT64 + - name: Configure and build with MSYS2 UCRT64 + shell: cmd + env: + VBS_MSYS2_ROOT: ${{ vars.VBS_MSYS2_ROOT || 'C:\msys64' }} + run: | + @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 'cd "$(cygpath -u "$GITHUB_WORKSPACE")" && tr -d "\r" < .gitea/scripts/windows-native.sh | bash -s -- build ${{ matrix.variant }} ${{ matrix.build_type }}' + - name: Upload the build + if: always() + uses: actions/upload-artifact@v3 + with: + name: vbs-windows-build-${{ matrix.variant }} + path: build/windows-${{ matrix.variant }}/ + if-no-files-found: ignore + retention-days: 7 + + windows-native-test: + name: "3C · Windows native test (${{ matrix.variant }})" + needs: windows-native-build + runs-on: windows-x64 + continue-on-error: true + strategy: + fail-fast: false + matrix: + include: + - variant: debug + build_type: Debug + - variant: relwithdebinfo + build_type: RelWithDebInfo + - variant: sanitizers + build_type: Debug + steps: + - uses: actions/checkout@v4 + - name: Download the build + uses: actions/download-artifact@v3 + with: + name: vbs-windows-build-${{ matrix.variant }} + path: build/windows-${{ matrix.variant }} + - name: Test and package with MSYS2 UCRT64 shell: cmd env: VBS_MSYS2_ROOT: ${{ vars.VBS_MSYS2_ROOT || 'C:\msys64' }} @@ -336,7 +428,7 @@ jobs: set "MSYSTEM=UCRT64" set "CHERE_INVOKING=1" set "MSYS2_PATH_TYPE=strict" - "%VBS_MSYS2_ROOT%\usr\bin\bash.exe" --login -c 'cd "$(cygpath -u "$GITHUB_WORKSPACE")" && tr -d "\r" < .gitea/scripts/windows-native.sh | bash -s -- ${{ matrix.variant }} ${{ matrix.build_type }}' + "%VBS_MSYS2_ROOT%\usr\bin\bash.exe" --login -c 'cd "$(cygpath -u "$GITHUB_WORKSPACE")" && tr -d "\r" < .gitea/scripts/windows-native.sh | bash -s -- test ${{ matrix.variant }} ${{ matrix.build_type }}' - name: Upload the Windows package if: always() uses: actions/upload-artifact@v3 @@ -346,6 +438,9 @@ jobs: if-no-files-found: ignore retention-days: 30 + # --------------------------------------------------------------------------- + # 5 - Release + # --------------------------------------------------------------------------- release: name: "5 · Release" needs: linux-package