Add FreeBSD to CI via Cirrus #1953

This commit is contained in:
Lovell Fuller 2019-11-07 10:39:25 +00:00
parent 11daa3b4d1
commit 1b401b1195
4 changed files with 59 additions and 39 deletions

13
.cirrus.yml Normal file
View File

@ -0,0 +1,13 @@
freebsd_instance:
image_family: freebsd-12-0
task:
prerequisites_script:
- sed -i '' 's/quarterly/latest/g' /etc/pkg/FreeBSD.conf
- pkg update -f
- pkg upgrade -y
- pkg install -y pkgconf vips libnghttp2 node npm
install_script:
- npm install --unsafe-perm
test_script:
- npm test

View File

@ -183,9 +183,13 @@
}, },
'configurations': { 'configurations': {
'Release': { 'Release': {
'conditions': [
['OS == "linux"', {
'cflags_cc': [ 'cflags_cc': [
'-Wno-cast-function-type' '-Wno-cast-function-type'
], ]
}],
['OS == "win"', {
'msvs_settings': { 'msvs_settings': {
'VCCLCompilerTool': { 'VCCLCompilerTool': {
'ExceptionHandling': 1 'ExceptionHandling': 1
@ -194,6 +198,8 @@
'msvs_disabled_warnings': [ 'msvs_disabled_warnings': [
4275 4275
] ]
}]
]
} }
}, },
}] }]

View File

@ -69,7 +69,7 @@
"scripts": { "scripts": {
"install": "(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)", "install": "(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)",
"clean": "rm -rf node_modules/ build/ vendor/ .nyc_output/ coverage/ test/fixtures/output.*", "clean": "rm -rf node_modules/ build/ vendor/ .nyc_output/ coverage/ test/fixtures/output.*",
"test": "semistandard && cc && npm run test-unit && npm run test-licensing && prebuild-ci", "test": "semistandard && cpplint && npm run test-unit && npm run test-licensing && prebuild-ci",
"test-unit": "nyc --reporter=lcov --branches=99 mocha --slow=5000 --timeout=60000 ./test/unit/*.js", "test-unit": "nyc --reporter=lcov --branches=99 mocha --slow=5000 --timeout=60000 ./test/unit/*.js",
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"", "test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
"test-coverage": "./test/coverage/report.sh", "test-coverage": "./test/coverage/report.sh",
@ -118,7 +118,7 @@
}, },
"devDependencies": { "devDependencies": {
"async": "^3.1.0", "async": "^3.1.0",
"cc": "^1.0.2", "cc": "^2.0.1",
"decompress-zip": "^0.3.2", "decompress-zip": "^0.3.2",
"documentation": "^12.1.3", "documentation": "^12.1.3",
"exif-reader": "^1.0.3", "exif-reader": "^1.0.3",

View File

@ -2,6 +2,7 @@
const fs = require('fs'); const fs = require('fs');
const assert = require('assert'); const assert = require('assert');
const promisify = require('util').promisify;
const rimraf = require('rimraf'); const rimraf = require('rimraf');
const sharp = require('../../'); const sharp = require('../../');
@ -150,40 +151,40 @@ describe('TIFF', function () {
}); });
}); });
it('TIFF setting xres and yres on file', function (done) { it('TIFF setting xres and yres on file', () =>
const res = 1000.0; // inputTiff has a dpi of 300 (res*2.54)
sharp(fixtures.inputTiff) sharp(fixtures.inputTiff)
.tiff({ .tiff({
xres: (res), xres: 1000,
yres: (res) yres: 1000
}) })
.toFile(fixtures.outputTiff, (err, info) => { .toFile(fixtures.outputTiff)
if (err) throw err; .then(() => sharp(fixtures.outputTiff)
assert.strictEqual('tiff', info.format); .metadata()
sharp(fixtures.outputTiff).metadata(function (err, metadata) { .then(({ density }) => {
if (err) throw err; assert.strictEqual(true,
assert.strictEqual(metadata.density, res * 2.54); // convert to dpi density === 2540 || // libvips <= 8.8.2
rimraf(fixtures.outputTiff, done); density === 25400); // libvips >= 8.8.3
}); return promisify(rimraf)(fixtures.outputTiff);
}); })
}); )
);
it('TIFF setting xres and yres on buffer', function (done) { it('TIFF setting xres and yres on buffer', () =>
const res = 1000.0; // inputTiff has a dpi of 300 (res*2.54)
sharp(fixtures.inputTiff) sharp(fixtures.inputTiff)
.tiff({ .tiff({
xres: (res), xres: 1000,
yres: (res) yres: 1000
}) })
.toBuffer(function (err, data, info) { .toBuffer()
if (err) throw err; .then(data => sharp(data)
sharp(data).metadata(function (err, metadata) { .metadata()
if (err) throw err; .then(({ density }) => {
assert.strictEqual(metadata.density, res * 2.54); // convert to dpi assert.strictEqual(true,
done(); density === 2540 || // libvips <= 8.8.2
}); density === 25400); // libvips >= 8.8.3
}); })
}); )
);
it('TIFF invalid xres value should throw an error', function () { it('TIFF invalid xres value should throw an error', function () {
assert.throws(function () { assert.throws(function () {