From 3f4d4c7e42a95412c0492d29db116dd96eb7d56e Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Wed, 6 Mar 2019 15:25:35 -0500 Subject: [PATCH 1/4] refactor: split apart the lint and unit test portions of the Travis build + add caching support --- .travis.yml | 81 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51e6883e8d..49be59ed01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,36 +25,61 @@ stages: jobs: include: - stage: Prep - name: 'Smoke Tests: Install, Lint, Unit' - before_script: - - phpenv config-rm xdebug.ini - - composer global require hirak/prestissimo - - yarn run setup:quick - - ./scripts/check-run-queue.js 'Lint' - - ./scripts/check-run-queue.js 'Unit' - script: - - ./test/lint.js - - ./test/unit.js + name: 'Smoke Tests: Linting' + install: yarn run setup:quick + before_script: ./scripts/check-run-queue.js 'Lint' + script: yarn run lint + after_success: ./scripts/check-run-success.js 'Lint' + after_failure: ./scripts/check-run-failure.js 'Lint' + cache: + yarn: true + directories: + - node_modules + - docs-site/vendor + - packages/core-php/vendor + - packages/twig-renderer/vendor + - packages/drupal-twig-extensions/vendor + + - stage: Prep + name: 'Smoke Tests: Unit Tests (Jest)' + install: yarn run setup:quick + before_script: ./scripts/check-run-queue.js 'Unit' + script: yarn run test + after_success: ./scripts/check-run-success.js 'Unit' + after_failure: ./scripts/check-run-failure.js 'Unit' + cache: + yarn: true + directories: + - node_modules + - docs-site/vendor + - packages/core-php/vendor + - packages/twig-renderer/vendor + - packages/drupal-twig-extensions/vendor - stage: Prep name: 'Build + Deploy' - script: - # Clear incache file on normal Travis builds - - find . -name '.incache' -exec rm -rf {} + - - yarn run setup - - yarn run build - - yarn run deploy + before_install: find . -name '.incache' -exec rm -rf {} + # Clear incache file on normal Travis builds + install: yarn run setup + script: yarn run build + deploy: yarn run deploy + after_deploy: # need to reset git repo before `update-read-only-git-repos.sh` - cd "`git rev-parse --show-toplevel`" && git clean -fd && git reset --hard HEAD && cd - - ./scripts/release/update-read-only-git-repos.sh + cache: + yarn: true + directories: + - node_modules + - docs-site/vendor + - packages/core-php/vendor + - packages/twig-renderer/vendor + - packages/drupal-twig-extensions/vendor - stage: Test Live Site name: 'Nightwatch End-to-End' - # addons: - # sauce_connect: true + install: yarn run setup + before_script: ./scripts/check-run-in-progress.js 'Nightwatch' script: - - yarn run setup - - ./scripts/check-run-in-progress.js 'Nightwatch' - export NOW_URL=$(./scripts/get-latest-deploy.js) - echo "The Now URL is $NOW_URL" - time curl -sSf "$NOW_URL" > /dev/null # warming up site @@ -64,12 +89,20 @@ jobs: after_success: - ./scripts/deploy-branch-alias.js - ./scripts/deploy-tagged-release.js + cache: + yarn: true + directories: + - node_modules + - docs-site/vendor + - packages/core-php/vendor + - packages/twig-renderer/vendor + - packages/drupal-twig-extensions/vendor - stage: Test Live Site name: 'Ensure site is live' + install: yarn run setup + before_script: ./scripts/check-run-in-progress.js 'Site is live' script: - - yarn run setup - - ./scripts/check-run-in-progress.js 'Site is live' - export NOW_URL=$(./scripts/get-latest-deploy.js) - echo "Testing Now URL \"$NOW_URL\" to see if it is alive." - time curl -sSf "$NOW_URL" > /dev/null @@ -81,6 +114,10 @@ jobs: yarn: true directories: - node_modules + - docs-site/vendor + - packages/core-php/vendor + - packages/twig-renderer/vendor + - packages/drupal-twig-extensions/vendor - stage: Test Live Site name: 'Example master only job' From eeb0341de144d6abcfffc2d630840b6094c799e3 Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Wed, 6 Mar 2019 15:26:14 -0500 Subject: [PATCH 2/4] refactor: remove old test files no longer being used in lieu of npm scripts --- test/lint.js | 16 ---------------- test/unit.js | 16 ---------------- 2 files changed, 32 deletions(-) delete mode 100755 test/lint.js delete mode 100755 test/unit.js diff --git a/test/lint.js b/test/lint.js deleted file mode 100755 index 0e3991b2ff..0000000000 --- a/test/lint.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node -const { outputBanner } = require('ci-utils'); -const { execAndReport } = require('../scripts/check-run'); - -execAndReport({ - cmd: 'yarn lint', - name: 'Lint', -}) - .then(results => { - outputBanner('Lint: done'); - }) - .catch(err => { - outputBanner('Lint: error'); - // console.log(err); - process.exit(1); - }); diff --git a/test/unit.js b/test/unit.js deleted file mode 100755 index bd36986148..0000000000 --- a/test/unit.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node -const { outputBanner } = require('ci-utils'); -const { execAndReport } = require('../scripts/check-run'); - -execAndReport({ - cmd: 'yarn test', - name: 'Unit', -}) - .then(results => { - outputBanner('Unit: done'); - }) - .catch(err => { - outputBanner('Unit: error'); - // console.log(err); - process.exit(1); - }); From 99bc204bff8cdfdc8eba4ee31fa664786d780750 Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Wed, 6 Mar 2019 15:42:33 -0500 Subject: [PATCH 3/4] fix: update travis config --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 49be59ed01..ed9be179f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,9 +60,9 @@ jobs: name: 'Build + Deploy' before_install: find . -name '.incache' -exec rm -rf {} + # Clear incache file on normal Travis builds install: yarn run setup - script: yarn run build - deploy: yarn run deploy - after_deploy: + script: + - yarn run build + - yarn run deploy # need to reset git repo before `update-read-only-git-repos.sh` - cd "`git rev-parse --show-toplevel`" && git clean -fd && git reset --hard HEAD && cd - - ./scripts/release/update-read-only-git-repos.sh From 8275947efc9ecdabbc6bf88a122d52308c22ad11 Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Wed, 6 Mar 2019 16:04:27 -0500 Subject: [PATCH 4/4] fix: re-test with updated travis config --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ed9be179f8..f3c0e6f68a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,9 +58,10 @@ jobs: - stage: Prep name: 'Build + Deploy' - before_install: find . -name '.incache' -exec rm -rf {} + # Clear incache file on normal Travis builds - install: yarn run setup - script: + script: + # Clear incache file on normal Travis builds + - find . -name '.incache' -exec rm -rf {} + + - yarn run setup - yarn run build - yarn run deploy # need to reset git repo before `update-read-only-git-repos.sh`