diff --git a/.travis.yml b/.travis.yml index 9d7835da..c2a640ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,44 +7,55 @@ python: - "3.7" dist: xenial - -addons: - chrome: stable - sauce_connect: true - -env: - - WR_TEST=no - - WR_TEST=yes - -services: xvfb - -cache: - directories: - - node_modules - sudo: required +before_install: + - ./.travis/beforeInstall.sh + install: - ./.travis/install.sh -before_install: - - 'if [ "$WR_TEST" = "yes" ]; then sudo sysctl kernel.unprivileged_userns_clone=1; fi' - script: - ./.travis/test.sh after_success: - codecov -matrix: +env: + - WR_TEST=no WOMBAT_TEST=no + +jobs: allow_failures: - - env: WR_TEST=yes - - exclude: - - env: WR_TEST=yes - python: "2.7" - - env: WR_TEST=yes - python: "3.5" - - env: WR_TEST=yes + - env: + - WR_TEST=yes WOMBAT_TEST=no + include: + - stage: test + name: "Replay Tests" python: "3.7" + env: + - WR_TEST=yes WOMBAT_TEST=no + addons: + apt: + update: true + sources: + - sourceline: "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" + key_url: https://dl-ssl.google.com/linux/linux_signing_key.pub + packages: + - google-chrome-unstable # this is canary or dev + services: xvfb + - stage: test + name: "Wombat Tests" + language: node_js + node_js: 12.0.0 + env: + - WR_TEST=no WOMBAT_TEST=yes + addons: + apt: + update: true + sources: + - sourceline: "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" + key_url: https://dl-ssl.google.com/linux/linux_signing_key.pub + packages: + - google-chrome-unstable # this is canary or dev + services: xvfb diff --git a/.travis/beforeInstall.sh b/.travis/beforeInstall.sh new file mode 100755 index 00000000..77381625 --- /dev/null +++ b/.travis/beforeInstall.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +if [[ ${WR_TEST} = "yes" || ${WOMBAT_TEST} == "yes" ]]; then + sudo sysctl kernel.unprivileged_userns_clone=1 +fi diff --git a/.travis/install.sh b/.travis/install.sh index a8ea2733..9a582639 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,16 +1,23 @@ #!/bin/bash -set -e +set -ev -pip install --upgrade pip setuptools -python setup.py -q install -pip install -r extra_requirements.txt -pip install coverage pytest-cov coveralls -pip install codecov -npm install +if [[ ${WOMBAT_TEST} = "no" ]]; then + pip install --upgrade pip setuptools + python setup.py -q install + pip install -r extra_requirements.txt + pip install coverage pytest-cov coveralls + pip install codecov -if [ "$WR_TEST" = "yes" ]; then - git clone https://github.com/webrecorder/webrecorder-tests.git - cd webrecorder-tests - pip install --upgrade -r requirements.txt - ./bootstrap.sh + if [[ ${WR_TEST} = "yes" ]]; then + git clone https://github.com/webrecorder/webrecorder-tests.git + cd webrecorder-tests + pip install --upgrade -r requirements.txt + ./bootstrap.sh + cd .. + fi +else + cd wombat + ./boostrap.sh + cd .. fi + diff --git a/.travis/test.sh b/.travis/test.sh index a5ec1472..58193f78 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -1,10 +1,14 @@ #!/bin/bash -set -e +set -ev -if [ "$WR_TEST" = "no" ]; then +if [[ ${WR_TEST} = "no" && ${WOMBAT_TEST} = "no" ]]; then python setup.py test - cd karma-tests && make test && cd .. -else +elif [[ ${WR_TEST} = "yes" && ${WOMBAT_TEST} = "no" ]]; then cd webrecorder-tests INTRAVIS=1 pytest -m "pywbtest and chrometest" + cd .. +elif [[ ${WR_TEST} = "no" && ${WOMBAT_TEST} = "yes" ]]; then + cd wombat + yarn run test + cd .. fi diff --git a/Dockerfile b/Dockerfile index 31729d6e..d0e010cc 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,25 @@ ARG PYTHON=python:3.7.2 +FROM node:11.11.0 as wombat -FROM $PYTHON +COPY ./wombat ./buildWombat +WORKDIR buildWombat +RUN yarn install && yarn run build-prod + +FROM $PYTHON as pywb WORKDIR /pywb COPY requirements.txt extra_requirements.txt ./ - RUN pip install --no-cache-dir -r requirements.txt -r extra_requirements.txt COPY . ./ +COPY --from=wombat /pywb/static/*.js ./pywb/static/ RUN python setup.py install \ && mv ./docker-entrypoint.sh / \ && mkdir /uwsgi && mv ./uwsgi.ini /uwsgi/ \ - && mkdir /webarchive && mv ./config.yaml /webarchive/ + && mkdir /webarchive && mv ./config.yaml /webarchive/ \ + && rm -rf ./wombat WORKDIR /webarchive diff --git a/karma-tests/Makefile b/karma-tests/Makefile deleted file mode 100644 index bb80eeec..00000000 --- a/karma-tests/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -NODE_BIN_DIR=../node_modules/.bin - -test: - $(NODE_BIN_DIR)/karma start --single-run diff --git a/karma-tests/dummy.html b/karma-tests/dummy.html deleted file mode 100644 index 52e695fa..00000000 --- a/karma-tests/dummy.html +++ /dev/null @@ -1,9 +0,0 @@ - -
- - - - diff --git a/karma-tests/karma.conf.js b/karma-tests/karma.conf.js deleted file mode 100644 index 294c1b48..00000000 --- a/karma-tests/karma.conf.js +++ /dev/null @@ -1,108 +0,0 @@ -var sauceLabsConfig = { - testName: 'pywb Client Tests', -}; - -// see https://github.com/karma-runner/karma-sauce-launcher/issues/73 -if (process.env.TRAVIS_JOB_NUMBER) { - sauceLabsConfig.startConnect = false; - sauceLabsConfig.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER; -} - -var WOMBAT_JS_PATH = 'pywb/static/wombat.js'; - -var sauceLaunchers = { - sl_chrome: { - base: 'SauceLabs', - browserName: 'chrome', - }, - - sl_firefox: { - base: 'SauceLabs', - browserName: 'firefox', - }, - - sl_safari: { - base: 'SauceLabs', - browserName: 'safari', - platform: 'OS X 10.11', - version: '9.0', - }, - - sl_edge: { - base: 'SauceLabs', - browserName: 'MicrosoftEdge', - }, -}; - -var localLaunchers = { - localFirefox: { - base: 'Firefox', - }, -}; - -var customLaunchers = {}; - -if (process.env['SAUCE_USERNAME'] && process.env['SAUCE_ACCESS_KEY']) { - customLaunchers = sauceLaunchers; -} else { - console.error('Sauce Labs account details not set, ' + - 'Karma tests will be run only against local browsers.' + - 'Set SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables to ' + - 'run tests against Sauce Labs browsers'); - customLaunchers = localLaunchers; -} - -module.exports = function(config) { - config.set({ - basePath: '../', - - frameworks: ['mocha', 'chai'], - - files: [ - { - pattern: WOMBAT_JS_PATH, - watched: true, - included: false, - served: true, - }, - { - pattern: 'karma-tests/dummy.html', - included: false, - served: true, - }, - 'karma-tests/*.spec.js', - ], - - preprocessors: {}, - - reporters: ['progress'], - - port: 9876, - - colors: true, - - logLevel: config.LOG_INFO, - - autoWatch: true, - - sauceLabs: sauceLabsConfig, - - // Set extended timeouts to account for the slowness - // in connecting to remote browsers (eg. when using - // Sauce Labs) - // - // See https://oligofren.wordpress.com/2014/05/27/running-karma-tests-on-browserstack/ - captureTimeout: 3 * 60000, - browserNoActivityTimeout: 30 * 1000, - browserDisconnectTimeout: 10 * 1000, - browserDisconnectTolerance: 1, - - customLaunchers: customLaunchers, - - browsers: Object.keys(customLaunchers), - - singleRun: false, - - concurrency: Infinity - }) -}; diff --git a/karma-tests/wombat.spec.js b/karma-tests/wombat.spec.js deleted file mode 100644 index 4204389f..00000000 --- a/karma-tests/wombat.spec.js +++ /dev/null @@ -1,225 +0,0 @@ -var DEFAULT_TIMEOUT = 20000; - -// creates a new document in an