Files
Build-System/.gitea/workflows/ci.yml
T
faumaray 1f9a5d5804
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 5m38s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 6s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m48s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m49s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 5m32s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m26s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m49s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m9s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 16s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 20s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 5m49s
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Failing after 59s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Failing after 1m6s
VoidBuildSystem CI / 5 · Release (push) Skipped
ci: print a compact installer error summary
The artifact cannot be fetched through the API, and the job log
truncates long lines: grep the first error lines from the captured log
and cut them so they survive in the log.
2026-12-06 12:38:18 +03:00

500 lines
19 KiB
YAML

# VoidBuildSystem CI (Gitea Actions).
#
# Graph:
#
# 1. Requirements
# 2A. Linux build (Debug, RelWithDebInfo, Sanitizers) -> 3A. Linux tests
# 2B. Windows Wine build (Debug, RelWithDebInfo) -> 3B. Windows Wine tests
# 4A/4B. Packages (one downloadable package per configuration)
# 5. Release (RelWithDebInfo Linux + Windows packages)
#
# Runners: `vulkan` for the Linux lanes and `windows-gcc` for the Windows
# (MinGW-w64 cross build + Wine) lane; both are the Void CI images
# (git.faumaray.com/void/ci-images). `windows-clang` is not used because VBS's
# C++26 reflection requires GCC.
#
# 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.
#
# The Windows lane cross-compiles VBS with MinGW-w64 and runs the resulting
# executables under Wine, so no Windows runner is required.
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: vulkan
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
bash .gitea/scripts/install-ninja.sh
git --version
# ---------------------------------------------------------------------------
# 2A / 3A - Linux native
# ---------------------------------------------------------------------------
linux-build:
name: "2A · Linux build (${{ matrix.variant }})"
needs: requirements
runs-on: vulkan
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/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: "3A · Linux test (${{ matrix.variant }})"
needs: linux-build
runs-on: vulkan
strategy:
fail-fast: false
matrix:
include:
- variant: debug
test_regex: ""
- variant: relwithdebinfo
test_regex: ""
- variant: sanitizers
test_regex: "vbs_sdk_tests|vbs_core_tests"
env:
ASAN_OPTIONS: detect_leaks=1
UBSAN_OPTIONS: print_stacktrace=1
steps:
- uses: actions/checkout@v4
# Jobs are fresh containers: the upgrade done by `requirements` does not carry over.
- name: Ensure Ninja >= 1.11 (CMake module scanning in the suite)
run: bash .gitea/scripts/install-ninja.sh
- 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
wine-build:
name: "2B · Windows Wine build (${{ matrix.variant }})"
needs: requirements
runs-on: windows-gcc
strategy:
fail-fast: false
matrix:
include:
- variant: debug
build_type: Debug
- variant: relwithdebinfo
build_type: RelWithDebInfo
steps:
- uses: actions/checkout@v4
- name: Configure
run: |
cmake -S . -B "build/wine-${{ matrix.variant }}" -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$PWD/.gitea/cmake/mingw-w64-toolchain.cmake" \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Build
run: cmake --build "build/wine-${{ matrix.variant }}" --parallel 4
- name: Stage the MinGW runtime DLLs
run: |
for lib in libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll; do
if [ -f "/usr/x86_64-w64-mingw32/bin/${lib}" ]; then
cp "/usr/x86_64-w64-mingw32/bin/${lib}" \
"build/wine-${{ matrix.variant }}/bin/"
fi
done
- name: Upload the build
uses: actions/upload-artifact@v3
with:
name: vbs-wine-build-${{ matrix.variant }}
# Downstream jobs only run and package the binaries: no sources or
# object files are needed, which keeps the artifact small.
path: |
build/wine-${{ matrix.variant }}/bin/
build/wine-${{ matrix.variant }}/libVoidBuild_Sdk.a
retention-days: 7
wine-test:
name: "3B · Windows Wine test (${{ matrix.variant }})"
needs: wine-build
runs-on: windows-gcc
# The Wine-hosted suite is still maturing (parts of the Win32 runtime the
# tests rely on are incomplete in Wine): it reports but does not block
# packaging. Remove continue-on-error once the suite is green.
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- variant: debug
- variant: relwithdebinfo
env:
WINEDEBUG: "-all"
steps:
- uses: actions/checkout@v4
- name: Download the build
uses: actions/download-artifact@v3
with:
name: vbs-wine-build-${{ matrix.variant }}
path: build/wine-${{ matrix.variant }}
- name: Check Wine
run: |
if ! command -v wine >/dev/null 2>&1; then
echo "wine is required to run the Windows test executables" >&2
exit 1
fi
wine --version
- name: Run the Windows test executables under Wine
run: |
# vbs_v1_tests / vbs_selfhost_tests drive the compiler and the shell, which
# a Wine-hosted Windows process cannot execute; they run in the Linux lane
# (and would run on a native Windows runner). The SDK/core suites cover
# the Windows-hosted code that is meaningful under Wine.
failed=""
for exe in vbs_sdk_tests vbs_core_tests; do
binary="build/wine-${{ matrix.variant }}/bin/${exe}.exe"
if [ ! -f "${binary}" ]; then
continue
fi
echo "== ${exe}"
if ! wine "${binary}" --no-color 2>&1 | tee -a "ctest-wine-${{ matrix.variant }}.log"; then
failed="${failed} ${exe}"
fi
done
if [ -n "${failed}" ]; then
echo "failing Windows test executables:${failed}" >&2
exit 1
fi
- 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
# ---------------------------------------------------------------------------
# 4A2 - the release installers, built and packaged by VBS itself
# ---------------------------------------------------------------------------
vbs-installers:
name: "4A2 · VBS installers (linux target)"
needs: linux-test
runs-on: vulkan
steps:
- uses: actions/checkout@v4
- name: Download the RelWithDebInfo build
uses: actions/download-artifact@v3
with:
name: vbs-linux-build-relwithdebinfo
path: build/linux-relwithdebinfo
- name: Make the restored binaries executable
run: chmod +x build/linux-relwithdebinfo/bin/*
- name: Build and package every installer format with VBS
run: |
set -eu
set -o pipefail
vbs=build/linux-relwithdebinfo/bin/vbs
version="$(sed -nE 's/^project\(VoidBuildSystem VERSION ([0-9.]+).*/\1/p' CMakeLists.txt)"
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
out=dist-installers
prefix="$(mktemp -d)"
mkdir -p "${out}"
build_dir="build/selfhost-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-1}"
install_archive() {
local fmt="$1" ext="$2"
local attempt=1
while true; do
if "${vbs}" install --project . --build-dir "${build_dir}" --profile release \
--jobs 4 --prefix "${prefix}" --package-name VoidBuildSystem \
--package-version "${version}" \
--archive "${out}/vbs-${label}-linux-x86_64-${fmt}.${ext}" \
--archive-format "${fmt}" 2>&1 | tee -a installers-linux.log; then
return 0
fi
if [ "${attempt}" -ge 2 ]; then
echo "vbs install (${fmt}) failed after retry" >&2
return 1
fi
attempt=$((attempt + 1))
build_dir="${build_dir}-retry${attempt}"
echo "retrying vbs install (${fmt}) in '${build_dir}'..." >&2
done
}
for fmt in tar sh zip deb rpm wix dmg nuget; do
case "${fmt}" in
tar) ext=tar ;;
wix) ext=wxs ;;
nuget) ext=nupkg ;;
*) ext="${fmt}" ;;
esac
install_archive "${fmt}" "${ext}"
done
ls -l "${out}/"
- name: Upload the installer log
if: failure()
uses: actions/upload-artifact@v3
with:
name: vbs-installers-linux-log
path: installers-linux.log
if-no-files-found: ignore
retention-days: 14
- name: Collect installer diagnostics
if: failure()
run: |
echo "== first errors (compact)"
grep -m 10 -E 'error:|undefined reference|Killed|internal compiler' \
installers-linux.log 2>/dev/null | cut -c1-240 || true
df -h . || true
for tree in $(find build/selfhost-* -type d -path '*snapshots/trees/*' \
-not -name '*.staging_*' 2>/dev/null); do
echo "== ${tree}"
echo "files on disk: $(find "${tree}" -type f | wc -l)"
ls "${tree}/src/Log" 2>/dev/null | head -5
done
- name: Upload the installers
uses: actions/upload-artifact@v3
with:
name: vbs-installers-linux-relwithdebinfo
path: dist-installers/
retention-days: 30
vbs-installers-windows:
name: "4A2 · VBS installers (windows target)"
needs: linux-test
runs-on: windows-gcc
# Cross-installing for Windows through VBS is new: report it without
# blocking the release until it is proven.
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Download the RelWithDebInfo build
uses: actions/download-artifact@v3
with:
name: vbs-linux-build-relwithdebinfo
path: build/linux-relwithdebinfo
- name: Make the restored binaries executable
run: chmod +x build/linux-relwithdebinfo/bin/*
- name: Build and package the Windows installers with VBS
run: |
set -eu
set -o pipefail
vbs=build/linux-relwithdebinfo/bin/vbs
version="$(sed -nE 's/^project\(VoidBuildSystem VERSION ([0-9.]+).*/\1/p' CMakeLists.txt)"
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
out=dist-installers-windows
prefix="$(mktemp -d)"
mkdir -p "${out}"
build_dir="build/selfhost-windows-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-1}"
for fmt in tar zip nuget wix; do
case "${fmt}" in
tar) ext=tar ;;
wix) ext=wxs ;;
nuget) ext=nupkg ;;
*) ext="${fmt}" ;;
esac
"${vbs}" install --project . --build-dir "${build_dir}" --profile release \
--jobs 4 --target-os windows --target-arch x86_64 \
--prefix "${prefix}" --package-name VoidBuildSystem \
--package-version "${version}" \
--archive "${out}/vbs-${label}-windows-x86_64-${fmt}.${ext}" \
--archive-format "${fmt}" 2>&1 | tee -a installers-windows.log
done
ls -l "${out}/"
- name: Upload the installer log
if: failure()
uses: actions/upload-artifact@v3
with:
name: vbs-installers-windows-log
path: installers-windows.log
if-no-files-found: ignore
retention-days: 14
- name: Collect Windows installer diagnostics
if: failure()
run: |
echo "== first errors (compact)"
grep -m 10 -E 'error:|undefined reference|Killed|internal compiler' \
installers-windows.log 2>/dev/null | cut -c1-240 || true
- name: Upload the Windows installers
if: always()
uses: actions/upload-artifact@v3
with:
name: vbs-installers-windows-relwithdebinfo
path: dist-installers-windows/
if-no-files-found: ignore
retention-days: 30
release:
name: "5 · Release"
# Linked to every package lane and only dispatched for a release tag or an
# explicit publish dispatch (always() would queue the job on every push).
needs: [vbs-installers, vbs-installers-windows]
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true'
runs-on: vulkan
steps:
- uses: actions/checkout@v4
- name: Download the Linux installers
uses: actions/download-artifact@v3
with:
name: vbs-installers-linux-relwithdebinfo
path: dist
- name: Download the Windows installers (when available)
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: vbs-installers-windows-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