opam-ci.sh 1.29 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
14
15
16
if test $(find "$OPAMROOT/repo/package-index" -mtime 1); then
    # last update was more than a day ago
    opam update
fi
Ralf Jung's avatar
Ralf Jung committed
17
18
19
20
21
22
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
23
24
25
26
27
28
29
30
31
32
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
33
34
35
36
37
38
39
40
41
done

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

# done
echo
coqc -v