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

exif-summary
Romain 7 years ago
parent 9a2da3e5ea
commit 208f0f0212

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

@ -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 .

@ -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

@ -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",

@ -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"

@ -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

@ -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
Loading…
Cancel
Save