#!/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 call-configure () { local failed ./configure "$@" || failed=$? if ((failed)); then # Output seems to be a little unpredictable in GitHub Actions: ensure that # the fold is definitely on a new line echo echo "::group::config.log content ($(wc -l config.log) lines)" cat config.log echo '::endgroup::' exit $failed fi } 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 () { local failed trap ReportBuildStatus ERR call-configure --disable-dependency-generation \ --disable-debug-runtime \ --disable-instrumented-runtime \ --enable-ocamltest \ # Need a runtime make -j coldstart || failed=$? if ((failed)) ; then make -j1 V=1 coldstart exit $failed fi # And generated files (ocamllex compiles ocamlyacc) make -j ocamllex || failed=$? if ((failed)) ; then make -j1 V=1 ocamllex exit $failed fi 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