opam-ci.sh 1.6 KB
Newer Older
Ralf Jung's avatar
Ralf Jung committed
1 2 3 4 5 6
#!/bin/bash
set -e
# This script installs the build dependencies for CI builds.

# Prepare OPAM configuration
export OPAMROOT="$(pwd)/opamroot"
Ralf Jung's avatar
Ralf Jung committed
7
export OPAMJOBS="$((2*$CPU_CORES))"
Ralf Jung's avatar
Ralf Jung committed
8 9 10 11 12
export OPAM_EDITOR="$(which false)"

# Make sure we got a good OPAM
test -d "$OPAMROOT" || (mkdir "$OPAMROOT" && opam init --no-setup -y)
eval `opam conf env`
Ralf Jung's avatar
Ralf Jung committed
13
if test $(find "$OPAMROOT/repo/package-index" -mtime +0); then
Ralf Jung's avatar
Ralf Jung committed
14 15
    # last update was more than a day ago
    opam update
Ralf Jung's avatar
Ralf Jung committed
16 17
else
    echo "[opam-ci] Not updating opam."
Ralf Jung's avatar
Ralf Jung committed
18
fi
Ralf Jung's avatar
Ralf Jung committed
19 20 21
test -d "$OPAMROOT/repo/coq-extra-dev" || opam repo add coq-extra-dev https://coq.inria.fr/opam/extra-dev -p 5
test -d "$OPAMROOT/repo/coq-core-dev" || opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev -p 5
test -d "$OPAMROOT/repo/coq-released" || opam repo add coq-released https://coq.inria.fr/opam/released -p 10
22 23 24 25 26
test -d "$OPAMROOT/repo/iris-dev" || opam repo add iris-dev https://gitlab.mpi-sws.org/FP/opam-dev.git -p 20

# Make sure we have no undesired pins left from opam.pins times
opam pin remove coq-stdpp -n
opam pin remove coq-iris -n
Ralf Jung's avatar
Ralf Jung committed
27 28 29

# Install fixed versions of some dependencies
echo
30 31 32 33 34 35 36 37 38 39
while (( "$#" )); do # while there are arguments left
    PACKAGE="$1" ; shift
    VERSION="$1" ; shift
    # Check if the pin is already set
    if opam pin list | fgrep "$PACKAGE.$VERSION " > /dev/null; then
        echo "[opam-ci] $PACKAGE already pinned to $VERSION"
    else
        echo "[opam-ci] Pinning $PACKAGE to $VERSION"
        opam pin add "$PACKAGE" "$VERSION" -k version -y
    fi
Ralf Jung's avatar
Ralf Jung committed
40 41
done

42 43 44
# Upgrade cached things
opam upgrade -y

Ralf Jung's avatar
Ralf Jung committed
45 46 47 48 49 50 51
# Install build-dependencies
echo
make build-dep Y=1

# done
echo
coqc -v