mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-08 21:11:56 +00:00
b50a704c90
Snapshot of the swarm's in-progress v1.0.1 port before merging main: per-slice ports (curve_class, face, brep/NLib, heal, primitives/cone, SM_API and small files, offset/merge/topology_intersector, proto_topology, vertex/vertexuse/track changes), shim/FFI updates, the pin file and callgraph remap, fixtures and "fixed in v1.0.1" addenda. Not yet gated. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PJzQKZ9sjU1DhgS253e8J5
97 lines
4.1 KiB
YAML
97 lines
4.1 KiB
YAML
name: C++ reference
|
|
description: >
|
|
Clones upstream at the pinned commit, enables sccache and installs the C++ reference
|
|
(bin/cpp layout) into $SOLIDCORE_CPP_DIR, so the cpp feature of solidcore-ffi builds.
|
|
Expects SOLIDCORE_CPP_DIR in the job environment; the upstream pin (UPSTREAM_REPO,
|
|
UPSTREAM_VERSION, UPSTREAM_COMMIT) comes from scripts/upstream-pin.env unless the job
|
|
environment already sets it.
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Load upstream pin
|
|
shell: bash
|
|
run: |
|
|
while IFS='=' read -r k v; do
|
|
case "$k" in
|
|
UPSTREAM_REPO|UPSTREAM_VERSION|UPSTREAM_COMMIT)
|
|
if [ -z "${!k:-}" ]; then echo "$k=$v" >> "$GITHUB_ENV"; fi ;;
|
|
esac
|
|
done < scripts/upstream-pin.env
|
|
|
|
- name: Clone upstream at pinned commit
|
|
shell: bash
|
|
run: |
|
|
git init upstream
|
|
git -C upstream remote add origin "$UPSTREAM_REPO"
|
|
git -C upstream fetch --depth 1 origin "$UPSTREAM_COMMIT" \
|
|
|| git -C upstream fetch origin
|
|
git -C upstream checkout --detach "$UPSTREAM_COMMIT"
|
|
|
|
# sccache caches the ~200 shim objects solidcore-ffi compiles (the cc crate wraps the
|
|
# C++ compiler in RUSTC_WRAPPER when it is sccache) and the workspace crates, which
|
|
# rust-cache does not keep; both survive across runs in the GitHub Actions cache.
|
|
- name: Set up sccache
|
|
uses: mozilla-actions/sccache-action@v0.0.11
|
|
|
|
- name: Enable sccache
|
|
shell: bash
|
|
run: |
|
|
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
|
|
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
|
|
# The difftest run is idle for sccache for minutes; without this the server
|
|
# exits after 10 idle minutes and the stats printed at the end read zero.
|
|
echo "SCCACHE_IDLE_TIMEOUT=0" >> "$GITHUB_ENV"
|
|
# Start the server now, so a cache-storage outage (the Actions cache answering
|
|
# 503 ServerBusy at startup) costs a cold build instead of failing the job.
|
|
if ! SCCACHE_GHA_ENABLED=true SCCACHE_IDLE_TIMEOUT=0 sccache --start-server; then
|
|
echo "::warning::sccache could not start (cache storage unavailable); building without it"
|
|
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
|
|
echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
# The C++ reference (bin/cpp/lib) comes prebuilt from the GitHub Release that
|
|
# .github/workflows/cpp-reference.yml publishes for scripts/cpp-ref-key.sh's key.
|
|
# When none matches (a PR that changes harness/cpp before it is published), build it
|
|
# from source and keep that build in actions/cache under the same key. It lives
|
|
# outside cargo's target dir (bin/): rust-cache's post-step cleans bin/.
|
|
- name: C++ reference key
|
|
id: cppkey
|
|
shell: bash
|
|
run: echo "key=$(scripts/cpp-ref-key.sh)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore C++ reference built from source
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: .cpp
|
|
key: cpp-v3-${{ runner.os }}-${{ steps.cppkey.outputs.key }}
|
|
|
|
- name: Fetch C++ reference (build it when no prebuilt matches)
|
|
id: cpp
|
|
shell: bash
|
|
run: |
|
|
cpp=$SOLIDCORE_CPP_DIR
|
|
if [ -f "$cpp/lib/libSMLib.a" ] && [ -f "$cpp/lib/libSM_API.a" ] && [ -f "$cpp/ffi.env" ]; then
|
|
echo "C++ reference restored from cache"
|
|
exit 0
|
|
fi
|
|
command -v zstd >/dev/null || sudo apt-get install -y zstd
|
|
rc=0
|
|
scripts/fetch-cpp.sh --no-build || rc=$?
|
|
if [ "$rc" = 3 ]; then
|
|
sudo apt-get update && sudo apt-get install -y ninja-build cmake g++
|
|
harness/cpp/build.sh --no-tests --jobs "$(nproc)"
|
|
echo "built=true" >> "$GITHUB_OUTPUT"
|
|
elif [ "$rc" != 0 ]; then
|
|
exit "$rc"
|
|
fi
|
|
|
|
# Several jobs may build the same key at once; only the first save wins, the
|
|
# others log a warning.
|
|
- name: Save C++ reference built from source
|
|
if: steps.cpp.outputs.built == 'true'
|
|
uses: actions/cache/save@v4
|
|
continue-on-error: true
|
|
with:
|
|
path: .cpp
|
|
key: cpp-v3-${{ runner.os }}-${{ steps.cppkey.outputs.key }}
|