Files
Build-System/.gitea/workflows/ci.yml
T
faumaray 76b15e79c4
VoidBuildSystem CI / 1 · Requirements (push) Successful in 4s
VoidBuildSystem CI / 2b · Windows native (debug) (push) Failing after 16s
VoidBuildSystem CI / 2b · Windows native (relwithdebinfo) (push) Failing after 8s
VoidBuildSystem CI / 2 · Linux build (debug) (push) Successful in 2m40s
VoidBuildSystem CI / 2 · Linux build (asan) (push) Successful in 5m0s
VoidBuildSystem CI / 2 · Linux build (ubsan) (push) Successful in 5m10s
VoidBuildSystem CI / 2 · Linux build (relwithdebinfo) (push) Successful in 4m46s
VoidBuildSystem CI / 3 · Linux test (asan) (push) Successful in 56s
VoidBuildSystem CI / 3 · Linux test (ubsan) (push) Successful in 1m56s
VoidBuildSystem CI / 3 · Linux test (debug) (push) Failing after 6m43s
VoidBuildSystem CI / 3b · Windows Wine test (debug) (push) Failing after 2m37s
VoidBuildSystem CI / 3b · Windows Wine test (relwithdebinfo) (push) Failing after 2m5s
VoidBuildSystem CI / 3 · Linux test (relwithdebinfo) (push) Failing after 5m35s
VoidBuildSystem CI / 4 · Linux package (asan) (push) Skipped
VoidBuildSystem CI / 4 · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4 · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4 · Linux package (ubsan) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
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).
2026-12-05 15:20:56 +03:00

418 lines
16 KiB
YAML

