From f9c39ba136a89671cad21bfd6d8a2e22284e25e7 Mon Sep 17 00:00:00 2001
From: Ralf Jung <jung@mpi-sws.org>
Date: Thu, 15 Feb 2018 14:48:51 +0100
Subject: [PATCH] update CI

---
 .gitlab-ci.yml   | 37 ++++++++++++++++---------------------
 Makefile         |  2 +-
 build/opam-ci.sh |  1 +
 3 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 034bce5d..a52acb53 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,15 +2,14 @@ image: ralfjung/opam-ci:latest
 
 stages:
   - build
-  - deploy
 
 variables:
-  CPU_CORES: "9"
+  CPU_CORES: "10"
 
 .template: &template
   stage: build
   tags:
-  - fp-timing
+  - fp
   script:
   # prepare
   - . build/opam-ci.sh $OPAM_PINS
@@ -19,6 +18,10 @@ variables:
   - '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 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'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -26,40 +29,32 @@ variables:
   only:
   - master
   - /^ci/
-
-opam:
-  stage: deploy
-  script:
-  # Send a trigger to the repository doing the work
-  - 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
-  variables:
-    OPAM_PKG: "coq-lambda-rust"
-  only:
-  - master
   except:
   - triggers
 
+## Build jobs
+
 build-coq.8.7.1:
   <<: *template
   variables:
     OPAM_PINS: "coq version 8.7.1   coq-mathcomp-ssreflect version 1.6.4"
-  except:
-  - triggers
+    OPAM_PKG: "coq-lambda-rust"
+  tags:
+  - fp-timing
+  artifacts:
+    paths:
+    - build-time.txt
+    - build-env.txt
 
 build-coq.8.6.1:
   <<: *template
   variables:
     OPAM_PINS: "coq version 8.6.1   coq-mathcomp-ssreflect version 1.6.4"
-  artifacts:
-    paths:
-    - build-time.txt
-    - build-env.txt
-  except:
-  - triggers
 
 build-iris.dev:
   <<: *template
   variables:
     OPAM_PINS: "coq version 8.7.1   coq-mathcomp-ssreflect version 1.6.4   coq-iris.dev git https://gitlab.mpi-sws.org/FP/iris-coq.git#$IRIS_REV"
+  except:
   only:
   - triggers
diff --git a/Makefile b/Makefile
index 4e678172..2aa31aa0 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ clean: Makefile.coq
 # Create Coq Makefile. POSIX awk can't do in-place editing, but coq_makefile wants the real
 # filename, so we do some file gymnastics.
 Makefile.coq: _CoqProject Makefile awk.Makefile
-	coq_makefile -f _CoqProject -o Makefile.coq
+	"$(COQBIN)coq_makefile" -f _CoqProject -o Makefile.coq
 	mv Makefile.coq Makefile.coq.tmp && awk -f awk.Makefile Makefile.coq.tmp > Makefile.coq && rm Makefile.coq.tmp
 
 # Install build-dependencies
diff --git a/build/opam-ci.sh b/build/opam-ci.sh
index b6925ba5..bc51df87 100755
--- a/build/opam-ci.sh
+++ b/build/opam-ci.sh
@@ -63,5 +63,6 @@ echo "[opam-ci] Installing build-dependencies"
 make build-dep OPAMFLAGS=-y
 
 # done
+set +x
 echo
 coqc -v
-- 
GitLab