Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/ci-recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: CI (recipe-first) [DRAFT]

# ─────────────────────────────────────────────────────────────────────────
# DRAFT recipe-first build path.
#
# This is the intended replacement for the apt + cvc-requirements.yaml +
# hand-written `cmake` steps in ci.yml. Instead it builds libcvc from its
# in-tree cvcpkg recipe (cvcpkg/recipes/libcvc/), which declares the full
# third-party closure — so the same recipe a developer runs locally
#
# cvcpkg build libcvc --recipes-dir cvcpkg/recipes --prefix /tmp/libcvc
#
# is exactly what CI runs. No apt/brew library installs; cvcpkg is the sole
# source of third-party deps on every platform.
#
# ── Why this is still a draft (workflow_dispatch only, not on PRs) ──
# It cannot go green until the closure is *published* to the cvcpkg catalog:
# * libxml2 (new — transfix/libcvc-deps#335) and the ImageMagick delegates
# the libcvc recipe now pulls in (libjpeg-turbo/libpng/libwebp/freetype)
# need published bundles for each platform tuple, otherwise cvcpkg errors
# with "no bundles found in catalog" (unless run with
# --fallback-to-source, which source-builds the whole stack — very slow).
# * Windows has no published dep bundles at all yet.
# Publishing is currently blocked on the cvcpkg token rotation. Once that is
# resolved and the bundles are published, flip the `on:` trigger to
# pull_request/push and retire the corresponding jobs in ci.yml.
# ─────────────────────────────────────────────────────────────────────────

on:
workflow_dispatch:
inputs:
fallback_to_source:
description: "Build any unpublished deps from source (slow)"
type: boolean
default: false

jobs:
build-recipe:
name: recipe / ${{ matrix.os }} / ${{ matrix.build_type }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build_type: [Release, Debug]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.12"

# The cvcpkg CLI itself (same pin used by publish-cvcpkg.yml).
- name: Install cvcpkg
shell: bash
run: pip install 'git+https://github.com/transfix/libcvc-deps@master'

# Build libcvc and its declared closure from the in-tree recipe.
# cvcpkg fetches prebuilt dep bundles from the catalog and compiles only
# libcvc; with --fallback-to-source it also source-builds any dep that
# has no published bundle for this platform.
- name: Build libcvc from its recipe
shell: bash
run: |
set -euo pipefail
config=$(echo "${{ matrix.build_type }}" | tr '[:upper:]' '[:lower:]')
extra=""
if [ "${{ inputs.fallback_to_source }}" = "true" ]; then
extra="--fallback-to-source"
fi
cvcpkg build libcvc \
--recipes-dir cvcpkg/recipes \
--prefix "${{ runner.temp }}/libcvc" \
--config "$config" \
$extra

# Prove the installed SDK is consumable: find_package(cvc CONFIG) must
# resolve and a trivial program must link against cvc::cvc.
- name: Smoke-test the installed SDK
shell: bash
run: |
set -euo pipefail
prefix="${{ runner.temp }}/libcvc"
work="${{ runner.temp }}/consumer"
mkdir -p "$work"
cat > "$work/main.cpp" <<'CPP'
#include <cvc/core/app.h>
#include <cvc/volume/volume.h>
#include <cvc/volume/volume_file_io.h>
int main() {
cvc::app app; // registers volume handlers
cvc::dimension dim(4, 4, 4);
cvc::bounding_box box(0, 0, 0, 1, 1, 1);
std::vector<float> buf(4 * 4 * 4, 1.0f);
cvc::volume v(app, reinterpret_cast<const unsigned char *>(buf.data()), dim,
cvc::Float, box);
v.write("smoke.rawiv"); // exercises the write path (#111)
cvc::volume r(app);
r.read("smoke.rawiv");
return (r.XDim() == 4) ? 0 : 1;
}
CPP
cat > "$work/CMakeLists.txt" <<'CMK'
cmake_minimum_required(VERSION 3.16)
project(cvc_smoke LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
find_package(cvc CONFIG REQUIRED)
add_executable(smoke main.cpp)
target_link_libraries(smoke PRIVATE cvc::cvc)
CMK
cmake -S "$work" -B "$work/build" -DCMAKE_PREFIX_PATH="$prefix"
cmake --build "$work/build"
( cd "$work/build" && ./smoke )
Loading