From 84e5d431e8e75a4b19ca083e5d82f90a6e7b4197 Mon Sep 17 00:00:00 2001
From: Maxim Khlobystov <maxim.khlobystov@gmail.com>
Date: Mon, 19 Nov 2018 18:32:15 -0500
Subject: [PATCH] Split the build into stages

---
 .travis.yml     | 17 ++++++++++++++++-
 build_script.sh | 38 +++++++++++++++++++++-----------------
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 12a35f6bf6..625ed375d0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,9 +2,24 @@ dist: trusty
 
 language: node_js
 
+env:
+  - JOB_TYPE=linter
+  - JOB_TYPE=acceptance_tests
+
 node_js:
 - "8"
 
+jobs:
+  allow_failures:
+  - env: JOB_TYPE=linter
+  include:
+  - stage: "Linter"
+    name: "ESLint"
+    env: JOB_TYPE=linter
+  - stage: "Tests"
+    name: "Acceptance Tests"
+    env: JOB_TYPE=acceptance_tests
+
 if: type = pull_request
 
 env:
@@ -12,7 +27,7 @@ env:
     - BBB_SERVER_URL=http://localhost/bigbluebutton/api
 
 script:
-  - travis_wait bash ./build_script.sh
+  - travis_wait bash ./build_script.sh $JOB_TYPE
 
 after_script:
   - docker stop $docker
diff --git a/build_script.sh b/build_script.sh
index 445a2adbed..42265a3dba 100755
--- a/build_script.sh
+++ b/build_script.sh
@@ -3,27 +3,31 @@ set -ev
 
 files=`git diff --name-only HEAD..$TRAVIS_BRANCH`
 if [[ $files = *"bigbluebutton-html5"* ]]; then
-  {
-    cd bigbluebutton-html5
-    git clone --single-branch -b update-html5 https://github.com/bigbluebutton/docker.git
-    cp -r docker/{mod,restart.sh,setup.sh,supervisord.conf} .
-    cp -r docker/Dockerfile Dockerfile.test
-    docker build -t b2 -f Dockerfile.test .
-    docker=$(docker run -d -p 80:80/tcp -p 443:443/tcp -p 1935:1935 -p 5066:5066 -p 3478:3478 -p 3478:3478/udp b2 -h localhost)
-    echo $docker
+  cd bigbluebutton-html5
+  curl https://install.meteor.com/ | sh
+  meteor npm install
+  if [ $1 = linter ]
+  then
+    cd ..
+    bigbluebutton-html5/node_modules/.bin/eslint --ext .jsx,.js $files
+  elif [ $1 = acceptance_tests ]
+  then
+    {
+      git clone --single-branch -b update-html5 https://github.com/bigbluebutton/docker.git
+      cp -r docker/{mod,restart.sh,setup.sh,supervisord.conf} .
+      cp -r docker/Dockerfile Dockerfile.test
+      docker build -t b2 -f Dockerfile.test .
+      docker=$(docker run -d -p 80:80/tcp -p 443:443/tcp -p 1935:1935 -p 5066:5066 -p 3478:3478 -p 3478:3478/udp b2 -h localhost)
+      echo $docker
+    } > /dev/null
+
     cd tests/puppeteer
     npm install
     conf=$(docker exec $(docker ps -q) bbb-conf --secret | grep "Secret:")
     secret=$(echo $conf | cut -d' ' -f2)
     export BBB_SHARED_SECRET=$secret
-    node html5-check.js
 
-    cd ../..
-    curl https://install.meteor.com/ | sh
-    meteor npm install
-    cd tests/puppeteer
-    npm install
-    cd ../../..
-  } > /dev/null
-  bigbluebutton-html5/node_modules/.bin/eslint --ext .jsx,.js $files
+    node html5-check.js
+    npm test
+  fi
 fi
-- 
GitLab