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 node_modules
test-integration/output-actual

@ -1,5 +1,19 @@
# Run unit tests on several versions of Node
language: node_js language: node_js
node_js: node_js:
- '6' - '6'
- '8' - '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 # Node.js + build depdencies + runtime dependencies
FROM node:8-alpine FROM thumbsupgallery/build:alpine
# Cache all the binary dependencies first # Install and cache dependencies
RUN apk add --update ffmpeg graphicsmagick exiftool COPY package.json /app
RUN npm install
# Install thumbsup globally # Run the tests
ARG THUMBSUP_VERSION=2.x.x COPY . /app
RUN npm install -g thumbsup@${THUMBSUP_VERSION} RUN scripts/cibuild
# Default command is thumbsup itself, so we can run
# > docker run thumbsupgallery/thumbsup --input [...] --output [...]
CMD ["thumbsup"]

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

@ -3,27 +3,14 @@
# Fail the build on any error # Fail the build on any error
set -eou pipefail set -eou pipefail
# Make sure binary package.json dependencies are available echo "--- Run unit tests"
PATH=$(pwd)/node_modules/.bin:$PATH npm test
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 "--- Verify lightgallery dependency is built in" echo "--- Verify lightgallery dependency is built in"
grep \"lightgallery\" package.json 1>/dev/null grep \"lightgallery\" package.json 1>/dev/null
echo "--- Run unit tests" echo "--- Comparing gallery snapshot"
mocha ./test-integration/test
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 "================" echo "================"
echo "Build successful" echo "Build successful"

@ -12,4 +12,4 @@ function finish {
rm -rf output-expected rm -rf output-expected
# run thumbsup # 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 rm -rf output-actual
# run thumbsup # run thumbsup
thumbsup --config config.json --output output-actual node ../bin/thumbsup.js --config config.json --output output-actual
# compare albums with the snapshot # compare albums with the snapshot
for expected in output-expected/*.html; do for expected in output-expected/*.html; do
Loading…
Cancel
Save