# VoidBuildSystem CI (Gitea Actions).
#
# Platform x variant pipeline:
#
# 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` (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:
push:
branches: [main]
tags: ["v*"]
pull_request:
workflow_dispatch:
inputs:
publish:
description: "Create/publish the Gitea release (only for a v* tag ref)"
required: false
default: "false"
tag:
description: "Release tag to publish (empty: the pushed tag)"
required: false
default: ""
permissions:
contents: write
jobs:
requirements:
name: "1 · Requirements"
runs-on: echoion-release-serial
steps:
- uses: actions/checkout@v4
- name: Check the toolchain
run: |
g++ --version | head -1
major="$(g++ -dumpversion | cut -d. -f1)"
if [ "${major:-0}" -lt 16 ]; then
echo "GCC 16 or newer is required for C++26 (found ${major:-unknown})" >&2
exit 1
fi
echo 'int main() { return 0; }' | g++ -std=c++26 -freflection -fsyntax-only -x c++ -
cmake --version | head -1
cmake_major="$(cmake --version | sed -nE 's/^cmake version ([0-9]+).*/\1/p')"
if [ "${cmake_major:-0}" -lt 4 ]; then
echo "CMake 4 or newer is required (found ${cmake_major:-unknown})" >&2
exit 1
fi
ninja --version
git --version
- name: Install the development requirements
run: |
# The optional backends (OpenSSL, SQLite3) are opportunistic: a runner that
# provides the GCC 16 toolchain already satisfies the mandatory requirements.
if ! command -v apt-get >/dev/null 2>&1; then
echo "apt-get is not available; using the toolchain provided by the runner"
exit 0
fi
sudo=""
if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi
missing=""
for package in libssl-dev libsqlite3-dev pkg-config; do
if command -v dpkg >/dev/null 2>&1 && dpkg -s "${package}" >/dev/null 2>&1; then
continue
fi
missing="${missing} ${package}"
done
if [ -n "${missing}" ]; then
${sudo} apt-get update
${sudo} apt-get install -y ${missing}
else
echo "all development packages are already installed"
fi
linux-build:
name: "2 · Linux 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: asan
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"
steps:
- uses: actions/checkout@v4
- name: Configure
run: |
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/linux-${{ matrix.variant }}" --parallel 4
- name: Upload the build
uses: actions/upload-artifact@v3
with:
name: vbs-linux-build-${{ matrix.variant }}
path: |
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
linux-test:
name: "3 · Linux test (${{ matrix.variant }})"
needs: linux-build
runs-on: echoion-release-serial
strategy:
fail-fast: false
matrix:
include:
- variant: debug
test_regex: ""
- variant: relwithdebinfo
test_regex: ""
- variant: asan
test_regex: "vbs_sdk_tests|vbs_core_tests"
- variant: ubsan
test_regex: "vbs_sdk_tests|vbs_core_tests"
env:
ASAN_OPTIONS: detect_leaks=1
UBSAN_OPTIONS: print_stacktrace=1
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: Run CTest
run: |
set -o pipefail
if [ -n "${{ matrix.test_regex }}" ]; then
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/linux-${{ matrix.variant }}" --output-on-failure \
--no-tests=error 2>&1 | tee "ctest-linux-${{ matrix.variant }}.log"
fi
- name: Benchmark smoke run
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-linux-test-${{ matrix.variant }}
path: ctest-linux-${{ matrix.variant }}.log
retention-days: 14
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 Linux 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: Install the MinGW-w64 cross toolchain and Wine
run: |
sudo=""
if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi
if ! command -v x86_64-w64-mingw32-g++ >/dev/null 2>&1 ||
! command -v wine >/dev/null 2>&1; then
if command -v apt-get >/dev/null 2>&1; then
${sudo} apt-get update
${sudo} apt-get install -y mingw-w64 wine64 ||
${sudo} apt-get install -y mingw-w64 wine
fi
fi
if ! command -v x86_64-w64-mingw32-g++ >/dev/null 2>&1; then
echo "x86_64-w64-mingw32-g++ is required for the Windows target build" >&2
exit 1
fi
if ! command -v wine >/dev/null 2>&1 && command -v wine64 >/dev/null 2>&1; then
${sudo} ln -sf "$(command -v wine64)" /usr/local/bin/wine
fi
if ! command -v wine >/dev/null 2>&1; then
echo "wine is required to run the Windows test binaries" >&2
exit 1
fi
x86_64-w64-mingw32-g++ --version | head -1
wine --version
- 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 \
--filter track_c_windows_target_cross_build_and_wine_test \
2>&1 | tee "ctest-wine-${{ matrix.variant }}.log"
- name: Upload the Wine log
if: always()
uses: actions/upload-artifact@v3
with:
name: vbs-wine-test-${{ matrix.variant }}
path: ctest-wine-${{ matrix.variant }}.log
retention-days: 14
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: 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: |
@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-windows-package-${{ matrix.variant }}
path: dist-windows-${{ matrix.variant }}/
if-no-files-found: ignore
retention-days: 30
release:
name: "5 · Release"
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 RelWithDebInfo Linux package
uses: actions/download-artifact@v3
with:
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: |
tag="${{ github.event.inputs.tag }}"
if [ -z "${tag}" ]; then tag="${GITHUB_REF_NAME}"; fi
version="$(sed -nE 's/^project\(VoidBuildSystem VERSION ([0-9.]+).*/\1/p' CMakeLists.txt)"
echo "tag=${tag} project version=${version}"
case "${tag}" in
v*) ;;
*) echo "not a release tag (${tag}); skipping the version check" ; exit 0 ;;
esac
if [ "${tag#v}" != "${version}" ]; then
echo "tag ${tag} does not match the project version ${version}" >&2
exit 1
fi
- name: Publish the Gitea release
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
tag="${{ github.event.inputs.tag }}"
if [ -z "${tag}" ]; then tag="${GITHUB_REF_NAME}"; fi
case "${tag}" in
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}' \
"${tag}" "${tag}" "${body}")"
extract_id() {
python3 -c 'import json,sys; s=sys.stdin.read().strip(); print(json.loads(s).get("id","") if s else "")' 2>/dev/null || true
}
# The release may already exist (e.g. created by hand for the tag): fall back to it.
created="$(curl -sS -X POST -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" -d "${payload}" "${api}/releases" || true)"
release_id="$(printf '%s' "${created}" | extract_id)"
if [ -z "${release_id}" ]; then
existing="$(curl -sS -H "Authorization: token ${TOKEN}" \
"${api}/releases/tags/${tag}" || true)"
release_id="$(printf '%s' "${existing}" | extract_id)"
fi
test -n "${release_id}"
for file in dist/*; do
name="$(basename "${file}")"
curl -fsS -X POST -H "Authorization: token ${TOKEN}" \
-F "attachment=@${file}" "${api}/releases/${release_id}/assets?name=${name}" >/dev/null
echo "uploaded ${name}"
done