From a8f273484d76615646cc67427a3119aca32478aa Mon Sep 17 00:00:00 2001
From: Ralf Jung <jung@mpi-sws.org>
Date: Tue, 3 Apr 2018 16:41:32 +0200
Subject: [PATCH] update CI

---
 .gitlab-ci.yml      | 24 ++++------------
 .gitmodules         |  3 ++
 build/coqdoc        | 20 -------------
 build/opam-ci.sh    | 68 ---------------------------------------------
 build/ssh           |  3 --
 build/ssh_host_keys |  3 --
 ci                  |  1 +
 7 files changed, 10 insertions(+), 112 deletions(-)
 create mode 100644 .gitmodules
 delete mode 100755 build/coqdoc
 delete mode 100755 build/opam-ci.sh
 delete mode 100755 build/ssh
 delete mode 100644 build/ssh_host_keys
 create mode 160000 ci

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6b3c9a0c..10f335a2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,25 +5,14 @@ stages:
 
 variables:
   CPU_CORES: "10"
+  GIT_SUBMODULE_STRATEGY: "recursive"
 
 .template: &template
   stage: build
   tags:
   - fp
   script:
-  # prepare
-  - . 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'
-  - 'if fgrep Axiom build-log.txt >/dev/null; then exit 1; fi'
-  - 'cat build-log.txt | egrep "[a-zA-Z0-9_/-]+ \((real|user): [0-9]" | tee build-time.txt'
-  # maybe validate
-  - 'if [[ -n "$VALIDATE" ]]; then make validate; fi'
-  # maybe generate and upload doc (has to be in this job as we need coq installed)
-  - 'if [[ -n "$DOCDIR" && "$CI_COMMIT_REF_NAME" == master ]]; then build/coqdoc; fi'
-  # maybe create opam package
-  - 'if [[ -n "$OPAM_PKG" && "$CI_COMMIT_REF_NAME" == master ]]; then curl --fail -X POST -F "token=$OPAM_UPDATE_SECRET" -F "ref=master" -F "variables[REPO]=$CI_PROJECT_URL.git" -F "variables[REF]=$CI_COMMIT_REF_NAME" -F "variables[SHA]=$CI_COMMIT_SHA" -F "variables[NAME]=$OPAM_PKG" https://gitlab.mpi-sws.org/api/v4/projects/581/trigger/pipeline; fi'
+  - ci/buildjob
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -33,6 +22,7 @@ variables:
   - /^ci/
   except:
   - triggers
+  - schedules
 
 ## Build jobs
 
@@ -53,13 +43,11 @@ build-coq.8.7.2:
   variables:
     OPAM_PINS: "coq version 8.7.2"
     OPAM_PKG: "coq-stdpp"
-    DOCDIR: "coqdoc@center.mpi-sws.org:/stdpp"
+    DOC_DIR: "coqdoc@center.mpi-sws.org:/stdpp"
+    TIMING_PROJECT: "stdpp"
+    TIMING_CONF: "coq-8.7.2"
   tags:
   - fp-timing
