From ab468b5346bcad41ec5cf7ccd9033c6f50dd123e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 11:21:19 +0000 Subject: [PATCH 1/7] Refactor travis-ci to use parallel jobs --- .travis.yml | 21 +++++++++++++++++-- scripts/{travis.sh => travis/install-deps.sh} | 6 ------ .../travis/test-riot.sh | 0 3 files changed, 19 insertions(+), 8 deletions(-) rename scripts/{travis.sh => travis/install-deps.sh} (58%) rename .travis-test-riot.sh => scripts/travis/test-riot.sh (100%) diff --git a/.travis.yml b/.travis.yml index 0def6d50f75..b52e18fbf18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,24 @@ addons: chrome: stable install: - npm install -# install synapse prerequisites for end to end tests - - sudo apt-get install build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev + - ./scripts/travis/install-deps.sh script: ./scripts/travis.sh + +matrix: + include: + - name: Linting Checks + script: + # run the linter, but exclude any files known to have errors or warnings. + - npm run lintwithexclusions + - name: End-to-End Tests + install: + - npm install + - ./scripts/travis/install-deps.sh + - sudo apt-get install build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev + script: + - ./scripts/travis/test-riot.sh + - name: Unit Tests + script: + - npm run test + diff --git a/scripts/travis.sh b/scripts/travis/install-deps.sh similarity index 58% rename from scripts/travis.sh rename to scripts/travis/install-deps.sh index 48410ea9043..5acc801af8c 100755 --- a/scripts/travis.sh +++ b/scripts/travis/install-deps.sh @@ -9,9 +9,3 @@ ln -s ../matrix-js-sdk node_modules/matrix-js-sdk cd matrix-js-sdk npm install cd .. - -npm run test -./.travis-test-riot.sh - -# run the linter, but exclude any files known to have errors or warnings. -npm run lintwithexclusions diff --git a/.travis-test-riot.sh b/scripts/travis/test-riot.sh similarity index 100% rename from .travis-test-riot.sh rename to scripts/travis/test-riot.sh From 025733244f49363acb8632aaf19203fe3e3d1d16 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 11:47:49 +0000 Subject: [PATCH 2/7] Remove default script that is never called --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b52e18fbf18..b51f102cbf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,6 @@ addons: install: - npm install - ./scripts/travis/install-deps.sh -script: - ./scripts/travis.sh matrix: include: From f9ecdcb480badc21facbea17bc0f71ed216fcdda Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 11:48:11 +0000 Subject: [PATCH 3/7] Add npm cache --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b51f102cbf5..2cb3f4a9ad0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,8 @@ install: - npm install - ./scripts/travis/install-deps.sh +cache: npm + matrix: include: - name: Linting Checks From ba5e3f86cb057c4f8cfe90e9ef5f2b0777e5fba7 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Jan 2019 11:58:21 +0000 Subject: [PATCH 4/7] Revert "Add npm cache" This reverts commit f9ecdcb480badc21facbea17bc0f71ed216fcdda. Travis is unhappy about adding an NPM cache as it can't find matrix-js-sdk for some reason --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2cb3f4a9ad0..b51f102cbf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,6 @@ install: - npm install - ./scripts/travis/install-deps.sh -cache: npm - matrix: include: - name: Linting Checks From 5ce08523f82153b1429d71899e8f8c9f09bf351e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 9 Jan 2019 14:21:45 +0100 Subject: [PATCH 5/7] split up script for unit and end-to-end tests so unit tests are not run as part of e2e tests --- .travis.yml | 9 ++------- scripts/travis/{test-riot.sh => build.sh} | 14 ------------- scripts/travis/end-to-end-tests.sh | 24 +++++++++++++++++++++++ scripts/travis/unit-tests.sh | 10 ++++++++++ 4 files changed, 36 insertions(+), 21 deletions(-) rename scripts/travis/{test-riot.sh => build.sh} (61%) mode change 100755 => 100644 create mode 100755 scripts/travis/end-to-end-tests.sh create mode 100644 scripts/travis/unit-tests.sh diff --git a/.travis.yml b/.travis.yml index b51f102cbf5..2c414e7c595 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,7 @@ node_js: addons: chrome: stable install: - - npm install - ./scripts/travis/install-deps.sh - matrix: include: - name: Linting Checks @@ -25,12 +23,9 @@ matrix: - npm run lintwithexclusions - name: End-to-End Tests install: - - npm install - - ./scripts/travis/install-deps.sh - sudo apt-get install build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev script: - - ./scripts/travis/test-riot.sh + - ./scripts/travis/end-to-end-tests.sh - name: Unit Tests script: - - npm run test - + - ./scripts/travis/unit-tests.sh diff --git a/scripts/travis/test-riot.sh b/scripts/travis/build.sh old mode 100755 new mode 100644 similarity index 61% rename from scripts/travis/test-riot.sh rename to scripts/travis/build.sh index d1c2804b2af..a353e38a069 --- a/scripts/travis/test-riot.sh +++ b/scripts/travis/build.sh @@ -24,18 +24,4 @@ rm -r node_modules/matrix-react-sdk ln -s "$REACT_SDK_DIR" node_modules/matrix-react-sdk npm run build -npm run test popd - -if [ "$TRAVIS_BRANCH" = "develop" ] -then - # run end to end tests - scripts/fetchdep.sh matrix-org matrix-react-end-to-end-tests master - pushd matrix-react-end-to-end-tests - ln -s $REACT_SDK_DIR/$RIOT_WEB_DIR riot/riot-web - # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh - # CHROME_PATH=$(which google-chrome-stable) ./run.sh - ./install.sh - ./run.sh --travis - popd -fi diff --git a/scripts/travis/end-to-end-tests.sh b/scripts/travis/end-to-end-tests.sh new file mode 100755 index 00000000000..285458bd4bf --- /dev/null +++ b/scripts/travis/end-to-end-tests.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# script which is run by the travis build (after `npm run test`). +# +# clones riot-web develop and runs the tests against our version of react-sdk. + +set -ev + +RIOT_WEB_DIR=riot-web +REACT_SDK_DIR=`pwd` + +if [ "$TRAVIS_BRANCH" = "develop" ] +then + scripts/travis/build.sh + # run end to end tests + scripts/fetchdep.sh matrix-org matrix-react-end-to-end-tests master + pushd matrix-react-end-to-end-tests + ln -s $REACT_SDK_DIR/$RIOT_WEB_DIR riot/riot-web + # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh + # CHROME_PATH=$(which google-chrome-stable) ./run.sh + ./install.sh + ./run.sh --travis + popd +fi diff --git a/scripts/travis/unit-tests.sh b/scripts/travis/unit-tests.sh new file mode 100644 index 00000000000..a8e0a63b315 --- /dev/null +++ b/scripts/travis/unit-tests.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# +# script which is run by the travis build (after `npm run test`). +# +# clones riot-web develop and runs the tests against our version of react-sdk. + +set -ev + +scripts/travis/build.sh +npm run test From 481cd292adb292894d62aa6adee52cb42117cefd Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 9 Jan 2019 14:36:32 +0100 Subject: [PATCH 6/7] make e2e tests job conditional at travis.yml level --- .travis.yml | 1 + scripts/travis/end-to-end-tests.sh | 23 ++++++++++------------- scripts/travis/install-deps.sh | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c414e7c595..bfc4d265a4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ matrix: # run the linter, but exclude any files known to have errors or warnings. - npm run lintwithexclusions - name: End-to-End Tests + if: branch = develop install: - sudo apt-get install build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libjpeg-dev libxslt1-dev script: diff --git a/scripts/travis/end-to-end-tests.sh b/scripts/travis/end-to-end-tests.sh index 285458bd4bf..361b053d2b2 100755 --- a/scripts/travis/end-to-end-tests.sh +++ b/scripts/travis/end-to-end-tests.sh @@ -9,16 +9,13 @@ set -ev RIOT_WEB_DIR=riot-web REACT_SDK_DIR=`pwd` -if [ "$TRAVIS_BRANCH" = "develop" ] -then - scripts/travis/build.sh - # run end to end tests - scripts/fetchdep.sh matrix-org matrix-react-end-to-end-tests master - pushd matrix-react-end-to-end-tests - ln -s $REACT_SDK_DIR/$RIOT_WEB_DIR riot/riot-web - # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh - # CHROME_PATH=$(which google-chrome-stable) ./run.sh - ./install.sh - ./run.sh --travis - popd -fi +scripts/travis/build.sh +# run end to end tests +scripts/fetchdep.sh matrix-org matrix-react-end-to-end-tests master +pushd matrix-react-end-to-end-tests +ln -s $REACT_SDK_DIR/$RIOT_WEB_DIR riot/riot-web +# PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh +# CHROME_PATH=$(which google-chrome-stable) ./run.sh +./install.sh +./run.sh --travis +popd diff --git a/scripts/travis/install-deps.sh b/scripts/travis/install-deps.sh index 5acc801af8c..04cd728157e 100755 --- a/scripts/travis/install-deps.sh +++ b/scripts/travis/install-deps.sh @@ -1,7 +1,7 @@ #!/bin/sh set -ex - +npm install scripts/fetchdep.sh matrix-org matrix-js-sdk rm -r node_modules/matrix-js-sdk || true ln -s ../matrix-js-sdk node_modules/matrix-js-sdk From 419726f4231704b8cc976e177937baedf80c2b01 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 9 Jan 2019 14:43:05 +0100 Subject: [PATCH 7/7] set executable perms --- scripts/travis/build.sh | 0 scripts/travis/unit-tests.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/travis/build.sh mode change 100644 => 100755 scripts/travis/unit-tests.sh diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh old mode 100644 new mode 100755 diff --git a/scripts/travis/unit-tests.sh b/scripts/travis/unit-tests.sh old mode 100644 new mode 100755