Remove obsolete hash quality comparison #9531
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OCaml Binding CI (Ubuntu + macOS) | |
| on: | |
| push: | |
| branches: [ "**" ] | |
| pull_request: | |
| branches: [ "**" ] | |
| workflow_dispatch: | |
| jobs: | |
| build-test: | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest ] | |
| ocaml-version: ["5"] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7.0.1 | |
| # Cache ccache (shared across runs) | |
| - name: Cache ccache | |
| uses: actions/cache@v6.1.0 | |
| with: | |
| path: ~/.ccache | |
| key: ${{ runner.os }}-ccache-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-ccache- | |
| # Setup OCaml via action (handles opam caching internally) | |
| - uses: ocaml/setup-ocaml@v3 | |
| with: | |
| ocaml-compiler: ${{ matrix.ocaml-version }} | |
| opam-disable-sandboxing: true | |
| cache-prefix: v1 | |
| # Platform-specific dependencies | |
| - name: Install system dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| bubblewrap m4 libgmp-dev pkg-config ninja-build ccache | |
| - name: Install system dependencies (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install gmp pkg-config ninja ccache | |
| - name: Install required opam packages | |
| run: opam install -y ocamlfind zarith | |
| # Configure | |
| - name: Configure with CMake | |
| env: | |
| CC: ${{ matrix.os == 'macos-latest' && 'ccache clang' || 'ccache gcc' }} | |
| CXX: ${{ matrix.os == 'macos-latest' && 'ccache clang++' || 'ccache g++' }} | |
| run: | | |
| mkdir -p build | |
| cd build | |
| eval $(opam env) | |
| echo "CC: $CC" | |
| echo "CXX: $CXX" | |
| echo "OCAMLFIND: $(which ocamlfind)" | |
| echo "OCAMLC: $(which ocamlc)" | |
| echo "OCAMLOPT: $(which ocamlopt)" | |
| echo "OCAML_VERSION: $(ocamlc -version)" | |
| echo "OCAMLLIB: $OCAMLLIB" | |
| cmake .. \ | |
| -G Ninja \ | |
| -DZ3_BUILD_LIBZ3_SHARED=ON \ | |
| -DZ3_BUILD_OCAML_BINDINGS=ON \ | |
| -DZ3_BUILD_JAVA_BINDINGS=OFF \ | |
| -DZ3_BUILD_PYTHON_BINDINGS=OFF \ | |
| -DZ3_BUILD_EXECUTABLE=OFF \ | |
| -DZ3_BUILD_CLI=OFF \ | |
| -DZ3_ENABLE_EXAMPLE_TARGETS=OFF \ | |
| -DZ3_BUILD_TEST_EXECUTABLES=OFF \ | |
| -DCMAKE_VERBOSE_MAKEFILE=TRUE | |
| - name: Build Z3 and OCaml bindings | |
| run: | | |
| ccache -z || true | |
| eval $(opam env) | |
| cd build | |
| ninja build_z3_ocaml_bindings | |
| ccache -s || true | |
| - name: Install Z3 and OCaml bindings | |
| run: | | |
| eval $(opam env) | |
| cmake --install build --prefix "$(pwd)/install" | |
| - name: Verify installed OCaml artifacts | |
| run: | | |
| INSTALL_LIBDIR="$(pwd)/install/lib" | |
| INSTALL_OCAML_DIR="$INSTALL_LIBDIR/ocaml/z3" | |
| INSTALL_STUBLIB_DIR="$INSTALL_LIBDIR/ocaml/stublibs" | |
| test -e "$INSTALL_LIBDIR/libz3${{ matrix.os == 'macos-latest' && '.dylib' || '.so' }}" | |
| test -f "$INSTALL_OCAML_DIR/META" | |
| test -f "$INSTALL_OCAML_DIR/z3.mli" | |
| test -f "$INSTALL_OCAML_DIR/z3.cmi" | |
| test -f "$INSTALL_OCAML_DIR/z3.cmx" | |
| test -f "$INSTALL_OCAML_DIR/z3enums.mli" | |
| test -f "$INSTALL_OCAML_DIR/z3enums.cmi" | |
| test -f "$INSTALL_OCAML_DIR/z3enums.cmx" | |
| test -f "$INSTALL_OCAML_DIR/z3native.mli" | |
| test -f "$INSTALL_OCAML_DIR/z3native.cmi" | |
| test -f "$INSTALL_OCAML_DIR/z3native.cmx" | |
| test -f "$INSTALL_OCAML_DIR/libz3ml.a" | |
| test -f "$INSTALL_OCAML_DIR/z3ml.a" | |
| test -f "$INSTALL_OCAML_DIR/z3ml.cma" | |
| test -f "$INSTALL_OCAML_DIR/z3ml.cmxa" | |
| test -f "$INSTALL_OCAML_DIR/z3ml.cmxs" | |
| test -f "$INSTALL_STUBLIB_DIR/dllz3ml.so" | |
| - name: Verify macOS OCaml stub load path | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| otool -L install/lib/ocaml/stublibs/dllz3ml.so | tee install/dllz3ml-otool.txt | |
| grep -E '@rpath/libz3(\.[0-9]+)+\.dylib' install/dllz3ml-otool.txt | |
| otool -l install/lib/ocaml/stublibs/dllz3ml.so | tee install/dllz3ml-load-commands.txt | |
| grep '@loader_path/../../' install/dllz3ml-load-commands.txt | |
| - name: Compile installed ml_example.byte | |
| run: | | |
| eval $(opam env) | |
| ocamlfind ocamlc -o ml_example.byte \ | |
| -package zarith \ | |
| -linkpkg \ | |
| -I install/lib/ocaml/z3 \ | |
| -I install/lib/ocaml/stublibs \ | |
| -dllpath install/lib/ocaml/stublibs \ | |
| install/lib/ocaml/z3/z3ml.cma \ | |
| examples/ml/ml_example.ml | |
| - name: Run installed ml_example.byte | |
| run: | | |
| eval $(opam env) | |
| export DYLD_LIBRARY_PATH=$(pwd)/install/lib | |
| export LD_LIBRARY_PATH=$(pwd)/install/lib | |
| ocamlrun ./ml_example.byte | |
| - name: Compile installed ml_example (native) | |
| run: | | |
| eval $(opam env) | |
| ocamlfind ocamlopt -o ml_example \ | |
| -package zarith \ | |
| -linkpkg \ | |
| -I install/lib/ocaml/z3 \ | |
| -I install/lib/ocaml/stublibs \ | |
| install/lib/ocaml/z3/z3ml.cmxa \ | |
| examples/ml/ml_example.ml | |
| - name: Run installed ml_example (native) | |
| run: | | |
| export DYLD_LIBRARY_PATH=$(pwd)/install/lib | |
| export LD_LIBRARY_PATH=$(pwd)/install/lib | |
| ./ml_example |