-  artifacts:
-    paths:
-    - build-time.txt
-    - build-env.txt
 
 build-coq.8.7.1:
   <<: *template
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..53648fdc
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "ci"]
+	path = ci
+	url = https://gitlab.mpi-sws.org/FP/iris-ci.git
diff --git a/build/coqdoc b/build/coqdoc
deleted file mode 100755
index d3539b3d..00000000
--- a/build/coqdoc
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# Script to automatically generate and publish coqdoc via CI.
-# This reads the following environment variables:
-# - DOCDIR: The directory to upload the documentation to
-set -e
-echo "Publishing documentation from branch $CI_COMMIT_REF_NAME to $DOCDIR"
-
-# We need a custom wrapper around SSH to use our settings, and ssh-agent for the key
-eval $(ssh-agent -s)
-echo "${COQDOC_KEY}" | tr -d '\r' | ssh-add -
-export GIT_SSH=$(readlink -e "$(dirname "$0")/ssh")
-
-# Enable tracing mode *after* we did the secret key stuff above
-set -x
-
-# Generate documentation
-make html
-
-# Upload documentation
-rsync -a --delete -e "$GIT_SSH" html/ "$DOCDIR/"
diff --git a/build/opam-ci.sh b/build/opam-ci.sh
deleted file mode 100755
index bc51df87..00000000
--- a/build/opam-ci.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-set -e
-set -x
-## This script installs the build dependencies for CI builds.
-
-# Prepare OPAM configuration
-export OPAMROOT="$(pwd)/opamroot"
-export OPAMJOBS="$((2*$CPU_CORES))"
-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`
-
-# Make sure the pin for the builddep package is not stale.
-make build-dep/opam
-
-# Update repositories
-opam update
-
-# Make sure we got the right set of repositories registered
-if echo "$@" | fgrep "dev" > /dev/null; then
-    # We are compiling against a dev version of something.  Get ourselves the dev repositories.
-    test -d "$OPAMROOT/repo/coq-extra-dev" || opam repo add coq-extra-dev https://coq.inria.fr/opam/extra-dev -p 0
-    test -d "$OPAMROOT/repo/coq-core-dev" || opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev -p 5
-else
-    # No dev version, make sure we do not have the dev repositories.
-    test -d "$OPAMROOT/repo/coq-extra-dev" && opam repo remove coq-extra-dev
-    test -d "$OPAMROOT/repo/coq-core-dev" && opam repo remove coq-core-dev
-fi
-test -d "$OPAMROOT/repo/coq-released" || opam repo add coq-released https://coq.inria.fr/opam/released -p 10
-test -d "$OPAMROOT/repo/iris-dev" || opam repo add iris-dev https://gitlab.mpi-sws.org/FP/opam-dev.git -p 20
-echo
-
-# 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.
-echo
-while (( "$#" )); do # while there are arguments left
-    PACKAGE="$1" ; shift
-    KIND="$1" ; shift
-    VERSION="$1" ; shift
-
-    # Check if the pin is already set
-    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] $KIND-pinning $PACKAGE to $VERSION"
-        opam pin add -y -k "$KIND" "$PACKAGE" "$VERSION"
-    fi
-done
-
-# Upgrade cached things.
-echo
-echo "[opam-ci] Upgrading opam"
-opam upgrade -y --fixup && opam upgrade -y
-
-# Install build-dependencies.
-echo
-echo "[opam-ci] Installing build-dependencies"
-make build-dep OPAMFLAGS=-y
-
-# done
-set +x
-echo
-coqc -v
diff --git a/build/ssh b/build/ssh
deleted file mode 100755
index 735146c0..00000000
--- a/build/ssh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-_DIR=$(readlink -e "$(dirname "$0")")
-exec ssh -o StrictHostKeyChecking=yes -o UserKnownHostsFile="${_DIR}/ssh_host_keys" "$@"
diff --git a/build/ssh_host_keys b/build/ssh_host_keys
deleted file mode 100644
index 677028ff..00000000
--- a/build/ssh_host_keys
+++ /dev/null
@@ -1,3 +0,0 @@
-# center.mpi-sws.org
-center.mpi-sws.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHG8dNazSgw2XgGFi9/vEs8+VKYX66SlWVy6wx+3rZU5
-center.mpi-sws.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDC4vIw4pgkQc2mKEpl99wERvpBsvAqU6UwKVL02n+fNuRn2FAzH+sD4NbmVoSjoCuQ+NlGI+HSbdJDzfQUtAoWcPv+65LeJF9IK67YerAl1Kc9m0srs0QbEPKFMB2Ef48FS7QN+aJtljz28qObytsxYxwsCVX+3vcZnEiYRZVixqWCA1MBkDePnOIbUysbqoBEKG1urf0h8K72Qtpo1IO20jLUnWUSuGy+WdfVW8pDnUTFn1z+Diex0uvMvlPrgJ74S81tklTMIRaMmqBhMs6hDtAg2EmR6GMV0N8RlPnhDeKxJOHwSM786yWqiLB4BQ82l6UCyr5tizOH0LryImII1Wwx5RQivUlFGf+NwVIcUsOg4eGcXxqOEr55vg5B8P4z2iL3M5SUbg1htA8N4QmxRaamCVkNvXP6hwTdI8CIx2LUZP1OKbohT4FmiMOfNh6TiHsJw4Ke/cgo3oNDvxnadEOGhOezw4LolzB0N9UCMRxYw3nn16KqasB2gJWme0vpkKEmiCi5RoJ93rSfkfjyqjKYgsNaP3qMZm/i6NM/M008HPmG0a7nx6SYTlYK4D7YMzBmaaMgtzDQF0edvL3FCmTFmt6pc6DHhP/UqPSQJHIGzSomOTiRTR5PoXciket3W1z4ZpGUcsCl12cA3MSvcAKor7QGveR+ENUEuvzhew==
diff --git a/ci b/ci
new file mode 160000
index 00000000..e5c45351
--- /dev/null
+++ b/ci
@@ -0,0 +1 @@
+Subproject commit e5c453511fcab2d178f687a5f226efd44f54b7f4
-- 
GitLab