diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 698d0f5fe47285f9e9bdf5541e2907d297dfd26e..7cbbc813d1d0fc6219cf7bccd687b1939520237a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ variables: - fp-timing script: # prepare - - . build/opam-ci.sh coq "$COQ_VERSION" + - . build/opam-ci.sh $OPAM_PINS - env | egrep '^(CI_BUILD_REF|CI_RUNNER)' > build-env.txt # build - 'time make -k -j$CPU_CORES TIMED=y 2>&1 | tee build-log.txt' @@ -41,17 +41,17 @@ opam: build-coq.8.7.dev: <<: *template variables: - COQ_VERSION: "8.7.dev" + OPAM_PINS: "coq version 8.7.dev" build-coq.8.7: <<: *template variables: - COQ_VERSION: "8.7.0" + OPAM_PINS: "coq version 8.7.0" build-coq.8.6.1: <<: *template variables: - COQ_VERSION: "8.6.1" + OPAM_PINS: "coq version 8.6.1" VALIDATE: "1" artifacts: paths: @@ -61,5 +61,5 @@ build-coq.8.6.1: build-coq.8.6: <<: *template variables: - COQ_VERSION: "8.6" + OPAM_PINS: "coq version 8.6" diff --git a/build/opam-ci.sh b/build/opam-ci.sh index b5607a1666c3cb3d82fe9c96bec801fdbaa38569..95abf4bc02ea672e670a95fc9364218e324c317f 100755 --- a/build/opam-ci.sh +++ b/build/opam-ci.sh @@ -47,14 +47,16 @@ echo echo while (( "$#" )); do # while there are arguments left PACKAGE="$1" ; shift + KIND="$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" + read -a PIN <<< $(opam pin list | (egrep "^$PACKAGE[. ]")) + if [[ "${PIN[1]}" == "$KIND" && "${PIN[2]}" == "$VERSION" ]]; then + echo "[opam-ci] $PACKAGE already $KIND-pinned to $VERSION" else - echo "[opam-ci] Pinning $PACKAGE to $VERSION" - run_and_print opam pin add -y -k version "$PACKAGE" "$VERSION" + echo "[opam-ci] $KIND-pinning $PACKAGE to $VERSION" + run_and_print opam pin add -y -k "$KIND" "$PACKAGE" "$VERSION" fi done