Browse Source

Use docker images in CI

 + This aims to improve duration dramatically, since we don't need to install
 compiler (it is in Docker image)
 + We use this acceleration to test more compiler (test stage) and to test
 install on some distribution if it success
 + Thanks to @RomFouq for the idea and first research
 + This commit is a test, may not work
Leo 8 years ago
parent
commit
c97db2e39c
2 changed files with 92 additions and 18 deletions
  1. 72 9
      .gitlab-ci.yml
  2. 20 9
      gitlab-ci.sh

+ 72 - 9
.gitlab-ci.yml

@@ -1,15 +1,78 @@
-before_script:
-  - apt-get update -qq && apt-get install -y -qq opam ocaml ocaml-native-compilers
-  - opam --version
+stage:
+  # Test with alpine
+  - test
+  # Real distrubutions
+  - real
 
 
-# OCaml version of the ci runner, i.e. from the system
-#ocaml_sys:
-#  script: "./gitlab-ci.sh system"
+# OCaml version 4.00
+ocaml_400:
+  stage: test
+  image: ocaml/opam:alpine_ocaml-4.00.1
+  script: "./gitlab-ci.sh"
+  allow_failure: true
+
+# OCaml version 4.01
+ocaml_401:
+  stage: test
+  image: ocaml/opam:alpine_ocaml-4.01.0
+  script: "./gitlab-ci.sh"
+  allow_failure: true
 
 
 # OCaml version 4.02
 # OCaml version 4.02
 ocaml_402:
 ocaml_402:
-  script: "./gitlab-ci.sh 4.02.3"
+  stage: test
+  image: ocaml/opam:alpine_ocaml-4.02.3
+  script: "./gitlab-ci.sh"
+  allow_failure: false
+
+# OCaml version 4.03
+ocaml_403:
+  stage: test
+  image: ocaml/opam:alpine_ocaml-4.03.0
+  script: "./gitlab-ci.sh"
+  allow_failure: true
 
 
 # OCaml version 4.03
 # OCaml version 4.03
-#ocaml_403:
-#  script: "./gitlab-ci.sh 4.03.0"
+ocaml_403_flambda:
+  stage: test
+  image: ocaml/opam:alpine_ocaml-4.03.0_flambda
+  script: "./gitlab-ci.sh"
+  allow_failure: true
+
+# ---------------
+ubuntu:
+  stage: real
+  image: ocaml/opam:ubuntu
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: false
+
+
+debian:
+  stage: real
+  image: ocaml/opam:debian
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: false
+
+centos:
+  stage: real
+  image: ocaml/opam:centos
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: false
+
+fedora:
+  stage: real
+  image: ocaml/opam:fedora
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: false
+
+opensuse:
+  stage: real
+  image: ocaml/opam:opensuse
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: false
+
+raspbian:
+  stage: real
+  image: ocaml/opam:raspbian
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: false

+ 20 - 9
gitlab-ci.sh

@@ -1,13 +1,14 @@
 #!/bin/sh
 #!/bin/sh
 
 
-# Give OCaml version as first argument
+# OCaml version is assuming to be set (for instance as system compiler) if
+# nothing is passed
 
 
 # Inspired by https://github.com/ocaml/ocaml-ci-scripts
 # Inspired by https://github.com/ocaml/ocaml-ci-scripts
 
 
 # Use -y with evry opam command
 # Use -y with evry opam command
 export OPAMYES=true
 export OPAMYES=true
 # Installing opam
 # Installing opam
-opam init --comp="$1"
+opam init --comp="${1:=system}"
 eval `opam config env`
 eval `opam config env`
 
 
 # Versions
 # Versions
@@ -20,17 +21,27 @@ echo "ocaml -version"
 ocaml -version
 ocaml -version
 echo "============"
 echo "============"
 
 
+echo "= Dependancies ="
 # ocamlfind is mandatory to build
 # ocamlfind is mandatory to build
 opam install ocamlfind
 opam install ocamlfind
-# XXX Manually install development dependancies, not yet supported (ait opam 1.3)
+# XXX Manually install development dependancies, not yet supported (wait opam 1.3)
 opam install alcotest oUnit
 opam install alcotest oUnit
 
 
 # Installing dependancies and testing installation
 # Installing dependancies and testing installation
 opam pin add oclaunch-ci .
 opam pin add oclaunch-ci .
-# Building OcLaunch and running tests
-./configure --enable-tests
-make test
+echo "============"
+
+# Run test if OC_NOTEST is false
+if [ ! ${OC_NOTEST} ]; then
+  # Build OcLaunch only
+  ./configure
+  make
+else
+  # Building OcLaunch and running tests
+  ./configure --enable-tests
+  make test
 
 
-# Test the produced binary
-oclaunch -version
-echo "En" | oclaunch
+  # Test the produced binary
+  oclaunch -version
+  echo "En" | oclaunch
+fi