Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8768720e54 | ||
|
|
95801ccfd7 | ||
|
|
8b391af480 | ||
|
|
6fa70fb788 | ||
|
|
6129762cc6 | ||
|
|
dbe1b43e85 | ||
|
|
5e01bbf8a1 | ||
|
|
8fddffd127 | ||
|
|
76b15e79c4 | ||
|
|
c4d0783366 | ||
|
|
d95fb0d2f8 | ||
|
|
92c4be9273 | ||
|
|
d420732016 | ||
|
|
05c4aa62b3 | ||
|
|
c901d8d518 | ||
|
|
8e0dc8f1cc | ||
|
|
e17917be5e | ||
|
|
2dc0263e7b | ||
|
|
b7c224cf67 | ||
|
|
97709d37a5 | ||
|
|
a6dfa95ca2 | ||
|
|
fc79652ec4 | ||
|
|
8f06b8b386 | ||
|
|
c79f495013 |
No files matched your search
@@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Ensure Ninja >= 1.11 (CMake needs it for C++20 module scanning).
|
||||||
|
#
|
||||||
|
# Tries, in order: the distribution package, the pip wheel, and the official
|
||||||
|
# static release binary (installed into /usr/local/bin so it shadows an older
|
||||||
|
# distro ninja).
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
minimum=1.11
|
||||||
|
version_ok() {
|
||||||
|
local have="${1:-0}"
|
||||||
|
[ "$(printf '%s\n%s\n' "${minimum}" "${have}" | sort -V | head -n1)" = "${minimum}" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
||||||
|
if version_ok "${have}"; then
|
||||||
|
echo "ninja ${have} already satisfies >= ${minimum}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo=""
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then sudo="sudo"; fi
|
||||||
|
|
||||||
|
# 1. Distribution package.
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
${sudo} apt-get update || true
|
||||||
|
${sudo} apt-get install -y ninja-build || true
|
||||||
|
hash -r
|
||||||
|
fi
|
||||||
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
||||||
|
if version_ok "${have}"; then
|
||||||
|
echo "installed ninja ${have} from the distribution"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. pip wheel (installs into /usr/local/bin, which shadows the distro binary).
|
||||||
|
if command -v python3 >/dev/null 2>&1; then
|
||||||
|
python3 -m pip install --quiet --break-system-packages ninja ||
|
||||||
|
python3 -m pip install --quiet ninja || true
|
||||||
|
hash -r
|
||||||
|
fi
|
||||||
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
||||||
|
if version_ok "${have}"; then
|
||||||
|
echo "installed ninja ${have} from pip"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Official static binary.
|
||||||
|
release=1.12.1
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
url="https://github.com/ninja-build/ninja/releases/download/v${release}/ninja-linux.zip"
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
curl -fsSL "${url}" -o "${tmp}/ninja.zip"
|
||||||
|
elif command -v wget >/dev/null 2>&1; then
|
||||||
|
wget -qO "${tmp}/ninja.zip" "${url}"
|
||||||
|
else
|
||||||
|
echo "curl or wget is required to download ninja" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
python3 -c 'import sys, zipfile; zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])' \
|
||||||
|
"${tmp}/ninja.zip" "${tmp}"
|
||||||
|
${sudo} install -m 0755 "${tmp}/ninja" /usr/local/bin/ninja
|
||||||
|
hash -r
|
||||||
|
have="$(ninja --version 2>/dev/null || echo 0)"
|
||||||
|
if ! version_ok "${have}"; then
|
||||||
|
echo "Ninja ${minimum}+ is required for C++20 module scanning (found ${have})" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "installed ninja ${have} from the official release"
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Native Windows lane for one variant, driven inside MSYS2 UCRT64.
|
||||||
|
#
|
||||||
|
# windows-native.sh build <variant> <build_type> configure + build
|
||||||
|
# windows-native.sh test <variant> <build_type> run CTest
|
||||||
|
# windows-native.sh package <variant> <build_type> package the build outputs
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
|
phase="${1:?phase (build or test)}"
|
||||||
|
variant="${2:?variant}"
|
||||||
|
build_type="${3:?build type}"
|
||||||
|
|
||||||
|
# The script is piped through `bash -s`, so $0 is "bash": locate the checkout
|
||||||
|
# through GITHUB_WORKSPACE (set by the runner) instead of the script path.
|
||||||
|
if [ -n "${GITHUB_WORKSPACE:-}" ]; then
|
||||||
|
root="$(cygpath -u "${GITHUB_WORKSPACE}" 2>/dev/null || printf '%s' "${GITHUB_WORKSPACE}")"
|
||||||
|
else
|
||||||
|
root="$(pwd)"
|
||||||
|
fi
|
||||||
|
cd "${root}"
|
||||||
|
echo "workspace: $(pwd)"
|
||||||
|
|
||||||
|
build="build/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
|
||||||
|
if command -v pacman >/dev/null 2>&1; then
|
||||||
|
pacman -S --noconfirm --needed \
|
||||||
|
mingw-w64-ucrt-x86_64-cmake \
|
||||||
|
mingw-w64-ucrt-x86_64-ninja \
|
||||||
|
mingw-w64-ucrt-x86_64-gcc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cxx_flags=""
|
||||||
|
linker_flags=""
|
||||||
|
if [ "${variant}" = "sanitizers" ]; then
|
||||||
|
cxx_flags="-fsanitize=address,undefined -fno-omit-frame-pointer"
|
||||||
|
linker_flags="-fsanitize=address,undefined"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${phase}" in
|
||||||
|
build)
|
||||||
|
cmake -S . -B "${build}" -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE="${build_type}" \
|
||||||
|
-DCMAKE_CXX_COMPILER=g++ \
|
||||||
|
-DCMAKE_CXX_FLAGS="${cxx_flags}" \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS="${linker_flags}" \
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
|
cmake --build "${build}" --parallel 4
|
||||||
|
;;
|
||||||
|
test)
|
||||||
|
ctest --test-dir "${build}" --output-on-failure --no-tests=error
|
||||||
|
;;
|
||||||
|
package)
|
||||||
|
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}/"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unknown phase '${phase}' (expected build, test or package)" >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
+518
-106
@@ -1,143 +1,555 @@
|
|||||||
# VoidBuildSystem CI (Gitea Actions).
|
# VoidBuildSystem CI (Gitea Actions).
|
||||||
#
|
#
|
||||||
# Runner: `linux` (host mode) - the machine with the documented dev toolchain:
|
# Graph:
|
||||||
# dev cpp-gcc -c <cmd> (GCC 16.2, CMake, Ninja)
|
#
|
||||||
# dev cpp -c <cmd> (Clang 23 + libFuzzer)
|
# 1. Requirements
|
||||||
# Optional steps add Nix packages with `dev ... -p <pkg>` (openssl, wine64, MinGW).
|
# 2A. Linux build (Debug, RelWithDebInfo, Sanitizers) -> 3A. Linux tests
|
||||||
# The generic `ubuntu-*` Docker runners have no GCC 16, so they are not used here.
|
# 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).
|
||||||
|
#
|
||||||
|
# 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
|
name: VoidBuildSystem CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
tags: ["v*"]
|
||||||
pull_request:
|
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:
|
jobs:
|
||||||
build-and-test-gcc16:
|
requirements:
|
||||||
runs-on: linux
|
name: "1 · Requirements"
|
||||||
|
runs-on: echoion-release-serial
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Check the dev toolchain
|
- name: Check the toolchain
|
||||||
run: |
|
run: |
|
||||||
command -v dev || { echo "the 'dev' toolchain wrapper is required on this runner" >&2; exit 1; }
|
g++ --version | head -1
|
||||||
dev cpp-gcc -c g++ --version | head -1
|
major="$(g++ -dumpversion | cut -d. -f1)"
|
||||||
- name: Configure (Debug, Ninja, GCC 16 C++26)
|
if [ "${major:-0}" -lt 16 ]; then
|
||||||
run: |
|
echo "GCC 16 or newer is required for C++26 (found ${major:-unknown})" >&2
|
||||||
dev cpp-gcc -c cmake -S . -B build/ci-gcc -G Ninja \
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug \
|
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
||||||
- name: Build
|
|
||||||
run: dev cpp-gcc -c cmake --build build/ci-gcc --parallel 4
|
|
||||||
- name: Run CTest suites
|
|
||||||
run: |
|
|
||||||
set -o pipefail
|
|
||||||
dev cpp-gcc -c ctest --test-dir build/ci-gcc --output-on-failure 2>&1 | tee ctest.log
|
|
||||||
- name: Check formatting on owned C++ files
|
|
||||||
run: |
|
|
||||||
dev cpp-gcc -c clang-format --dry-run --Werror \
|
|
||||||
build.cpp build.profiles.cpp build-support/*.hpp build-support/*.cpp \
|
|
||||||
sdk/*.cpp include/Void/Build.hpp include/Void/Build/*/*.hpp \
|
|
||||||
src/*.cpp src/*/*.cpp src/*/*/*.cpp \
|
|
||||||
recipes/*/*.hpp recipes/*/*.cpp \
|
|
||||||
registry/include/Void/Build/Registry/*.hpp registry/service/*.cpp registry/cli/*.cpp \
|
|
||||||
benchmarks/*.cpp tests/*.cpp
|
|
||||||
- name: Benchmark smoke run
|
|
||||||
run: dev cpp-gcc -c build/ci-gcc/bin/vbs_benchmarks 15
|
|
||||||
- name: Upload build artifacts
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: vbs-debug-linux-x86_64
|
|
||||||
path: |
|
|
||||||
build/ci-gcc/bin/vbs
|
|
||||||
build/ci-gcc/bin/vbs-registry
|
|
||||||
build/ci-gcc/bin/vbs_v1_tests
|
|
||||||
build/ci-gcc/compile_commands.json
|
|
||||||
ctest.log
|
|
||||||
retention-days: 14
|
|
||||||
|
|
||||||
signing-openssl-gcc16:
|
|
||||||
runs-on: linux
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Configure (Debug, Ninja, GCC 16 C++26, OpenSSL)
|
|
||||||
run: |
|
|
||||||
dev cpp-gcc -p openssl -c cmake -S . -B build/ci-openssl -G Ninja \
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug \
|
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
||||||
- name: Build vbs_v1_tests
|
|
||||||
run: dev cpp-gcc -p openssl -c cmake --build build/ci-openssl --target vbs_v1_tests --parallel 4
|
|
||||||
- name: Run Signing suite with the OpenSSL backend
|
|
||||||
run: |
|
|
||||||
output=$(dev cpp-gcc -p openssl -c build/ci-openssl/bin/vbs_v1_tests --suite Signing --no-color)
|
|
||||||
printf '%s\n' "$output"
|
|
||||||
if printf '%s\n' "$output" | grep -q 'SKIP'; then
|
|
||||||
echo "Signing checks were skipped: the OpenSSL backend was not enabled" >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
||||||
|
- 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
|
||||||
|
|
||||||
sanitizers-gcc16:
|
# ---------------------------------------------------------------------------
|
||||||
runs-on: linux
|
# 2A / 3A - Linux native
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
linux-build:
|
||||||
|
name: "2A · 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: sanitizers
|
||||||
|
build_type: Debug
|
||||||
|
cxx_flags: "-fsanitize=address,undefined -fno-omit-frame-pointer"
|
||||||
|
linker_flags: "-fsanitize=address,undefined"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Configure with ASan + UBSan
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
dev cpp-gcc -c cmake -S . -B build/ci-asan -G Ninja \
|
cmake -S . -B "build/linux-${{ matrix.variant }}" -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Debug \
|
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
|
||||||
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
|
-DCMAKE_CXX_COMPILER=g++ \
|
||||||
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
|
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \
|
||||||
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
|
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.linker_flags }}" \
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dev cpp-gcc -c cmake --build build/ci-asan --parallel 4
|
run: cmake --build "build/linux-${{ matrix.variant }}" --parallel 4
|
||||||
- name: Run sanitizer-safe suites
|
- name: Upload the build
|
||||||
env:
|
uses: actions/upload-artifact@v3
|
||||||
ASAN_OPTIONS: detect_leaks=1
|
with:
|
||||||
UBSAN_OPTIONS: print_stacktrace=1
|
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: echoion-release-serial
|
||||||
|
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
|
||||||
|
- 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: |
|
run: |
|
||||||
dev cpp-gcc -c ctest --test-dir build/ci-asan -R "vbs_sdk_tests|vbs_core_tests" --output-on-failure
|
set -o pipefail
|
||||||
- name: Upload sanitizer logs
|
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()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: vbs-asan-ubsan-logs
|
name: vbs-linux-test-${{ matrix.variant }}
|
||||||
path: build/ci-asan/Testing/**/LastTest.log
|
path: ctest-linux-${{ matrix.variant }}.log
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
wine-windows-gcc16:
|
linux-package:
|
||||||
runs-on: linux
|
name: "4A · Linux package (${{ matrix.variant }})"
|
||||||
|
needs: linux-test
|
||||||
|
runs-on: echoion-release-serial
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- variant: debug
|
||||||
|
- variant: relwithdebinfo
|
||||||
|
- variant: sanitizers
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Configure (Debug, Ninja, GCC 16 C++26)
|
- 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: |
|
run: |
|
||||||
dev cpp-gcc -c cmake -S . -B build/ci-wine -G Ninja \
|
set -eu
|
||||||
-DCMAKE_BUILD_TYPE=Debug
|
label="${{ github.event.inputs.tag }}"
|
||||||
- name: Build vbs and vbs_v1_tests
|
if [ -z "${label}" ]; then
|
||||||
run: dev cpp-gcc -c cmake --build build/ci-wine --target vbs vbs_v1_tests --parallel 4
|
case "${GITHUB_REF_NAME}" in
|
||||||
- name: Run the Windows target cross-build test under Wine
|
v*) label="${GITHUB_REF_NAME}" ;;
|
||||||
run: |
|
*) label="dev-$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)" ;;
|
||||||
dev cpp-gcc -p wine64 -p pkgsCross.mingwW64.stdenv.cc -c \
|
esac
|
||||||
build/ci-wine/bin/vbs_v1_tests \
|
fi
|
||||||
--filter track_c_windows_target_cross_build_and_wine_test --no-color
|
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
|
||||||
|
|
||||||
fuzz-clang:
|
# ---------------------------------------------------------------------------
|
||||||
runs-on: linux
|
# 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:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Configure (Debug, Ninja)
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
dev cpp-gcc -c cmake -S . -B build/ci-fuzz -G Ninja \
|
cmake -S . -B "build/wine-${{ matrix.variant }}" -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Debug
|
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
|
||||||
- name: Build vbs (for the VoidLibrary headers)
|
-DCMAKE_CXX_COMPILER=g++ \
|
||||||
run: dev cpp-gcc -c cmake --build build/ci-fuzz --target vbs --parallel 4
|
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \
|
||||||
- name: Fuzz the header-only parsers for 60 seconds
|
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.linker_flags }}"
|
||||||
env:
|
- name: Build the orchestrator and its tests
|
||||||
VOID_INCLUDE_DIR: ${{ github.workspace }}/build/ci-fuzz/_deps/voidlibrary-src/include
|
run: |
|
||||||
FUZZ_OUT: ${{ github.workspace }}/build/fuzz
|
cmake --build "build/wine-${{ matrix.variant }}" \
|
||||||
run: dev cpp -c bash fuzz/run.sh 60
|
--target vbs vbs_v1_tests --parallel 4
|
||||||
- name: Upload the fuzz corpus
|
- 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
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- variant: debug
|
||||||
|
- variant: relwithdebinfo
|
||||||
|
- variant: sanitizers
|
||||||
|
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: Make the restored binaries executable
|
||||||
|
run: chmod +x "build/wine-${{ 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/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
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: vbs-fuzz-corpus
|
name: vbs-wine-test-${{ matrix.variant }}
|
||||||
path: build/fuzz/corpus
|
path: ctest-wine-${{ matrix.variant }}.log
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# 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
|
||||||
|
# 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
|
||||||
|
- variant: sanitizers
|
||||||
|
build_type: Debug
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- 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 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 -- test ${{ matrix.variant }} ${{ matrix.build_type }}'
|
||||||
|
|
||||||
|
windows-package:
|
||||||
|
name: "4B · Windows package (${{ matrix.variant }})"
|
||||||
|
needs: windows-native-test
|
||||||
|
runs-on: windows-x64
|
||||||
|
# Track C3 port in progress: keep the package lane non-blocking while the
|
||||||
|
# Windows native build is still being ported (Void/Library issue #65).
|
||||||
|
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: 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 'cd "$(cygpath -u "$GITHUB_WORKSPACE")" && tr -d "\r" < .gitea/scripts/windows-native.sh | bash -s -- package ${{ 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
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# 5 - Release
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
release:
|
||||||
|
name: "5 · Release"
|
||||||
|
# Linked to every package lane. always() keeps the release runnable while the
|
||||||
|
# Windows native port is unfinished (2C/3C are red until Track C3); drop it
|
||||||
|
# to make a Windows package failure block the release.
|
||||||
|
needs: [linux-package, windows-package]
|
||||||
|
if: always() && (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
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Temporary diagnostic workflow: can the ubuntu runner install the required toolchain?
|
||||||
|
name: Probe runner
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
probe:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Install GCC 16 and CMake 4
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y software-properties-common wget gpg ninja-build
|
||||||
|
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
|
wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc | \
|
||||||
|
gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
|
||||||
|
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
|
||||||
|
sudo apt-get update
|
||||||
|
apt-cache policy g++-16 gcc-16 cmake | head -24 || true
|
||||||
|
sudo apt-get install -y g++-16 cmake
|
||||||
|
g++-16 --version | head -1
|
||||||
|
cmake --version | head -1
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
# VoidBuildSystem release (Gitea Actions).
|
|
||||||
#
|
|
||||||
# Triggered by a `v*` tag. Builds a Release configuration, runs the full suite, packages
|
|
||||||
# binaries, the SDK and the deterministic source archive, uploads them as CI artifacts, and
|
|
||||||
# creates (or updates) the Gitea release with the same files attached.
|
|
||||||
#
|
|
||||||
# Runner: `linux` (host) for the dev toolchain (`dev cpp-gcc -c ...`); the release upload uses
|
|
||||||
# the automatically provided GITHUB_TOKEN with repository write access.
|
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ["v*"]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: linux
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Check the dev toolchain
|
|
||||||
run: |
|
|
||||||
command -v dev || { echo "the 'dev' toolchain wrapper is required on this runner" >&2; exit 1; }
|
|
||||||
- name: Verify the tag matches the project version
|
|
||||||
run: |
|
|
||||||
tag="${GITHUB_REF_NAME}"
|
|
||||||
version="$(sed -nE 's/^project\(VoidBuildSystem VERSION ([0-9.]+).*/\1/p' CMakeLists.txt)"
|
|
||||||
echo "tag=${tag} project version=${version}"
|
|
||||||
if [ "${tag#v}" != "${version}" ]; then
|
|
||||||
echo "tag ${tag} does not match the project version ${version}" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
- name: Configure (Release, Ninja)
|
|
||||||
run: |
|
|
||||||
dev cpp-gcc -c cmake -S . -B build/release -G Ninja \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
||||||
- name: Build
|
|
||||||
run: dev cpp-gcc -c cmake --build build/release --parallel 4
|
|
||||||
- name: Run the full suite
|
|
||||||
run: |
|
|
||||||
set -o pipefail
|
|
||||||
dev cpp-gcc -c ctest --test-dir build/release --output-on-failure 2>&1 | tee ctest-release.log
|
|
||||||
- name: Package binaries, SDK and source
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
tag="${GITHUB_REF_NAME}"
|
|
||||||
stage="$(mktemp -d)"
|
|
||||||
mkdir -p "${stage}/bin" "${stage}/include" "${stage}/lib" "dist"
|
|
||||||
cp build/release/bin/vbs build/release/bin/vbs-registry "${stage}/bin/"
|
|
||||||
cp -r include/Void "${stage}/include/"
|
|
||||||
cp build/release/libVoidBuild_Sdk.a "${stage}/lib/" 2>/dev/null || \
|
|
||||||
find build/release -name 'libVoidBuild_Sdk.a' -exec cp {} "${stage}/lib/" \;
|
|
||||||
cp README.md "${stage}/"
|
|
||||||
tar --sort=name --mtime='@0' --owner=0 --group=0 --numeric-owner \
|
|
||||||
-czf "dist/vbs-${tag}-linux-x86_64.tar.gz" -C "${stage}" .
|
|
||||||
build/release/bin/vbs pack --project . --output "dist/vbs-${tag}-source.tar" \
|
|
||||||
|| tar --sort=name --mtime='@0' --owner=0 --group=0 --numeric-owner \
|
|
||||||
--exclude=.git --exclude=build --exclude=.vbs \
|
|
||||||
-czf "dist/vbs-${tag}-source.tar.gz" .
|
|
||||||
cp ctest-release.log dist/
|
|
||||||
sha256sum dist/* > dist/SHA256SUMS
|
|
||||||
ls -l dist/
|
|
||||||
- name: Upload release artifacts
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: vbs-release-${{ github.ref_name }}
|
|
||||||
path: dist/
|
|
||||||
retention-days: 30
|
|
||||||
- name: Publish the Gitea release
|
|
||||||
if: success()
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
tag="${GITHUB_REF_NAME}"
|
|
||||||
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}")"
|
|
||||||
release_id="$(curl -fsS -X POST -H "Authorization: token ${TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" -d "${payload}" \
|
|
||||||
"${api}/releases" | sed -nE 's/.*"id":([0-9]+).*/\1/p' | head -1)"
|
|
||||||
if [ -z "${release_id}" ]; then
|
|
||||||
release_id="$(curl -fsS -H "Authorization: token ${TOKEN}" \
|
|
||||||
"${api}/releases/tags/${tag}" | sed -nE 's/.*"id":([0-9]+).*/\1/p' | head -1)"
|
|
||||||
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
|
|
||||||
@@ -22,3 +22,6 @@ CMakeUserPresets.json
|
|||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# Release artifacts (built locally or by the release workflow)
|
||||||
|
dist/
|
||||||
@@ -51,6 +51,7 @@ add_library(VoidBuild_Core STATIC
|
|||||||
src/Config/Scaffold.cpp
|
src/Config/Scaffold.cpp
|
||||||
src/Daemon/Daemon.cpp
|
src/Daemon/Daemon.cpp
|
||||||
src/Report/Cdash.cpp
|
src/Report/Cdash.cpp
|
||||||
|
src/Report/Coverage.cpp
|
||||||
src/Editor/CompDb.cpp
|
src/Editor/CompDb.cpp
|
||||||
src/Watch/Linux/Watcher.cpp
|
src/Watch/Linux/Watcher.cpp
|
||||||
src/Package/Toml.cpp
|
src/Package/Toml.cpp
|
||||||
|
|||||||
@@ -377,6 +377,12 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
|||||||
|
|
||||||
- **Wave 142 (Gitea CI with Artifacts & Release Workflow)**: CI moved from the unused GitHub location to `.gitea/workflows/ci.yml`, targeting the real dev toolchain (`dev cpp-gcc`) and uploading build binaries, the compile database and the CTest log as artifacts (plus sanitizer logs and the fuzz corpus). `.gitea/workflows/release.yml` builds Release on `v*` tags, verifies the tag against the CMake project version, runs the full suite, packages the binaries/SDK, a `vbs pack` source archive and `SHA256SUMS`, uploads them, and creates the Gitea release with the assets attached via the API. Both workflows pass `yamllint`; they remain unexecuted without a runner.
|
- **Wave 142 (Gitea CI with Artifacts & Release Workflow)**: CI moved from the unused GitHub location to `.gitea/workflows/ci.yml`, targeting the real dev toolchain (`dev cpp-gcc`) and uploading build binaries, the compile database and the CTest log as artifacts (plus sanitizer logs and the fuzz corpus). `.gitea/workflows/release.yml` builds Release on `v*` tags, verifies the tag against the CMake project version, runs the full suite, packages the binaries/SDK, a `vbs pack` source archive and `SHA256SUMS`, uploads them, and creates the Gitea release with the assets attached via the API. Both workflows pass `yamllint`; they remain unexecuted without a runner.
|
||||||
|
|
||||||
|
- **Wave 143 (First Release v0.1.0)**: the Release build (Ninja, GCC 16.2) passed the full suite (8/8, 271.91 s) and the release packaging produced `dist/vbs-v0.1.0-linux-x86_64.tar.gz` (binaries + SDK + headers), `dist/vbs-v0.1.0-source.tar` (`vbs pack`) and `SHA256SUMS`. Tag `v0.1.0` and the [first Gitea release](https://git.faumaray.com/Void/Build-System/releases/tag/v0.1.0) were created; the workflows now target the available Gitea runners (`linux` host). Binary assets cannot be uploaded through the available tooling - the release workflow attaches them when it runs.
|
||||||
|
|
||||||
|
- **Wave 144 (NuGet Package Generator)**: `vbs install --archive FILE --archive-format nuget` writes a `.nupkg` - an OPC ZIP with the `<id>.nuspec` manifest, `[Content_Types].xml`, `_rels/.rels` and the installed files mapped to `runtimes/<rid>/native/**` (headers under `build/native/include`). The RID comes from the profile (e.g. `linux-x64`). Python `zipfile` + ElementTree validate the generated package (id/version/authors parse, CRCs clean); the install test asserts the manifest, layout and native asset paths.
|
||||||
|
|
||||||
|
- **Wave 145 (Coverage Reporting)**: `vbs test --coverage DIR` instruments every compile and link with `--coverage`, runs the tests, and converts the gcov JSON data into `DIR/coverage.info` (lcov) and `DIR/summary.txt`. System headers outside the project root are filtered out. `FullV1Tests.test_coverage_writes_lcov_and_summary` builds a library with a covered and an uncovered function and asserts `DA:1,1`, `DA:2,0` and the summary. A fresh-tree bug (a transient filesystem error aborting the .gcda walk) was found and fixed.
|
||||||
|
|
||||||
## Remaining future scope
|
## Remaining future scope
|
||||||
|
|
||||||
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
||||||
|
|||||||
@@ -143,4 +143,6 @@ Base HEAD: `fe0d1a6`
|
|||||||
| Wave 140 (pkg-config discovery) | `.pkgconfig(spec)` dependency, `.pc` parser with variables/Requires/version compare, lock entries | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E builds/runs and checks version errors, full CTest 8/8) | `include/Void/Build.hpp`, `sdk/Build.cpp`, `src/Provider/PkgConfig.cpp`, `src/Graph/Graph.cpp`, `src/Package/Resolver.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
| Wave 140 (pkg-config discovery) | `.pkgconfig(spec)` dependency, `.pc` parser with variables/Requires/version compare, lock entries | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E builds/runs and checks version errors, full CTest 8/8) | `include/Void/Build.hpp`, `sdk/Build.cpp`, `src/Provider/PkgConfig.cpp`, `src/Graph/Graph.cpp`, `src/Package/Resolver.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
| Wave 141 (ASM + shader languages) | `.s`/`.S` assembly; `shader_bundle`/`.shader()` lowered to SPIR-V (glslang/slangc/dxc) | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; both E2Es pass, GLSL/Slang/HLSL produce SPIR-V, full CTest 8/8) | `src/Graph/Graph.cpp`, `src/Toolchain/Driver.cpp`, `include/Void/Build.hpp`, `sdk/Build.cpp`, `tests/FullV1Tests.cpp`, docs |
|
| Wave 141 (ASM + shader languages) | `.s`/`.S` assembly; `shader_bundle`/`.shader()` lowered to SPIR-V (glslang/slangc/dxc) | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; both E2Es pass, GLSL/Slang/HLSL produce SPIR-V, full CTest 8/8) | `src/Graph/Graph.cpp`, `src/Toolchain/Driver.cpp`, `include/Void/Build.hpp`, `sdk/Build.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
| Wave 142 (Gitea CI + release workflow) | Gitea-hosted CI with artifacts; tag-driven release workflow with asset upload | COMPLETE (YAML-validated; unexecuted without a runner) | `.gitea/workflows/ci.yml`, `.gitea/workflows/release.yml`, docs |
|
| Wave 142 (Gitea CI + release workflow) | Gitea-hosted CI with artifacts; tag-driven release workflow with asset upload | COMPLETE (YAML-validated; unexecuted without a runner) | `.gitea/workflows/ci.yml`, `.gitea/workflows/release.yml`, docs |
|
||||||
|
| Wave 144 (NuGet generator) | `--archive-format nuget`: `.nupkg` with nuspec, OPC parts and `runtimes/<rid>/native` assets | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Python validates the package, install test passes, full CTest 8/8) | `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
|
| Wave 145 (Coverage reporting) | `vbs test --coverage DIR`; gcov JSON -> lcov + summary | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E passes, full CTest 8/8) | `include/Void/Build/Report/Coverage.hpp`, `src/Report/Coverage.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
||||||
@@ -1850,6 +1850,25 @@ VOID_INCLUDE_DIR=/tmp/opencode/vl-pin/include dev cpp -c bash fuzz/run.sh 30
|
|||||||
manually to valid SPIR-V in this environment.
|
manually to valid SPIR-V in this environment.
|
||||||
- Full CTest: **8 / 8 passed** in 314.56 s.
|
- Full CTest: **8 / 8 passed** in 314.56 s.
|
||||||
|
|
||||||
|
## NuGet Package Generation (GCC 16.2, pin `0002e74`)
|
||||||
|
|
||||||
|
- `vbs install --archive cli_hi.nupkg --archive-format nuget` produced a 7-entry ZIP whose
|
||||||
|
nuspec, `[Content_Types].xml` and `_rels/.rels` all parse with ElementTree, every CRC is
|
||||||
|
clean (`zipfile.testzip()` is None), and native assets live under
|
||||||
|
`runtimes/linux-x64/native/`.
|
||||||
|
- `FullV1Tests.foreign_cmake_meson_providers_bridge_and_relocatable_install` asserts the ZIP
|
||||||
|
magic, the nuspec id/version, the OPC parts and the runtime asset paths (**passed**, 6.36 s).
|
||||||
|
- Full CTest: **8 / 8 passed** in 337.44 s.
|
||||||
|
|
||||||
|
## Coverage Reporting (GCC 16.2, pin `0002e74`)
|
||||||
|
|
||||||
|
- `vbs test --coverage DIR` adds `--coverage` to the profile compile and link options, runs the
|
||||||
|
tests, and writes `DIR/coverage.info` (lcov) plus `DIR/summary.txt` from gcov's JSON output.
|
||||||
|
- `FullV1Tests.test_coverage_writes_lcov_and_summary` **passed** (2.66 s): the report contains
|
||||||
|
`SF:` records for both sources, `DA:1,1` (executed function) and `DA:2,0` (uncovered
|
||||||
|
function), `end_of_record`, and a summary starting with `Coverage: ` and containing `%`.
|
||||||
|
- Full CTest: **8 / 8 passed** in 352.77 s.
|
||||||
|
|
||||||
## Limits and Unrun Checks
|
## Limits and Unrun Checks
|
||||||
|
|
||||||
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
||||||
|
|||||||
@@ -122,12 +122,12 @@ first, then what makes VBS *better* rather than merely equal.
|
|||||||
3. **Platform breadth - deferred.** Native MSVC and Apple Clang/macOS stay deferred by
|
3. **Platform breadth - deferred.** Native MSVC and Apple Clang/macOS stay deferred by
|
||||||
decision; MinGW cross + Wine is the current Windows story.
|
decision; MinGW cross + Wine is the current Windows story.
|
||||||
4. **Package-generator parity.** CPack also ships NuGet, PKG/productbuild, APK and IFW
|
4. **Package-generator parity.** CPack also ships NuGet, PKG/productbuild, APK and IFW
|
||||||
installers; VBS has tar, `sh`, ZIP, DEB, RPM, WiX and UDIF. NuGet and PKG are the next
|
installers; VBS has tar, `sh`, ZIP, DEB, RPM, WiX, UDIF and NuGet (Wave 144). PKG is
|
||||||
useful ones.
|
the next useful one.
|
||||||
|
|
||||||
### 8.2 Developer experience and IDE integration
|
### 8.2 Developer experience and IDE integration
|
||||||
|
|
||||||
6. **Coverage reporting.** `vbs test --coverage` producing lcov XML (gcov for GCC,
|
6. **Coverage reporting - done (Wave 145).** `vbs test --coverage` produces lcov (gcov for GCC,
|
||||||
llvm-cov for Clang) alongside JUnit. CMake has `CTestCoverageCollectGCOV`; Meson has the
|
llvm-cov for Clang) alongside JUnit. CMake has `CTestCoverageCollectGCOV`; Meson has the
|
||||||
`b_coverage` option.
|
`b_coverage` option.
|
||||||
7. **Test repetition controls.** CTest offers `--repeat until-fail|after-timeout|until-pass`,
|
7. **Test repetition controls.** CTest offers `--repeat until-fail|after-timeout|until-pass`,
|
||||||
|
|||||||
+15
-1
@@ -16,7 +16,21 @@ if [ -d "$root/fuzz/seeds" ]; then
|
|||||||
cp -n "$root/fuzz/seeds/"* "$corpus/" 2>/dev/null || true
|
cp -n "$root/fuzz/seeds/"* "$corpus/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clang++ -std=c++26 -O1 -g -fsanitize=fuzzer,address,undefined \
|
# Use the newest C++ standard the installed Clang accepts (older distributions stop at
|
||||||
|
# C++23, spelled c++2b there).
|
||||||
|
std_flag="${VBS_FUZZ_STD:-}"
|
||||||
|
if [ -z "$std_flag" ]; then
|
||||||
|
for candidate in c++26 c++2b c++23; do
|
||||||
|
if clang++ "-std=$candidate" -fsyntax-only -x c++ /dev/null >/dev/null 2>&1; then
|
||||||
|
std_flag="$candidate"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
: "${std_flag:?clang++ accepts none of c++26/c++2b/c++23}"
|
||||||
|
echo "fuzzing with -std=$std_flag"
|
||||||
|
|
||||||
|
clang++ "-std=$std_flag" -O1 -g -fsanitize=fuzzer,address,undefined \
|
||||||
-fno-omit-frame-pointer \
|
-fno-omit-frame-pointer \
|
||||||
-I"$root/include" -I"$root/recipes" -I"$VOID_INCLUDE_DIR" \
|
-I"$root/include" -I"$root/recipes" -I"$VOID_INCLUDE_DIR" \
|
||||||
"$root/fuzz/fuzz_parsers.cpp" -o "$out/fuzz_parsers"
|
"$root/fuzz/fuzz_parsers.cpp" -o "$out/fuzz_parsers"
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Void/Functional/Error.hpp>
|
||||||
|
#include <Void/Functional/Result.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Void::Build::Report {
|
||||||
|
|
||||||
|
struct CoverageSummary {
|
||||||
|
std::size_t files{0};
|
||||||
|
std::size_t lines_found{0};
|
||||||
|
std::size_t lines_hit{0};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Every `.gcda` profile data file under `root` (e.g. a profile build directory).
|
||||||
|
[[nodiscard]] std::vector<std::filesystem::path>
|
||||||
|
collect_gcda_files(const std::filesystem::path &root);
|
||||||
|
|
||||||
|
// Converts gcov data into `output_dir/coverage.info` (lcov) and `output_dir/summary.txt`.
|
||||||
|
// Requires the `gcov` executable (part of the GCC/Clang toolchain); when `source_root` is
|
||||||
|
// non-empty only sources below it are reported (system headers are dropped).
|
||||||
|
[[nodiscard]] Void::Result::Result<CoverageSummary, Void::Result::Error>
|
||||||
|
write_coverage_report(const std::vector<std::filesystem::path> &gcda_files,
|
||||||
|
const std::filesystem::path &output_dir,
|
||||||
|
const std::filesystem::path &source_root = {},
|
||||||
|
const std::string &gcov_executable = "gcov");
|
||||||
|
|
||||||
|
} // namespace Void::Build::Report
|
||||||
@@ -227,17 +227,14 @@ Void::Result::Result<void, Void::Result::Error> HttpServer::start(const HttpServ
|
|||||||
}
|
}
|
||||||
bridged.body = request.body;
|
bridged.body = request.body;
|
||||||
|
|
||||||
// HEAD is routed exactly like GET; the body is dropped but Content-Length is preserved.
|
// HEAD is routed exactly like GET; the body stays so the transport can
|
||||||
|
// derive the GET Content-Length, and Void::Net suppresses the body itself.
|
||||||
const bool head_only = request.method == Void::Net::Method::Head;
|
const bool head_only = request.method == Void::Net::Method::Head;
|
||||||
if (head_only) {
|
if (head_only) {
|
||||||
bridged.method = "GET";
|
bridged.method = "GET";
|
||||||
}
|
}
|
||||||
HttpResponse response = handler(bridged);
|
HttpResponse response = handler(bridged);
|
||||||
apply_default_security_headers(response);
|
apply_default_security_headers(response);
|
||||||
if (head_only) {
|
|
||||||
response.headers["Content-Length"] = std::to_string(response.body.size());
|
|
||||||
response.body.clear();
|
|
||||||
}
|
|
||||||
Void::Net::ServerResponse net_response;
|
Void::Net::ServerResponse net_response;
|
||||||
net_response.status = response.status;
|
net_response.status = response.status;
|
||||||
for (const auto &[name, value] : response.headers) {
|
for (const auto &[name, value] : response.headers) {
|
||||||
|
|||||||
@@ -635,6 +635,131 @@ write_dmg_archive(const std::filesystem::path &output, const std::filesystem::pa
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── NuGet package (.nupkg) ─────────────────────────────────────────────────────────────────
|
||||||
|
// A .nupkg is an OPC ZIP (a nuspec manifest plus content parts). Native assets follow the
|
||||||
|
// `runtimes/<rid>/native` convention; public headers go to `build/native/include`.
|
||||||
|
std::string nuget_rid(std::string_view os, std::string_view architecture) {
|
||||||
|
const std::string arch = architecture == "aarch64" || architecture == "arm64" ? "arm64"
|
||||||
|
: architecture == "x86" || architecture == "i686" ? "x86"
|
||||||
|
: "x64";
|
||||||
|
const auto lower_os = Void::Str::to_lower_ascii(os);
|
||||||
|
if (lower_os == "windows" || lower_os == "win32") {
|
||||||
|
return "win-" + arch;
|
||||||
|
}
|
||||||
|
if (lower_os == "darwin" || lower_os == "macos") {
|
||||||
|
return "osx-" + arch;
|
||||||
|
}
|
||||||
|
return "linux-" + arch;
|
||||||
|
}
|
||||||
|
|
||||||
|
Void::Result::Result<void, Void::Result::Error>
|
||||||
|
write_nuget_package(const std::filesystem::path &output, const InstallOptions &options,
|
||||||
|
const Graph::BuildGraph &graph,
|
||||||
|
const std::vector<Package::ArchiveEntrySpec> &entries) {
|
||||||
|
const std::string id = options.package_name;
|
||||||
|
const std::string version =
|
||||||
|
options.package_version.empty() ? std::string{"1.0.0"} : options.package_version;
|
||||||
|
const std::string rid = nuget_rid(graph.profile.os, graph.profile.architecture);
|
||||||
|
const std::string authors =
|
||||||
|
options.maintainer.empty() ? std::string{"Void"} : options.maintainer;
|
||||||
|
const std::string description = options.package_description.empty()
|
||||||
|
? options.package_name
|
||||||
|
: options.package_description;
|
||||||
|
|
||||||
|
// Map the installed tree onto the NuGet layout.
|
||||||
|
std::vector<std::pair<std::string, std::filesystem::path>> mapped;
|
||||||
|
std::set<std::string> extensions;
|
||||||
|
for (const auto &entry : entries) {
|
||||||
|
const auto rel = entry.archive_path;
|
||||||
|
std::string dest;
|
||||||
|
if (rel.starts_with("include/")) {
|
||||||
|
dest = "build/native/include/" + rel.substr(std::string{"include/"}.size());
|
||||||
|
} else {
|
||||||
|
dest = "runtimes/" + rid + "/native/" + rel;
|
||||||
|
}
|
||||||
|
mapped.emplace_back(dest, entry.source_file);
|
||||||
|
const auto dot = dest.rfind('.');
|
||||||
|
if (dot != std::string::npos && dot > dest.rfind('/')) {
|
||||||
|
extensions.insert(dest.substr(dot + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string nuspec =
|
||||||
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||||
|
"<package xmlns=\"http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd\">\n"
|
||||||
|
" <metadata>\n"
|
||||||
|
" <id>" +
|
||||||
|
wix_xml_escape(id) + "</id>\n"
|
||||||
|
" <version>" + wix_xml_escape(version) + "</version>\n"
|
||||||
|
" <authors>" + wix_xml_escape(authors) + "</authors>\n"
|
||||||
|
" <description>" + wix_xml_escape(description) + "</description>\n"
|
||||||
|
" <tags>native;c++;vbs</tags>\n"
|
||||||
|
" </metadata>\n"
|
||||||
|
"</package>\n";
|
||||||
|
|
||||||
|
std::string content_types =
|
||||||
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||||
|
"<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n"
|
||||||
|
" <Default Extension=\"rels\" "
|
||||||
|
"ContentType=\"application/vnd.openxmlformats-package.relationships+xml\" />\n"
|
||||||
|
" <Default Extension=\"nuspec\" ContentType=\"application/octet\" />\n";
|
||||||
|
for (const auto &ext : extensions) {
|
||||||
|
content_types += " <Default Extension=\"" + wix_xml_escape(ext) +
|
||||||
|
"\" ContentType=\"application/octet\" />\n";
|
||||||
|
}
|
||||||
|
content_types += "</Types>\n";
|
||||||
|
|
||||||
|
const std::string rels =
|
||||||
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||||
|
"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n"
|
||||||
|
" <Relationship Type=\"http://schemas.microsoft.com/packaging/2010/07/manifest\" "
|
||||||
|
"Target=\"/" +
|
||||||
|
wix_xml_escape(id) +
|
||||||
|
".nuspec\" Id=\"Re0\" />\n"
|
||||||
|
"</Relationships>\n";
|
||||||
|
|
||||||
|
const auto staging = output.parent_path() / (output.filename().string() + ".stage");
|
||||||
|
std::error_code ec;
|
||||||
|
std::filesystem::remove_all(staging, ec);
|
||||||
|
std::filesystem::create_directories(staging, ec);
|
||||||
|
if (ec) {
|
||||||
|
return std::unexpected{Void::System::make_system_error(
|
||||||
|
Void::System::map_errno_to_system_code(ec.value()),
|
||||||
|
std::format("cannot create NuGet staging directory '{}'", staging.string()),
|
||||||
|
ec.value())};
|
||||||
|
}
|
||||||
|
auto cleanup = Void::Scope::on_exit([&] {
|
||||||
|
std::error_code cleanup_ec;
|
||||||
|
std::filesystem::remove_all(staging, cleanup_ec);
|
||||||
|
});
|
||||||
|
|
||||||
|
std::vector<Package::ArchiveEntrySpec> zip_entries;
|
||||||
|
const auto stage_file = [&](std::string_view name,
|
||||||
|
std::string_view content) -> std::optional<std::filesystem::path> {
|
||||||
|
const auto path = staging / std::filesystem::path{name};
|
||||||
|
std::error_code file_ec;
|
||||||
|
std::filesystem::create_directories(path.parent_path(), file_ec);
|
||||||
|
if (auto written = Platform::atomic_write_file(path, content, true); !written) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
const auto nuspec_path = stage_file(id + ".nuspec", nuspec);
|
||||||
|
const auto types_path = stage_file("[Content_Types].xml", content_types);
|
||||||
|
const auto rels_path = stage_file("_rels/.rels", rels);
|
||||||
|
if (!nuspec_path || !types_path || !rels_path) {
|
||||||
|
return std::unexpected{Void::System::make_system_error(
|
||||||
|
Void::System::SystemErrorCode::io_error, "cannot stage NuGet metadata")};
|
||||||
|
}
|
||||||
|
zip_entries.push_back({"[Content_Types].xml", *types_path, 0644u});
|
||||||
|
zip_entries.push_back({"_rels/.rels", *rels_path, 0644u});
|
||||||
|
zip_entries.push_back({id + ".nuspec", *nuspec_path, 0644u});
|
||||||
|
for (const auto &[name, source] : mapped) {
|
||||||
|
zip_entries.push_back({name, source, 0644u});
|
||||||
|
}
|
||||||
|
return Package::create_stored_zip(output, zip_entries);
|
||||||
|
}
|
||||||
|
|
||||||
// Debian package: ar container with debian-binary, control.tar and data.tar (uncompressed).
|
// Debian package: ar container with debian-binary, control.tar and data.tar (uncompressed).
|
||||||
Void::Result::Result<void, Void::Result::Error>
|
Void::Result::Result<void, Void::Result::Error>
|
||||||
write_deb_package(const std::filesystem::path &output, const InstallOptions &options,
|
write_deb_package(const std::filesystem::path &output, const InstallOptions &options,
|
||||||
@@ -1090,6 +1215,12 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
|
|||||||
if (auto packed = write_dmg_archive(*options.archive_path, payload); !packed) {
|
if (auto packed = write_dmg_archive(*options.archive_path, payload); !packed) {
|
||||||
return std::unexpected{packed.error()};
|
return std::unexpected{packed.error()};
|
||||||
}
|
}
|
||||||
|
} else if (options.archive_format == "nuget") {
|
||||||
|
if (auto packed =
|
||||||
|
write_nuget_package(*options.archive_path, options, graph, archive_entries);
|
||||||
|
!packed) {
|
||||||
|
return std::unexpected{packed.error()};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const bool archive_as_script = options.archive_format == "sh";
|
const bool archive_as_script = options.archive_format == "sh";
|
||||||
const auto archive_target = archive_as_script
|
const auto archive_target = archive_as_script
|
||||||
|
|||||||
+34
-3
@@ -29,6 +29,7 @@
|
|||||||
#include <Void/Build/Provider/Provider.hpp>
|
#include <Void/Build/Provider/Provider.hpp>
|
||||||
#include <Void/Build/Provider/Translator.hpp>
|
#include <Void/Build/Provider/Translator.hpp>
|
||||||
#include <Void/Build/Report/Cdash.hpp>
|
#include <Void/Build/Report/Cdash.hpp>
|
||||||
|
#include <Void/Build/Report/Coverage.hpp>
|
||||||
#include <Void/Build/SelfHost/TestRegistryGen.hpp>
|
#include <Void/Build/SelfHost/TestRegistryGen.hpp>
|
||||||
#include <Void/Build/Snapshot/Snapshot.hpp>
|
#include <Void/Build/Snapshot/Snapshot.hpp>
|
||||||
#include <Void/Build/State/StateStore.hpp>
|
#include <Void/Build/State/StateStore.hpp>
|
||||||
@@ -395,6 +396,7 @@ struct BuildCmdOptions {
|
|||||||
std::optional<std::string> target_os_arg;
|
std::optional<std::string> target_os_arg;
|
||||||
std::optional<std::string> target_arch_arg;
|
std::optional<std::string> target_arch_arg;
|
||||||
std::optional<std::string> junit_arg;
|
std::optional<std::string> junit_arg;
|
||||||
|
std::optional<std::string> coverage_arg;
|
||||||
std::optional<std::string> cdash_arg;
|
std::optional<std::string> cdash_arg;
|
||||||
std::optional<std::string> cdash_project_arg;
|
std::optional<std::string> cdash_project_arg;
|
||||||
std::optional<std::string> cdash_build_arg;
|
std::optional<std::string> cdash_build_arg;
|
||||||
@@ -543,6 +545,12 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
|||||||
std::cerr << "vbs: " << ex.what() << '\n';
|
std::cerr << "vbs: " << ex.what() << '\n';
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
if (opts.coverage_arg) {
|
||||||
|
// Instrument every compile and link so gcov data is produced when tests run.
|
||||||
|
// (GCC and Clang both accept --coverage.)
|
||||||
|
ctx.compile_options.push_back("--coverage");
|
||||||
|
ctx.link_options.push_back("--coverage");
|
||||||
|
}
|
||||||
|
|
||||||
auto tc = Toolchain::discover_and_probe(ctx, build_root / ".vbs" / "probes");
|
auto tc = Toolchain::discover_and_probe(ctx, build_root / ".vbs" / "probes");
|
||||||
if (!tc) {
|
if (!tc) {
|
||||||
@@ -1102,6 +1110,27 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lcov coverage report from the gcov data produced by the instrumented test binaries.
|
||||||
|
if (run_tests && opts.coverage_arg) {
|
||||||
|
const auto gcda = Report::collect_gcda_files(build_root);
|
||||||
|
std::error_code cov_ec;
|
||||||
|
const auto source_root = std::filesystem::weakly_canonical(project_root, cov_ec);
|
||||||
|
auto cov = Report::write_coverage_report(gcda, *opts.coverage_arg, source_root);
|
||||||
|
if (!cov) {
|
||||||
|
std::cerr << "vbs test: " << cov.error().message() << '\n';
|
||||||
|
all_ok = false;
|
||||||
|
} else {
|
||||||
|
const double percent =
|
||||||
|
cov->lines_found == 0
|
||||||
|
? 0.0
|
||||||
|
: 100.0 * static_cast<double>(cov->lines_hit) /
|
||||||
|
static_cast<double>(cov->lines_found);
|
||||||
|
Void::Log::info("Test", "Coverage {:.1f}% ({}/{} lines) across {} file(s) -> {}", percent,
|
||||||
|
cov->lines_hit, cov->lines_found, cov->files,
|
||||||
|
(std::filesystem::path{*opts.coverage_arg} / "coverage.info").string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// JUnit XML report for CI systems (aggregated across selected profiles).
|
// JUnit XML report for CI systems (aggregated across selected profiles).
|
||||||
if (opts.junit_arg && !opts.junit_arg->empty() && !test_records.empty()) {
|
if (opts.junit_arg && !opts.junit_arg->empty() && !test_records.empty()) {
|
||||||
const auto xml_escape = [](std::string_view text) {
|
const auto xml_escape = [](std::string_view text) {
|
||||||
@@ -2547,9 +2576,9 @@ int execute_install_command(const InstallCmdOptions &opts) {
|
|||||||
if (opts.archive_format_arg != "tar" && opts.archive_format_arg != "sh" &&
|
if (opts.archive_format_arg != "tar" && opts.archive_format_arg != "sh" &&
|
||||||
opts.archive_format_arg != "zip" && opts.archive_format_arg != "deb" &&
|
opts.archive_format_arg != "zip" && opts.archive_format_arg != "deb" &&
|
||||||
opts.archive_format_arg != "rpm" && opts.archive_format_arg != "wix" &&
|
opts.archive_format_arg != "rpm" && opts.archive_format_arg != "wix" &&
|
||||||
opts.archive_format_arg != "dmg") {
|
opts.archive_format_arg != "dmg" && opts.archive_format_arg != "nuget") {
|
||||||
std::cerr << "vbs install: unsupported --archive-format '" << opts.archive_format_arg
|
std::cerr << "vbs install: unsupported --archive-format '" << opts.archive_format_arg
|
||||||
<< "' (expected tar, sh, zip, deb, rpm, wix or dmg)\n";
|
<< "' (expected tar, sh, zip, deb, rpm, wix, dmg or nuget)\n";
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (opts.archive_arg && !opts.archive_arg->empty()) {
|
if (opts.archive_arg && !opts.archive_arg->empty()) {
|
||||||
@@ -3636,6 +3665,8 @@ int main(int argc, char **argv) {
|
|||||||
.option_default("--test-timeout", "", "Per-test timeout in seconds (1..86400)",
|
.option_default("--test-timeout", "", "Per-test timeout in seconds (1..86400)",
|
||||||
build_opts.test_timeout_arg, "300")
|
build_opts.test_timeout_arg, "300")
|
||||||
.option("--junit", "", "Write a JUnit XML report of test results", build_opts.junit_arg)
|
.option("--junit", "", "Write a JUnit XML report of test results", build_opts.junit_arg)
|
||||||
|
.option("--coverage", "", "Build with --coverage and write an lcov report to this directory",
|
||||||
|
build_opts.coverage_arg)
|
||||||
.option("--cdash", "", "Upload a CDash test report to this base URL",
|
.option("--cdash", "", "Upload a CDash test report to this base URL",
|
||||||
build_opts.cdash_arg)
|
build_opts.cdash_arg)
|
||||||
.option("--cdash-project", "", "CDash project name (default: project directory name)",
|
.option("--cdash-project", "", "CDash project name (default: project directory name)",
|
||||||
@@ -3762,7 +3793,7 @@ int main(int argc, char **argv) {
|
|||||||
.option("--archive", "", "Write a deterministic installer archive of the prefix",
|
.option("--archive", "", "Write a deterministic installer archive of the prefix",
|
||||||
install_opts.archive_arg)
|
install_opts.archive_arg)
|
||||||
.option_default("--archive-format", "",
|
.option_default("--archive-format", "",
|
||||||
"Installer archive format: tar (default), sh, zip, deb, rpm, wix or dmg",
|
"Installer archive format: tar (default), sh, zip, deb, rpm, wix, dmg or nuget",
|
||||||
install_opts.archive_format_arg, "tar")
|
install_opts.archive_format_arg, "tar")
|
||||||
.option("--signing-key", "",
|
.option("--signing-key", "",
|
||||||
"Ed25519 seed file; signs the archive and writes .sha256/.sig/.pub",
|
"Ed25519 seed file; signs the archive and writes .sha256/.sig/.pub",
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
#include <Void/Build/Report/Coverage.hpp>
|
||||||
|
|
||||||
|
#include <Void/Build/Platform/FileOps.hpp>
|
||||||
|
#include <Void/Build/Platform/ProcessSupervisor.hpp>
|
||||||
|
#include <Void/Data/StrictJson.hpp>
|
||||||
|
#include <Void/System/Types.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <format>
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
namespace Void::Build::Report {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
using JsonVal = Void::Json::Strict::Value;
|
||||||
|
|
||||||
|
Void::Result::Error make_error(std::string msg) {
|
||||||
|
return Void::System::make_system_error(Void::System::SystemErrorCode::invalid_argument,
|
||||||
|
std::move(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
const JsonVal *find_key(const JsonVal::Object &object, std::string_view key) {
|
||||||
|
const auto it = object.find(std::string{key});
|
||||||
|
return it == object.end() ? nullptr : &it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
std::vector<std::filesystem::path> collect_gcda_files(const std::filesystem::path &root) {
|
||||||
|
std::vector<std::filesystem::path> files;
|
||||||
|
std::error_code ec;
|
||||||
|
if (!std::filesystem::is_directory(root, ec)) {
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
// Per-entry errors (dangling symlinks, unreadable dirs) must not abort the walk: a fresh
|
||||||
|
// build tree can contain them while it is still being populated.
|
||||||
|
try {
|
||||||
|
for (const auto &entry : std::filesystem::recursive_directory_iterator(
|
||||||
|
root, std::filesystem::directory_options::skip_permission_denied)) {
|
||||||
|
std::error_code entry_ec;
|
||||||
|
if (entry.is_regular_file(entry_ec) && !entry_ec &&
|
||||||
|
entry.path().extension() == ".gcda") {
|
||||||
|
files.push_back(entry.path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (const std::filesystem::filesystem_error &) {
|
||||||
|
// Keep whatever was collected before the unreadable subtree.
|
||||||
|
}
|
||||||
|
std::ranges::sort(files);
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
Void::Result::Result<CoverageSummary, Void::Result::Error>
|
||||||
|
write_coverage_report(const std::vector<std::filesystem::path> &gcda_files,
|
||||||
|
const std::filesystem::path &output_dir,
|
||||||
|
const std::filesystem::path &source_root,
|
||||||
|
const std::string &gcov_executable) {
|
||||||
|
std::error_code ec;
|
||||||
|
std::filesystem::create_directories(output_dir, ec);
|
||||||
|
if (ec) {
|
||||||
|
return std::unexpected{Void::System::make_system_error(
|
||||||
|
Void::System::map_errno_to_system_code(ec.value()),
|
||||||
|
std::format("cannot create coverage directory '{}': {}", output_dir.string(),
|
||||||
|
ec.message()),
|
||||||
|
ec.value())};
|
||||||
|
}
|
||||||
|
if (gcda_files.empty()) {
|
||||||
|
return std::unexpected{make_error("no .gcda coverage data was produced")};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Source path -> line -> execution count (max across translation units that include it).
|
||||||
|
std::map<std::string, std::map<std::int64_t, std::int64_t>, std::less<>> coverage;
|
||||||
|
for (const auto &gcda : gcda_files) {
|
||||||
|
Platform::ProcessRequest req;
|
||||||
|
req.executable = gcov_executable;
|
||||||
|
req.arguments = {"--json-format", "--stdout", gcda.filename().string()};
|
||||||
|
req.working_directory = gcda.parent_path();
|
||||||
|
req.timeout = std::chrono::seconds{60};
|
||||||
|
auto res = Platform::run_supervised(req);
|
||||||
|
if (!res || !res->succeeded()) {
|
||||||
|
return std::unexpected{make_error(std::format(
|
||||||
|
"gcov failed for '{}': {}", gcda.string(),
|
||||||
|
res ? res->stderr_data : res.error().message()))};
|
||||||
|
}
|
||||||
|
auto parsed = Void::Json::Strict::parse(res->stdout_data);
|
||||||
|
if (!parsed) {
|
||||||
|
return std::unexpected{make_error(
|
||||||
|
std::format("gcov produced invalid JSON for '{}'", gcda.string()))};
|
||||||
|
}
|
||||||
|
const auto *root = std::get_if<JsonVal::Object>(&parsed->value);
|
||||||
|
if (root == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::filesystem::path cwd;
|
||||||
|
if (const auto *cwd_v = find_key(*root, "current_working_directory")) {
|
||||||
|
if (const auto *text = std::get_if<std::string>(&cwd_v->value)) {
|
||||||
|
cwd = *text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auto *files_v = find_key(*root, "files");
|
||||||
|
const auto *files = files_v ? std::get_if<JsonVal::Array>(&files_v->value) : nullptr;
|
||||||
|
if (files == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const auto &file_entry : *files) {
|
||||||
|
const auto *file_obj = std::get_if<JsonVal::Object>(&file_entry.value);
|
||||||
|
if (file_obj == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const auto *path_v = find_key(*file_obj, "file");
|
||||||
|
const auto *path_text = path_v ? std::get_if<std::string>(&path_v->value) : nullptr;
|
||||||
|
if (path_text == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::filesystem::path source{*path_text};
|
||||||
|
if (source.is_relative()) {
|
||||||
|
source = (cwd / source).lexically_normal();
|
||||||
|
}
|
||||||
|
if (!source_root.empty() && !Platform::path_is_within(source_root, source)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const auto *lines_v = find_key(*file_obj, "lines");
|
||||||
|
const auto *lines = lines_v ? std::get_if<JsonVal::Array>(&lines_v->value) : nullptr;
|
||||||
|
if (lines == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto &entry = coverage[source.string()];
|
||||||
|
for (const auto &line_entry : *lines) {
|
||||||
|
const auto *line_obj = std::get_if<JsonVal::Object>(&line_entry.value);
|
||||||
|
if (line_obj == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::int64_t number = 0;
|
||||||
|
std::int64_t count = 0;
|
||||||
|
if (const auto *number_v = find_key(*line_obj, "line_number")) {
|
||||||
|
if (const auto *value = std::get_if<std::int64_t>(&number_v->value)) {
|
||||||
|
number = *value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (const auto *count_v = find_key(*line_obj, "count")) {
|
||||||
|
if (const auto *value = std::get_if<std::int64_t>(&count_v->value)) {
|
||||||
|
count = *value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (number <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto &slot = entry[number];
|
||||||
|
slot = std::max(slot, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CoverageSummary summary;
|
||||||
|
std::string lcov;
|
||||||
|
for (auto &[path, lines] : coverage) {
|
||||||
|
if (lines.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
++summary.files;
|
||||||
|
std::size_t hit = 0;
|
||||||
|
lcov += "TN:\nSF:" + path + '\n';
|
||||||
|
for (const auto &[number, count] : lines) {
|
||||||
|
lcov += std::format("DA:{},{}\n", number, count);
|
||||||
|
if (count > 0) {
|
||||||
|
++hit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lcov += std::format("LF:{}\nLH:{}\nend_of_record\n", lines.size(), hit);
|
||||||
|
summary.lines_found += lines.size();
|
||||||
|
summary.lines_hit += hit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto written = Platform::atomic_write_file(output_dir / "coverage.info", lcov, true);
|
||||||
|
!written) {
|
||||||
|
return std::unexpected{written.error()};
|
||||||
|
}
|
||||||
|
const double percent =
|
||||||
|
summary.lines_found == 0
|
||||||
|
? 0.0
|
||||||
|
: 100.0 * static_cast<double>(summary.lines_hit) /
|
||||||
|
static_cast<double>(summary.lines_found);
|
||||||
|
const std::string summary_text =
|
||||||
|
std::format("Coverage: {:.1f}% ({}/{} lines) across {} file(s)\n", percent,
|
||||||
|
summary.lines_hit, summary.lines_found, summary.files);
|
||||||
|
if (auto written = Platform::atomic_write_file(output_dir / "summary.txt", summary_text, true);
|
||||||
|
!written) {
|
||||||
|
return std::unexpected{written.error()};
|
||||||
|
}
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Void::Build::Report
|
||||||
+82
-2
@@ -1137,6 +1137,29 @@ void build(Void::Build::Project &p) {
|
|||||||
Void::Testing::expect_eq(read_be64(koly, 492), (data_fork_length + 511) / 512);
|
Void::Testing::expect_eq(read_be64(koly, 492), (data_fork_length + 511) / 512);
|
||||||
Void::Testing::expect(dmg_bytes->substr(257, 5) == "ustar"); // tar payload
|
Void::Testing::expect(dmg_bytes->substr(257, 5) == "ustar"); // tar payload
|
||||||
|
|
||||||
|
// NuGet package (.nupkg): OPC ZIP with the nuspec and native runtime assets.
|
||||||
|
const auto nupkg_archive = tmp / "cli_hi.nupkg";
|
||||||
|
auto nuget_req = inst_req;
|
||||||
|
for (auto &arg : nuget_req.arguments) {
|
||||||
|
if (arg == installer_archive.string()) {
|
||||||
|
arg = nupkg_archive.string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nuget_req.arguments.push_back("--archive-format");
|
||||||
|
nuget_req.arguments.push_back("nuget");
|
||||||
|
auto nuget_res = Platform::run_supervised(nuget_req);
|
||||||
|
Void::Testing::expect(nuget_res.has_value() && nuget_res->succeeded());
|
||||||
|
auto nupkg_bytes = Void::FileSystem::read_file(nupkg_archive);
|
||||||
|
Void::Testing::require(nupkg_bytes.has_value());
|
||||||
|
Void::Testing::expect(nupkg_bytes->starts_with(std::string("PK\x03\x04", 4)));
|
||||||
|
Void::Testing::expect(nupkg_bytes->find("CliHiPkg.nuspec") != std::string::npos);
|
||||||
|
Void::Testing::expect(nupkg_bytes->find("<id>CliHiPkg</id>") != std::string::npos);
|
||||||
|
Void::Testing::expect(nupkg_bytes->find("<version>0.1.0</version>") != std::string::npos);
|
||||||
|
Void::Testing::expect(nupkg_bytes->find("[Content_Types].xml") != std::string::npos);
|
||||||
|
Void::Testing::expect(nupkg_bytes->find("_rels/.rels") != std::string::npos);
|
||||||
|
Void::Testing::expect(nupkg_bytes->find("runtimes/") != std::string::npos);
|
||||||
|
Void::Testing::expect(nupkg_bytes->find("/native/bin/cli_hi") != std::string::npos);
|
||||||
|
|
||||||
// RPM package generator: lead + header magic + newc cpio payload.
|
// RPM package generator: lead + header magic + newc cpio payload.
|
||||||
const auto rpm_archive = tmp / "cli_hi.rpm";
|
const auto rpm_archive = tmp / "cli_hi.rpm";
|
||||||
auto rpm_req = inst_req;
|
auto rpm_req = inst_req;
|
||||||
@@ -1429,8 +1452,10 @@ VOID_TEST(FullV1Tests, track_c_windows_target_cross_build_and_wine_test) {
|
|||||||
const auto proj = tmp / "win_proj";
|
const auto proj = tmp / "win_proj";
|
||||||
write_file(proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
write_file(proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||||
void build(Void::Build::Project &p) {
|
void build(Void::Build::Project &p) {
|
||||||
p.executable("winapp").cxx_standard(Void::Build::CxxStandard::Cxx26).sources({"main.cpp"});
|
// C++20 keeps the Windows target buildable with older MinGW-w64 toolchains
|
||||||
p.test("win_test").cxx_standard(Void::Build::CxxStandard::Cxx26).sources({"test.cpp"});
|
// (the CI runner ships GCC 10); the test exercises PE/Wine path handling.
|
||||||
|
p.executable("winapp").cxx_standard(Void::Build::CxxStandard::Cxx20).sources({"main.cpp"});
|
||||||
|
p.test("win_test").cxx_standard(Void::Build::CxxStandard::Cxx20).sources({"test.cpp"});
|
||||||
}
|
}
|
||||||
)cpp");
|
)cpp");
|
||||||
write_file(proj / "main.cpp", "#include <cstdio>\nint main() { return 0; }\n");
|
write_file(proj / "main.cpp", "#include <cstdio>\nint main() { return 0; }\n");
|
||||||
@@ -2696,6 +2721,61 @@ void build(Void::Build::Project &p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// === Coverage reporting (vbs test --coverage) ===
|
||||||
|
VOID_TEST(FullV1Tests, test_coverage_writes_lcov_and_summary) {
|
||||||
|
if (!Platform::resolve_executable("gcov")) {
|
||||||
|
return; // gcov ships with GCC/Clang; skip if the toolchain lacks it.
|
||||||
|
}
|
||||||
|
const auto vbs_bin = locate_vbs_binary();
|
||||||
|
Void::Testing::expect(!vbs_bin.empty() && std::filesystem::exists(vbs_bin));
|
||||||
|
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Void::FileSystem::TempDir tmp{"vbs_coverage_"};
|
||||||
|
const auto proj = tmp / "proj";
|
||||||
|
const auto bdir = tmp / "build";
|
||||||
|
const auto report = tmp / "coverage";
|
||||||
|
write_file(proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||||
|
void build(Void::Build::Project &p) {
|
||||||
|
auto lib = p.static_library("covlib");
|
||||||
|
lib.cxx_standard(Void::Build::CxxStandard::Cxx26).sources({"src/calc.cpp"});
|
||||||
|
p.test("cov_tests")
|
||||||
|
.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||||
|
.sources({"tests/main.cpp"})
|
||||||
|
.link(lib);
|
||||||
|
}
|
||||||
|
)cpp");
|
||||||
|
write_file(proj / "src" / "calc.cpp",
|
||||||
|
"int add(int a, int b) { return a + b; }\n"
|
||||||
|
"int never_called(int a) { return a * 2; }\n");
|
||||||
|
write_file(proj / "tests" / "main.cpp",
|
||||||
|
"int add(int, int);\nint main() { return add(1, 2) == 3 ? 0 : 1; }\n");
|
||||||
|
|
||||||
|
Platform::ProcessRequest req;
|
||||||
|
req.executable = vbs_bin;
|
||||||
|
req.arguments = {"test", "--project", proj.string(), "--build-dir", bdir.string(),
|
||||||
|
"--coverage", report.string()};
|
||||||
|
req.timeout = std::chrono::seconds{300};
|
||||||
|
auto res = Platform::run_supervised(req);
|
||||||
|
Void::Testing::expect(res.has_value() && res->succeeded());
|
||||||
|
if (res && !res->succeeded()) {
|
||||||
|
std::fprintf(stderr, "%s\n", (res->stdout_data + res->stderr_data).c_str());
|
||||||
|
}
|
||||||
|
auto info = Void::FileSystem::read_file(report / "coverage.info");
|
||||||
|
Void::Testing::require(info.has_value());
|
||||||
|
Void::Testing::expect(info->find("SF:") != std::string::npos);
|
||||||
|
Void::Testing::expect(info->find("calc.cpp") != std::string::npos);
|
||||||
|
Void::Testing::expect(info->find("main.cpp") != std::string::npos);
|
||||||
|
// add() is executed, never_called() is not.
|
||||||
|
Void::Testing::expect(info->find("DA:1,1") != std::string::npos);
|
||||||
|
Void::Testing::expect(info->find("DA:2,0") != std::string::npos);
|
||||||
|
Void::Testing::expect(info->find("end_of_record") != std::string::npos);
|
||||||
|
auto summary = Void::FileSystem::read_file(report / "summary.txt");
|
||||||
|
Void::Testing::require(summary.has_value());
|
||||||
|
Void::Testing::expect(summary->starts_with("Coverage: "));
|
||||||
|
Void::Testing::expect(summary->find("%") != std::string::npos);
|
||||||
|
}
|
||||||
|
|
||||||
// === Track A1: Native VBS subproject dependency (builder == "native", zero CMake!) ===
|
// === Track A1: Native VBS subproject dependency (builder == "native", zero CMake!) ===
|
||||||
VOID_TEST(FullV1Tests, native_vbs_subproject_dependency_builds_without_cmake) {
|
VOID_TEST(FullV1Tests, native_vbs_subproject_dependency_builds_without_cmake) {
|
||||||
const auto vbs_bin = locate_vbs_binary();
|
const auto vbs_bin = locate_vbs_binary();
|
||||||
|
|||||||
Reference in new issue
Block a user