opam-ci.sh 1.33 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
22
23
24
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

# Install fixed versions of some dependencies
echo
25
26
27
28
29
30
31
32
33
34
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
35
36
37
38
39
40
41
42
43
done

# Install build-dependencies
echo
make build-dep Y=1

# done
echo
coqc -v