#!/usr/bin/env bash #************************************************************************** #* * #* OCaml * #* * #* Anil Madhavapeddy, OCaml Labs * #* * #* Copyright 2014 Institut National de Recherche en Informatique et * #* en Automatique. * #* * #* All rights reserved. This file is distributed under the terms of * #* the GNU Lesser General Public License version 2.1, with the * #* special exception on linking described in the file LICENSE. * #* * #************************************************************************** set -xe PREFIX=~/local MAKE="make $MAKE_ARG" SHELL=dash MAKE_WARN="$MAKE --warn-undefined-variables" export PATH=$PREFIX/bin:$PATH Configure () { mkdir -p $PREFIX cat</dev/null ; then echo Check the code examples in the manual $MAKE manual-pregen fi # check_all_arches checks tries to compile all backends in place, # we would need to redo (small parts of) world.opt afterwards to # use the compiler again $MAKE check_all_arches # Ensure that .gitignore is up-to-date - this will fail if any untreacked or # altered files exist. test -z "$(git status --porcelain)" # check that the 'clean' target also works $MAKE clean $MAKE -C manual clean $MAKE -C manual distclean # check that the `distclean` target definitely cleans the tree $MAKE distclean # Check the working tree is clean test -z "$(git status --porcelain)" # Check that there are no ignored files test -z "$(git ls-files --others -i --exclude-standard)" } CheckManual () { cat<>"$GITHUB_OUTPUT" exit $CODE } BasicCompiler () { trap ReportBuildStatus ERR ./configure --disable-dependency-generation \ --disable-debug-runtime \ --disable-instrumented-runtime # Need a runtime make -j coldstart # And generated files (ocamllex compiles ocamlyacc) make -j ocamllex ReportBuildStatus 0 } case $1 in configure) Configure;; build) Build;; test) Test parallel;; test_sequential) Test sequential;; test_prefix) TestPrefix $2;; api-docs) API_Docs;; install) Install;; manual) BuildManual;; other-checks) Checks;; basic-compiler) BasicCompiler;; *) echo "Unknown CI instruction: $1" exit 1;; esac