Files
solvecraft/.github/workflows/ci.yml
T
bherbruck a42407ac5c CI: clippy with the C++ feature; fix the lints it finds
The clippy job builds without the cpp feature, so the difftest unit runners
(registered only under difftest/cpp) were never linted. Add a clippy step to
the difftest job after the C++ reference build, using --features difftest/cpp
(which also enables solidcore-ffi/cpp; solidcore-ffi/cpp alone does not
compile the runners).

Fix the 9 lints it reports, with no allows and no change to generated inputs
or comparisons (reports byte-identical before and after):
- intersect_surface_tracer: assign_op_pattern, range_plus_one
- surface_surface_cache_p2: indexing_slicing, range_plus_one
- topology_brep_data: items_after_statements, let_and_return, doc_markdown,
  neg_cmp_op_on_partial_ord, indexing_slicing

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNGVDsEXPdxtFSUKma3wKs
2026-10-13 22:38:35 -04:00

138 lines
4.6 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
# Must match ATTRIBUTION.md / AGENTS.md (full SHA so a shallow fetch works).
UPSTREAM_REPO: https://github.com/NVIDIA-Omniverse/usd-brep
UPSTREAM_COMMIT: c9c5979f04cea8c38213004d4f04df0dcfb40d05 # c9c5979
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup show active-toolchain || rustup toolchain install
- run: cargo fmt --all --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> bin"
- run: cargo clippy --workspace --all-targets -- -D warnings
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> bin"
- run: cargo test --workspace
wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> bin"
- run: rustup target add wasm32-unknown-unknown
- run: cargo check -p solidcore --target wasm32-unknown-unknown
# Same packaging check the release workflow runs before publishing (no secrets).
publish-dry-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> bin"
- run: cargo publish -p solidcore --locked --dry-run
deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check licenses bans sources
difftest:
runs-on: ubuntu-latest
needs: [test]
env:
SOLIDCORE_CPP_DIR: ${{ github.workspace }}/.cpp
steps:
- uses: actions/checkout@v4
- name: Skip when no unit is green
id: green
run: |
if [ -f plan/modules.toml ] && grep -Eq '^\s*status\s*=\s*"green"' plan/modules.toml; then
echo "any=true" >> "$GITHUB_OUTPUT"
else
echo "any=false" >> "$GITHUB_OUTPUT"
echo "No green units in plan/modules.toml; nothing to difftest."
fi
- name: Clone upstream at pinned commit
if: steps.green.outputs.any == 'true'
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"
- name: Install C++ build tools
if: steps.green.outputs.any == 'true'
run: sudo apt-get update && sudo apt-get install -y ninja-build cmake g++
# The C++ build lives outside cargo's target dir (bin/): rust-cache's post-step
# cleans bin/ before this cache saves, which once cached an empty bin/cpp.
- name: Cache C++ reference build
if: steps.green.outputs.any == 'true'
uses: actions/cache@v4
with:
path: .cpp
# Shims are compiled by solidcore-ffi, not by build.sh, so they stay out of the key.
key: cpp-v2-${{ runner.os }}-${{ env.UPSTREAM_COMMIT }}-${{ hashFiles('harness/cpp/CMakeLists.txt', 'harness/cpp/build.sh', 'harness/cpp/stubs/**', 'harness/cpp/patches/**') }}
- name: Build C++ reference (when the cache did not provide the libs)
if: steps.green.outputs.any == 'true'
run: |
if [ -f .cpp/lib/libSMLib.a ] && [ -f .cpp/lib/libSM_API.a ] && [ -f .cpp/ffi.env ]; then
echo "C++ reference restored from cache"
else
harness/cpp/build.sh --jobs "$(nproc)"
fi
- uses: Swatinem/rust-cache@v2
if: steps.green.outputs.any == 'true'
with:
workspaces: ". -> bin"
key: difftest
# The clippy job above cannot see code behind the cpp feature (ffi bindings and
# the difftest unit runners); lint it here, where the C++ headers exist.
# difftest/cpp enables solidcore-ffi/cpp and registers the runners.
- name: Clippy with the C++ feature
if: steps.green.outputs.any == 'true'
run: cargo clippy --workspace --all-targets --features difftest/cpp -- -D warnings
- name: Difftest green units
if: steps.green.outputs.any == 'true'
# Optimised profile (Cargo.toml [profile.difftest]): identical results, about 20x
# faster than the debug build that used to take ~35 min here.
run: cargo run --profile difftest -p difftest --features cpp -- --green