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

# 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
19
test -d "$OPAMROOT/repo/coq-extra-dev" && opam repo remove coq-extra-dev
Ralf Jung's avatar
Ralf Jung committed
20
21
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
30
31
# We really want to run all of the following in one opam transaction, but due to opam limitations,
# that is not currently possible.

# Install fixed versions of some dependencies.
Ralf Jung's avatar
Ralf Jung committed
32
echo
33
34
35
while (( "$#" )); do # while there are arguments left
    PACKAGE="$1" ; shift
    VERSION="$1" ; shift
36

37
38
39
40
41
42
43
    # 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
44
45
done

46
# Upgrade cached things.
Ralf Jung's avatar
Ralf Jung committed
47
echo "[opam-ci] Upgrading opam"
48
49
opam upgrade -y

50
# Install build-dependencies.
Ralf Jung's avatar
Ralf Jung committed
51
echo
Ralf Jung's avatar
Ralf Jung committed
52
echo "[opam-ci] Installing build-dependencies"
53
make build-dep OPAMFLAGS=-y
Ralf Jung's avatar
Ralf Jung committed
54
55
56
57

# done
echo
coqc -v