mirror of
https://github.com/lovell/sharp.git
synced 2025-07-12 03:50:13 +02:00
Add Alpine Linux packaging test #354
Requires libvips cache to be disabled for tests Skip tiff/magick tests when format unavailable
This commit is contained in:
parent
6ca2a4a9cd
commit
2a56de69cc
@ -5,6 +5,7 @@
|
|||||||
"maxcomplexity": 13,
|
"maxcomplexity": 13,
|
||||||
"globals": {
|
"globals": {
|
||||||
"before": true,
|
"before": true,
|
||||||
|
"beforeEach": true,
|
||||||
"after": true,
|
"after": true,
|
||||||
"describe": true,
|
"describe": true,
|
||||||
"it": true
|
"it": true
|
||||||
|
@ -6,13 +6,13 @@ if ! type docker >/dev/null; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test="npm run clean; NODE_ENV=development npm install --unsafe-perm; npm test"
|
test="npm run clean; npm install --unsafe-perm; npm test"
|
||||||
|
|
||||||
# Debian 7, 8
|
# Debian 7, 8
|
||||||
# Ubuntu 12.04, 14.04
|
# Ubuntu 12.04, 14.04
|
||||||
for dist in wheezy jessie precise trusty; do
|
for dist in wheezy jessie precise trusty; do
|
||||||
echo "Testing $dist..."
|
echo "Testing $dist..."
|
||||||
if docker run -i -t --rm -v $PWD:/v nodesource/$dist:0.12 >packaging/$dist.log 2>&1 sh -c "cd /v; ./packaging/test/debian.sh; $test";
|
if docker run -i -t --rm -v $PWD:/v -e "NODE_ENV=development" nodesource/$dist:0.12 >packaging/$dist.log 2>&1 sh -c "cd /v; ./packaging/test/debian.sh; $test";
|
||||||
then echo "$dist OK"
|
then echo "$dist OK"
|
||||||
else echo "$dist fail" && cat packaging/$dist.log
|
else echo "$dist fail" && cat packaging/$dist.log
|
||||||
fi
|
fi
|
||||||
@ -20,7 +20,7 @@ done
|
|||||||
|
|
||||||
# Centos 6
|
# Centos 6
|
||||||
echo "Testing centos6..."
|
echo "Testing centos6..."
|
||||||
if docker run -i -t --rm -v $PWD:/v nodesource/centos6:0.12 >packaging/centos6.log 2>&1 sh -c "cd /v; source ./packaging/test/centos6.sh; ./preinstall.sh; $test";
|
if docker run -i -t --rm -v $PWD:/v -e "NODE_ENV=development" nodesource/centos6:0.12 >packaging/centos6.log 2>&1 sh -c "cd /v; source ./packaging/test/centos6.sh; ./preinstall.sh; $test";
|
||||||
then echo "centos6 OK"
|
then echo "centos6 OK"
|
||||||
else echo "centos6 fail" && cat packaging/centos6.log
|
else echo "centos6 fail" && cat packaging/centos6.log
|
||||||
fi
|
fi
|
||||||
@ -29,7 +29,7 @@ fi
|
|||||||
# Fedora 20, 21
|
# Fedora 20, 21
|
||||||
for dist in centos7 fedora20 fedora21; do
|
for dist in centos7 fedora20 fedora21; do
|
||||||
echo "Testing $dist..."
|
echo "Testing $dist..."
|
||||||
if docker run -i -t --rm -v $PWD:/v nodesource/$dist:0.12 >packaging/$dist.log 2>&1 sh -c "cd /v; $test";
|
if docker run -i -t --rm -v $PWD:/v -e "NODE_ENV=development" nodesource/$dist:0.12 >packaging/$dist.log 2>&1 sh -c "cd /v; $test";
|
||||||
then echo "$dist OK"
|
then echo "$dist OK"
|
||||||
else echo "$dist fail" && cat packaging/$dist.log
|
else echo "$dist fail" && cat packaging/$dist.log
|
||||||
fi
|
fi
|
||||||
@ -48,3 +48,10 @@ if docker run -i -t --rm -v $PWD:/v base/archlinux:2015.06.01 >packaging/archlin
|
|||||||
then echo "archlinux OK"
|
then echo "archlinux OK"
|
||||||
else echo "archlinux fail" && cat packaging/archlinux.log
|
else echo "archlinux fail" && cat packaging/archlinux.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Alpine
|
||||||
|
echo "Testing alpine..."
|
||||||
|
if docker run -i -t --rm -v $PWD:/v -e "SHARP_TEST_WITHOUT_CACHE=0" wjordan/libvips >packaging/alpine.log 2>&1 sh -c "cd /v; ./packaging/test/alpine.sh; $test";
|
||||||
|
then echo "alpine OK"
|
||||||
|
else echo "alpine fail" && cat packaging/alpine.log
|
||||||
|
fi
|
||||||
|
7
packaging/test/alpine.sh
Executable file
7
packaging/test/alpine.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install Node.js
|
||||||
|
apk add --update make gcc g++ python nodejs
|
||||||
|
|
||||||
|
# Install libvips dependencies
|
||||||
|
apk add --update glib-dev libpng-dev libwebp-dev libexif-dev libxml2-dev orc-dev fftw-dev lcms2-dev
|
9
test/unit/cache.js
Normal file
9
test/unit/cache.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var sharp = require('../../index');
|
||||||
|
|
||||||
|
// Define SHARP_TEST_WITHOUT_CACHE environment variable to prevent use of libvips' cache
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
sharp.cache(process.env.SHARP_TEST_WITHOUT_CACHE ? false : true);
|
||||||
|
});
|
@ -29,7 +29,7 @@ describe('Colour space conversion', function() {
|
|||||||
.toFile(fixtures.path('output.greyscale-not.jpg'), done);
|
.toFile(fixtures.path('output.greyscale-not.jpg'), done);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (sharp.format.webp.output.buffer) {
|
if (sharp.format.tiff.input.file && sharp.format.webp.output.buffer) {
|
||||||
it('From 1-bit TIFF to sRGB WebP [slow]', function(done) {
|
it('From 1-bit TIFF to sRGB WebP [slow]', function(done) {
|
||||||
sharp(fixtures.inputTiff)
|
sharp(fixtures.inputTiff)
|
||||||
.webp()
|
.webp()
|
||||||
|
@ -65,6 +65,7 @@ describe('Partial image extraction', function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sharp.format.tiff.output.file) {
|
||||||
it('TIFF', function(done) {
|
it('TIFF', function(done) {
|
||||||
sharp(fixtures.inputTiff)
|
sharp(fixtures.inputTiff)
|
||||||
.extract({ left: 34, top: 63, width: 341, height: 529 })
|
.extract({ left: 34, top: 63, width: 341, height: 529 })
|
||||||
@ -76,6 +77,7 @@ describe('Partial image extraction', function() {
|
|||||||
fixtures.assertSimilar(fixtures.expected('extract.tiff'), data, done);
|
fixtures.assertSimilar(fixtures.expected('extract.tiff'), data, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
it('Before resize', function(done) {
|
it('Before resize', function(done) {
|
||||||
sharp(fixtures.inputJpg)
|
sharp(fixtures.inputJpg)
|
||||||
|
@ -438,6 +438,7 @@ describe('Input/output', function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sharp.format.tiff.input.file) {
|
||||||
it('Match TIFF input', function(done) {
|
it('Match TIFF input', function(done) {
|
||||||
sharp(fixtures.inputTiff)
|
sharp(fixtures.inputTiff)
|
||||||
.resize(320, 80)
|
.resize(320, 80)
|
||||||
@ -451,6 +452,7 @@ describe('Input/output', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
it('Match GIF input, therefore fail', function(done) {
|
it('Match GIF input, therefore fail', function(done) {
|
||||||
sharp(fixtures.inputGif)
|
sharp(fixtures.inputGif)
|
||||||
|
@ -55,6 +55,7 @@ describe('Image metadata', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (sharp.format.tiff.input.file) {
|
||||||
it('TIFF', function(done) {
|
it('TIFF', function(done) {
|
||||||
sharp(fixtures.inputTiff).metadata(function(err, metadata) {
|
sharp(fixtures.inputTiff).metadata(function(err, metadata) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -71,6 +72,7 @@ describe('Image metadata', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
it('PNG', function(done) {
|
it('PNG', function(done) {
|
||||||
sharp(fixtures.inputPng).metadata(function(err, metadata) {
|
sharp(fixtures.inputPng).metadata(function(err, metadata) {
|
||||||
@ -125,6 +127,7 @@ describe('Image metadata', function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sharp.format.magick.input.file) {
|
||||||
it('GIF via libmagick', function(done) {
|
it('GIF via libmagick', function(done) {
|
||||||
sharp(fixtures.inputGif).metadata(function(err, metadata) {
|
sharp(fixtures.inputGif).metadata(function(err, metadata) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -140,6 +143,7 @@ describe('Image metadata', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (sharp.format.openslide.input.file) {
|
if (sharp.format.openslide.input.file) {
|
||||||
it('Aperio SVS via openslide', function(done) {
|
it('Aperio SVS via openslide', function(done) {
|
||||||
|
@ -128,8 +128,13 @@ describe('Resize dimensions', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (sharp.format.tiff.input.file) {
|
||||||
it('TIFF embed known to cause rounding errors', function(done) {
|
it('TIFF embed known to cause rounding errors', function(done) {
|
||||||
sharp(fixtures.inputTiff).resize(240, 320).embed().jpeg().toBuffer(function(err, data, info) {
|
sharp(fixtures.inputTiff)
|
||||||
|
.resize(240, 320)
|
||||||
|
.embed()
|
||||||
|
.jpeg()
|
||||||
|
.toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual(true, data.length > 0);
|
assert.strictEqual(true, data.length > 0);
|
||||||
assert.strictEqual('jpeg', info.format);
|
assert.strictEqual('jpeg', info.format);
|
||||||
@ -140,7 +145,10 @@ describe('Resize dimensions', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('TIFF known to cause rounding errors', function(done) {
|
it('TIFF known to cause rounding errors', function(done) {
|
||||||
sharp(fixtures.inputTiff).resize(240, 320).jpeg().toBuffer(function(err, data, info) {
|
sharp(fixtures.inputTiff)
|
||||||
|
.resize(240, 320)
|
||||||
|
.jpeg()
|
||||||
|
.toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual(true, data.length > 0);
|
assert.strictEqual(true, data.length > 0);
|
||||||
assert.strictEqual('jpeg', info.format);
|
assert.strictEqual('jpeg', info.format);
|
||||||
@ -150,17 +158,6 @@ describe('Resize dimensions', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Max width or height considering ratio (landscape)', function(done) {
|
|
||||||
sharp(fixtures.inputJpg).resize(320, 320).max().toBuffer(function(err, data, info) {
|
|
||||||
if (err) throw err;
|
|
||||||
assert.strictEqual(true, data.length > 0);
|
|
||||||
assert.strictEqual('jpeg', info.format);
|
|
||||||
assert.strictEqual(320, info.width);
|
|
||||||
assert.strictEqual(261, info.height);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Max width or height considering ratio (portrait)', function(done) {
|
it('Max width or height considering ratio (portrait)', function(done) {
|
||||||
sharp(fixtures.inputTiff).resize(320, 320).max().jpeg().toBuffer(function(err, data, info) {
|
sharp(fixtures.inputTiff).resize(320, 320).max().jpeg().toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -172,6 +169,29 @@ describe('Resize dimensions', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Min width or height considering ratio (portrait)', function(done) {
|
||||||
|
sharp(fixtures.inputTiff).resize(320, 320).min().jpeg().toBuffer(function(err, data, info) {
|
||||||
|
if (err) throw err;
|
||||||
|
assert.strictEqual(true, data.length > 0);
|
||||||
|
assert.strictEqual('jpeg', info.format);
|
||||||
|
assert.strictEqual(320, info.width);
|
||||||
|
assert.strictEqual(422, info.height);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
it('Max width or height considering ratio (landscape)', function(done) {
|
||||||
|
sharp(fixtures.inputJpg).resize(320, 320).max().toBuffer(function(err, data, info) {
|
||||||
|
if (err) throw err;
|
||||||
|
assert.strictEqual(true, data.length > 0);
|
||||||
|
assert.strictEqual('jpeg', info.format);
|
||||||
|
assert.strictEqual(320, info.width);
|
||||||
|
assert.strictEqual(261, info.height);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Provide only one dimension with max, should default to crop', function(done) {
|
it('Provide only one dimension with max, should default to crop', function(done) {
|
||||||
sharp(fixtures.inputJpg).resize(320).max().toBuffer(function(err, data, info) {
|
sharp(fixtures.inputJpg).resize(320).max().toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@ -194,17 +214,6 @@ describe('Resize dimensions', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Min width or height considering ratio (portrait)', function(done) {
|
|
||||||
sharp(fixtures.inputTiff).resize(320, 320).min().jpeg().toBuffer(function(err, data, info) {
|
|
||||||
if (err) throw err;
|
|
||||||
assert.strictEqual(true, data.length > 0);
|
|
||||||
assert.strictEqual('jpeg', info.format);
|
|
||||||
assert.strictEqual(320, info.width);
|
|
||||||
assert.strictEqual(422, info.height);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Provide only one dimension with min, should default to crop', function(done) {
|
it('Provide only one dimension with min, should default to crop', function(done) {
|
||||||
sharp(fixtures.inputJpg).resize(320).min().toBuffer(function(err, data, info) {
|
sharp(fixtures.inputJpg).resize(320).min().toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
@ -111,7 +111,7 @@ describe('Rotation', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Attempt to auto-rotate image format without EXIF support', function(done) {
|
it('Attempt to auto-rotate image format without EXIF support', function(done) {
|
||||||
sharp(fixtures.inputGif)
|
sharp(fixtures.inputPng)
|
||||||
.rotate()
|
.rotate()
|
||||||
.resize(320)
|
.resize(320)
|
||||||
.jpeg()
|
.jpeg()
|
||||||
@ -120,7 +120,7 @@ describe('Rotation', function() {
|
|||||||
assert.strictEqual(true, data.length > 0);
|
assert.strictEqual(true, data.length > 0);
|
||||||
assert.strictEqual('jpeg', info.format);
|
assert.strictEqual('jpeg', info.format);
|
||||||
assert.strictEqual(320, info.width);
|
assert.strictEqual(320, info.width);
|
||||||
assert.strictEqual(213, info.height);
|
assert.strictEqual(236, info.height);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user