Debian Codegraph @

dev/ci/ci-env.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 if which cygpath >/dev/null 2>&1; then OCAMLFINDSEP=\;; else OCAMLFINDSEP=:; fi
4
5 if [ "${BASH_SOURCE[0]}" ]; then
6 root="$(dirname "${BASH_SOURCE[0]}")/../.."
7 # make path absolute if relative
8 root=$(cd "$root" && echo "$PWD")
9 elif [ -e "$PWD/dev/ci/ci-env.sh" ]; then
10 root=$PWD
11 else
12 >&2 echo "BASH_SOURCE not working (too old bash version?)"
13 >&2 echo "update bash or run this script from the rocq repository's root directory"
14 exit 1
15 fi
16
17
18 # We can remove setting ROCQLIB and ROCQRUNTIMELIB from here, but better to
19 # wait until we have merged the coq.boot patch so we can do this in a
20 # more controlled way.
21 if [ -n "${GITLAB_CI}" ];
22 then
23 # Gitlab build, Rocq installed into `_install_ci`
24 export COQBIN="$root/_install_ci/bin"
25 export OCAMLPATH="$root/_install_ci/lib$OCAMLFINDSEP$OCAMLPATH"
26 export PATH="$root/_install_ci/bin:$PATH"
27
28 # Where we install external binaries and ocaml libraries
29 # also generally used for dune install --prefix so needs to match coq's expected user-contrib path
30 CI_INSTALL_DIR="$root/_install_ci"
31
32 export CI_BRANCH="$CI_COMMIT_REF_NAME"
33 if [[ ${CI_BRANCH#pr-} =~ ^[0-9]*$ ]]
34 then
35 export CI_PULL_REQUEST="${CI_BRANCH#pr-}"
36 fi
37 elif [ -d "$root/_build/install/default/" ];
38 then
39 # Full Dune build, we basically do what `dune exec --` does
40 export OCAMLPATH="$root/_build/install/default/lib/$OCAMLFINDSEP$OCAMLPATH"
41 export COQBIN="$root/_build/install/default/bin"
42 export ROCQLIB="$root/_build/install/default/lib/coq"
43 export ROCQRUNTIMELIB="$root/_build/install/default/lib/rocq-runtime"
44
45 CI_INSTALL_DIR="$root/_build/install/default/"
46
47 CI_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
48 export CI_BRANCH
49 fi
50
51 export PATH="$COQBIN:$PATH"
52
53 # Rocq's tools need an ending slash :S, we should fix them.
54 export COQBIN="$COQBIN/"