Parcourir la source

Merge branch 'improve_ci_with_docker' into newrc-format

Pull improvement of CI, same reasons as commit
7fc5e0eb0cc94695d9b1f1fddbd9d353d806f772
Leo il y a 8 ans
Parent
commit
b90aaffea6
3 fichiers modifiés avec 111 ajouts et 19 suppressions
  1. 88 9
      .gitlab-ci.yml
  2. 2 1
      CHANGELOG.md
  3. 21 9
      gitlab-ci.sh

+ 88 - 9
.gitlab-ci.yml

@@ -1,15 +1,94 @@
-before_script:
-  - apt-get update -qq && apt-get install -y -qq opam ocaml ocaml-native-compilers
-  - opam --version
+stages:
+  # Test with alpine
+  - test
+  # Test with alpine, other version of the compiler
+  - other_version
+  # 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:
+  before_script:
+    - sudo apk update && sudo apk add m4
+  stage: other_version
+  image: ocaml/opam:alpine_ocaml-4.00.1
+  script: "./gitlab-ci.sh"
+  allow_failure: true
+
+# OCaml version 4.01
+ocaml_401:
+  before_script:
+    - sudo apk update && sudo apk add m4
+  stage: other_version
+  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"
+  before_script:
+    - sudo apk update && sudo apk add m4
+  stage: test
+  image: ocaml/opam:alpine_ocaml-4.02.3
+  script: "./gitlab-ci.sh"
+  allow_failure: false
 
 
 # OCaml version 4.03
 # OCaml version 4.03
-#ocaml_403:
-#  script: "./gitlab-ci.sh 4.03.0"
+ocaml_403:
+  before_script:
+    - sudo apk update && sudo apk add m4
+  stage: other_version
+  image: ocaml/opam:alpine_ocaml-4.03.0
+  script: "./gitlab-ci.sh"
+  allow_failure: true
+
+# OCaml version 4.03, with flambda optimisation
+ocaml_403_flambda:
+  before_script:
+    - sudo apk update && sudo apk add m4
+  stage: other_version
+  image: ocaml/opam:alpine_ocaml-4.03.0_flambda
+  script: "./gitlab-ci.sh"
+  allow_failure: true
+
+# ---------------
+ubuntu:
+  before_script:
+    - sudo apt-get update && sudo apt-get install -y m4
+  stage: real
+  image: ocaml/opam:ubuntu
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: false
+
+
+debian:
+  before_script:
+    - sudo apt-get update && sudo apt-get install -y m4
+  stage: real
+  image: ocaml/opam:debian
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: true
+
+centos:
+  before_script:
+    - sudo yum install -y m4
+  stage: real
+  image: ocaml/opam:centos
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: true
+
+fedora:
+  before_script:
+    - sudo dnf install -y m4
+  stage: real
+  image: ocaml/opam:fedora
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: true
+
+opensuse:
+  before_script:
+    - sudo zypper --non-interactive up && sudo zypper --non-interactive in m4
+  stage: real
+  image: ocaml/opam:opensuse
+  script: "export OC_NOTEST=true; ./gitlab-ci.sh system"
+  allow_failure: true

+ 2 - 1
CHANGELOG.md

@@ -77,7 +77,8 @@ This version introduce major changes in the tmp and rc file.
    release source-code, binaries, signing, run test…). Stripped (and thus smaller)
    release source-code, binaries, signing, run test…). Stripped (and thus smaller)
    binaries are being tested too. Add *indentation script* too.
    binaries are being tested too. Add *indentation script* too.
  + Improve README.md file, using special code in \_oasis Description field.
  + Improve README.md file, using special code in \_oasis Description field.
- + Using Gitlab CI to build with several versions of the compiler.
+ + Using Gitlab CI to build with several versions of the compiler (fasten with
+   Docker).
 
 
 ## 0.2.x
 ## 0.2.x
 
 

+ 21 - 9
gitlab-ci.sh

@@ -1,13 +1,15 @@
 #!/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"
+comp=${1:-system}
+opam init --comp="${comp}"
 eval `opam config env`
 eval `opam config env`
 
 
 # Versions
 # Versions
@@ -20,17 +22,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