View raw

1 #!/usr/bin/env sh 2 # The definition-of-done gates, in the order the workflow steering requires: 3 # 4 # 1. dune build @check type-checks the libraries and the tests 5 # 2. dune runtest runs every Alcotest suite 6 # 3. dune build @fmt confirms ocamlformat and dune formatting are applied 7 # 8 # Exit status is non-zero if any gate fails, so a cron job or the deployment 9 # host's trusted receive-hook helper can enforce the same bar with one call. The 10 # build directory is isolated so a developer's watch build is never disturbed. 11 # 12 # Usage: scripts/ci.sh run all gates 13 # BUILD_DIR=... scripts/ci.sh override the build directory 14 15 set -eu 16 17 BUILD_DIR="${BUILD_DIR:-_build-ci}" 18 19 run() { 20 printf '==> %s\n' "$*" 21 "$@" 22 } 23 24 run dune build @check --build-dir "$BUILD_DIR" 25 run dune runtest --build-dir "$BUILD_DIR" --force 26 run dune build @fmt --build-dir "$BUILD_DIR" 27 28 printf '==> all gates passed\n' 29