2
0
mirror of https://github.com/thumbsup/thumbsup synced 2024-11-05 12:01:04 +00:00

Run full integration tests inside Docker. Travis runs unit + integration.

This commit is contained in:
Romain 2017-11-25 22:01:30 +11:00
parent 9a2da3e5ea
commit 208f0f0212
7 changed files with 33 additions and 33 deletions

View File

@ -1 +1,2 @@
node_modules
test-integration/output-actual

View File

@ -1,5 +1,19 @@
# Run unit tests on several versions of Node
language: node_js
node_js:
- '6'
- '8'
script: scripts/cibuild
# Also require docker for the integration tests
sudo: required
services:
- docker
jobs:
include:
# After unit tests pass on all version of Node
# run the integration tests
- stage: Integration tests
script:
- docker pull thumbsupgallery/build:alpine
- docker build .

View File

@ -1,13 +1,10 @@
# Node.js runtime
FROM node:8-alpine
# Node.js + build depdencies + runtime dependencies
FROM thumbsupgallery/build:alpine
# Cache all the binary dependencies first
RUN apk add --update ffmpeg graphicsmagick exiftool
# Install and cache dependencies
COPY package.json /app
RUN npm install
# Install thumbsup globally
ARG THUMBSUP_VERSION=2.x.x
RUN npm install -g thumbsup@${THUMBSUP_VERSION}
# Default command is thumbsup itself, so we can run
# > docker run thumbsupgallery/thumbsup --input [...] --output [...]
CMD ["thumbsup"]
# Run the tests
COPY . /app
RUN scripts/cibuild

View File

@ -18,12 +18,13 @@
"type": "git",
"url": "https://github.com/thumbsup/thumbsup.git"
},
"main": "bin/thumbsup.js",
"bin": {
"thumbsup": "./bin/thumbsup.js"
},
"scripts": {
"test": "./scripts/cibuild",
"test-only": "mocha"
"pkglint": "require-lint --ignore-extra lightgallery --ignore-extra video.js",
"test": "standard && npm run pkglint && mocha"
},
"dependencies": {
"async": "^2.5.0",

View File

@ -3,27 +3,14 @@
# Fail the build on any error
set -eou pipefail
# Make sure binary package.json dependencies are available
PATH=$(pwd)/node_modules/.bin:$PATH
echo "--- Check all dependencies in package.json"
require-lint --src bin/thumbsup.js --ignore-extra lightgallery --ignore-extra video.js
echo "--- Static code analysis"
standard
echo "--- Run unit tests"
npm test
echo "--- Verify lightgallery dependency is built in"
grep \"lightgallery\" package.json 1>/dev/null
echo "--- Run unit tests"
mocha
echo "--- Update CLI arguments in README"
./scripts/readme
# TODO: add all dependencies like <ffmpeg> if we want this to run on Travis CI
# echo "--- Running integration tests"
# ./test-integration/test.sh
echo "--- Comparing gallery snapshot"
./test-integration/test
echo "================"
echo "Build successful"

View File

@ -12,4 +12,4 @@ function finish {
rm -rf output-expected
# run thumbsup
thumbsup --config config.json --output output-expected
node ../bin/thumbsup.js --config config.json --output output-expected

View File

@ -12,7 +12,7 @@ function finish {
rm -rf output-actual
# run thumbsup
thumbsup --config config.json --output output-actual
node ../bin/thumbsup.js --config config.json --output output-actual
# compare albums with the snapshot
for expected in output-expected/*.html; do