Skip to content

Merge branch 'redesign' of https://github.com/bloomberg/crane into re… #487

Merge branch 'redesign' of https://github.com/bloomberg/crane into re…

Merge branch 'redesign' of https://github.com/bloomberg/crane into re… #487

Workflow file for this run

name: Build CI
on:
- pull_request
- push
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
coq_version:
- "9.0"
ocaml_version:
- "4.14-flambda"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Normalize Workspace Permissions
run: |
sudo chmod -R a+rwX "$GITHUB_WORKSPACE"
- name: Build and Extract
uses: coq-community/docker-coq-action@v1
with:
opam_file: 'rocq-crane.opam'
coq_version: ${{ matrix.coq_version }}
ocaml_version: ${{ matrix.ocaml_version }}
before_install: |
startGroup "Print opam config"
opam config list; opam repo list; opam list
endGroup
custom_script: |
startGroup "Build project"
opam exec -- dune build -p rocq-crane && dune install
endGroup
- name: Install clang and GMP
run: |
sudo apt-get update
sudo apt-get install -y clang-19 libc++-19-dev libc++abi-19-dev libgmp-dev
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
clang++ --version
- name: Run C++ tests
run: |
# Find and run all test executables except those in wip or requiring BDE
failed=0
passed=0
skipped=0
for dir in tests/*/; do
dirname=$(basename "$dir")
# Skip wip directory
if [ "$dirname" = "wip" ]; then
echo "Skipping tests/wip/ (work in progress)"
continue
fi
# Find all .t.cpp files in this directory tree
for test_src in $(find "$dir" -name "*.t.cpp" 2>/dev/null); do
test_dir=$(dirname "$test_src")
test_name=$(basename "$test_src" .t.cpp)
# Skip BDE tests (they end with _bde)
if [[ "$test_name" == *_bde ]]; then
echo "⊘ SKIPPED: $test_name (requires BDE)"
skipped=$((skipped + 1))
continue
fi
echo "=== Building and running: $test_dir/$test_name ==="
compile_script="scripts/compile-std.sh"
if [[ "$test_name" == *_gmp ]]; then
compile_script="scripts/compile-gmp.sh"
fi
# Compile the test
if (
cd "$test_dir"
"$GITHUB_WORKSPACE/$compile_script" "$GITHUB_WORKSPACE" "$test_name.t.exe" \
"$test_name.cpp" "$test_name.t.cpp"
) 2>&1; then
# Run the test from its directory (tests may read files by relative path)
if (cd "$test_dir" && "./$test_name.t.exe"); then
echo "✓ PASSED: $test_name"
passed=$((passed + 1))
else
echo "✗ FAILED: $test_name (runtime error)"
failed=$((failed + 1))
fi
else
echo "✗ FAILED: $test_name (compilation error)"
failed=$((failed + 1))
fi
echo ""
done
done
echo "================================"
echo "Results: $passed passed, $failed failed, $skipped skipped"
echo "================================"
if [ $failed -gt 0 ]; then
echo "Some tests failed!"
exit 1
fi
echo "All tests passed!"