Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Update travis-ci.yml (#58)
Browse files Browse the repository at this point in the history
* first test... still needs i18n test added

* must build the first stage first

* setup wdio

* derp, add the docker container

* run wdio tests for themes and the de locale

* Fix tests

* clean up
  • Loading branch information
mjhenkes authored Jul 15, 2020
1 parent 6da2b5e commit 0b1e0ca
Show file tree
Hide file tree
Showing 102 changed files with 79 additions and 45 deletions.
86 changes: 48 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: generic
language: node_js
sudo: required
services:
- docker
Expand All @@ -7,59 +7,69 @@ branches:
- main
cache:
directories:
- $HOME/docker
env:
global:
- DOCKER_IMAGE='cerner/terra-application'
- TAG="${TRAVIS_PULL_REQUEST_SHA:=latest}"
- travis-build
before_install:
- sudo chown -R travis:travis $HOME/docker
# Load cached docker images
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
before_cache:
- sudo chown -R travis:travis $HOME/docker
- if [ $TRAVIS_TEST_RESULT == 1 ]; then rm -f $HOME/docker/*.tar.gz; fi
# Clean install on any new build
- npm run clean
jobs:
include:
- stage: build
before_install: true
- stage: lint jest and compile
script:
- sudo chown -R travis:travis $HOME/docker
- 'rm -f $HOME/docker/*.tar.gz'
- travis_wait docker-compose build test-ci
- travis_wait docker-compose --verbose pull standalone-chrome
- >
mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
| xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'
- stage: lint and jest
script:
- "travis_wait docker-compose run -e HAS_JOSH_K_SEAL_OF_APPROVAL=$HAS_JOSH_K_SEAL_OF_APPROVAL -e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST -e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG test-ci sh -c 'npm run lint && npm run jest'"
# clear the cache of any old build artifacts
- rm -rf ./travis-build
- npm run lint
- npm run jest
# These can't be built in parallel because the cache is a single object and you can't add to it in parallel
- npm run compile:prod -- --env.disableAggregateThemes --output-path $TRAVIS_BUILD_DIR/travis-build/default
- npm run compile:prod -- --env.defaultLocale=de --env.disableAggregateThemes --output-path $TRAVIS_BUILD_DIR/travis-build/default-locale
- npm run compile:lowlight -- --output-path $TRAVIS_BUILD_DIR/travis-build/lowlight
- npm run compile:fusion -- --output-path $TRAVIS_BUILD_DIR/travis-build/fusion
# Split out all the wdio runs to not eat up all the travis executors at once.

- stage: wdio
name: default-theme
# Don't clean install
before_install: skip
# Rely on the cache for node_modules.. this won't work for any node modules in the packages dir but works for running wdio
install: skip
script:
# we start up our own standalone chrome instance because the Selenium Docker Service doesn't seem to work here.
- docker-compose up -d standalone-chrome-travis
# using the travis env section to set env variables seems to break cache
- SITE=$TRAVIS_BUILD_DIR/travis-build/default npm run wdio-default
- name: default-locale
before_install: skip
install: skip
script:
- docker-compose up -d standalone-chrome-travis
- SITE=$TRAVIS_BUILD_DIR/travis-build/default-locale LOCALE=de npm run wdio-default
- name: lowlight-theme
before_install: skip
install: skip
script:
- "travis_wait docker-compose run test-ci npm run wdio"
- docker-compose up -d standalone-chrome-travis
- SITE=$TRAVIS_BUILD_DIR/travis-build/lowlight npm run wdio-lowlight
- name: fusion-theme
before_install: skip
install: skip
script:
- docker-compose up -d standalone-chrome-travis
- SITE=$TRAVIS_BUILD_DIR/travis-build/fusion npm run wdio-fusion

- stage: deploy
script: skip
before_deploy:
- sudo chown -R travis:travis $HOME/docker
# Load cached docker images
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
- "travis_wait docker-compose run --volume=$TRAVIS_BUILD_DIR/build:/opt/module/build -e TERRA_DEV_SITE_NEW_RELIC_LICENSE_KEY='c494ac44c8' -e TERRA_DEV_SITE_NEW_RELIC_APPLICATION_ID='141260567' -e TERRA_DEV_SITE_PUBLIC_PATH='/terra-application/' test-ci npm run compile:prod"
# Build again for deployment because we need the Public path to be updated.
- TERRA_DEV_SITE_NEW_RELIC_LICENSE_KEY='c494ac44c8' TERRA_DEV_SITE_NEW_RELIC_APPLICATION_ID='141260567' TERRA_DEV_SITE_PUBLIC_PATH='/terra-application/' npm run compile:prod
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.com dashboard
local_dir: build
local_dir: $TRAVIS_BUILD_DIR/build
on:
branch: main
- stage: clean up cache
before_install: true
script:
- sudo chown -R travis:travis $HOME/docker
- 'rm -f $HOME/docker/*.tar.gz'
stages:
- build
- lint and jest
- lint jest and compile
- wdio
- name: deploy
if: type != pull_request
- clean up cache
14 changes: 9 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ services:
volumes:
- .:/opt/module

test-ci:
build: ./
image: "${DOCKER_IMAGE}-test:${TAG:-latest}"
depends_on:
- standalone-chrome
standalone-chrome-travis:
image: selenium/standalone-chrome:3.14.0-helium
ports:
- 4444:4444
# Necessary due to some issues with chrome in docker. See https://github.com/SeleniumHQ/docker-selenium#running-the-images
volumes:
- '/dev/shm:/dev/shm'
environment:
TZ: 'America/Chicago'
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
"clean:obsolete-snapshots": "npm test -- -u",
"compile": "babel src --out-dir lib --copy-files",
"compile:dev": "webpack",
"compile:prod": "webpack -p",
"compile:prod": "rm -rf ./build; webpack -p",
"compile:lowlight": "rm -rf ./build; THEME=clinical-lowlight-theme webpack -p",
"compile:fusion": "rm -rf ./build; THEME=orion-fusion-theme webpack -p",
"heroku-postbuild": "npm install --only=dev && npm run compile:prod",
"jest": "jest --config jestconfig.js",
"jest:coverage": "jest --coverage --config jestconfig.js",
Expand All @@ -94,7 +96,11 @@
"start-heroku": "tt-serve-static --port $PORT --site './build' ",
"start-static": "npm run compile:prod && tt-serve-static --site ./build",
"test": "npm run lint && npm run jest && npm run wdio",
"wdio": "tt-wdio --config node_modules/terra-toolkit/config/wdio/wdio.conf.js --locales=['en','de']"
"wdio-default": "wdio",
"wdio-locale": "LOCALE=de wdio",
"wdio-lowlight": "THEME=clinical-lowlight-theme wdio",
"wdio-fusion": "THEME=orion-fusion-theme wdio",
"wdio": "npm run wdio-default && npm run wdio-locale && npm run wdio-lowlight && npm run wdio-fusion"
},
"dependencies": {
"classnames": "^2.2.5",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Terra.describeViewports('ApplicationErrorBoundary', ['large'], () => {
describe('Status view management', () => {
before(() => {
browser.url('/raw/tests/terra-application/application-error-boundary/error-boundary-test');
browser.moveToObject('#root', 0, 0);
});

Terra.it.validatesElement('initial', { selector: '#root' });
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Terra.describeViewports('ApplicationLoadingOverlay', ['large'], () => {
describe('Loading overlay management', () => {
before(() => {
browser.url('/raw/tests/terra-application/application-loading-overlay/loading-overlay-test');
browser.moveToObject('#root', 0, 0);
});

Terra.it.validatesElement('initial', { selector: '#root' });
Expand Down
12 changes: 12 additions & 0 deletions wdio.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const defaultWdioConfig = require('terra-toolkit/config/wdio/wdio.conf');

const wdioConfig = defaultWdioConfig.config;

const travis = process.env.TRAVIS;

if (travis) {
wdioConfig.host = 'localhost';
}

exports.config = wdioConfig;

0 comments on commit 0b1e0ca

Please sign in to comment.