mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-07 00:40:00 +01:00
Compare commits
16 Commits
dependabot
...
github-act
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7715fa2716 | ||
|
|
db180e9570 | ||
|
|
0d38f0c2df | ||
|
|
ade797d39b | ||
|
|
88df59a2ee | ||
|
|
f094457f17 | ||
|
|
a9cf52e9e5 | ||
|
|
89435c868d | ||
|
|
d4d442557b | ||
|
|
68f82f6847 | ||
|
|
cd1aeda639 | ||
|
|
6c63cc7fc7 | ||
|
|
474a3f8547 | ||
|
|
b42249f471 | ||
|
|
78620c77e5 | ||
|
|
1fcc522c2b |
209
.github/workflows/tests.yml
vendored
Normal file
209
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
name: tests
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
base-tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: "Base istanbul/tape node tests"
|
||||
run: npm test
|
||||
|
||||
benchmark-tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: "Benchmark tests"
|
||||
run: npm run benchmark
|
||||
|
||||
gif-tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: "Gif tests"
|
||||
run: npm run gif-test
|
||||
|
||||
browserify-core-tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- run: sudo apt-get install xvfb
|
||||
- name: "Browserify core tests and run"
|
||||
run: grunt tests && xvfb-run --auto-servernum npm run core-tests
|
||||
|
||||
jsmine-ui-tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: "Jasmine UI tests (mocked browser env)"
|
||||
run: npm run test-ui
|
||||
|
||||
jest-ui-tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: "jest-puppeteer UI tests (full browser env)"
|
||||
run: npm run test-ui-2
|
||||
|
||||
cli-tests:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: "CLI tests"
|
||||
run: npm run test-cli
|
||||
|
||||
grunt-build-test:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: "Grunt build test of dev environment"
|
||||
run: grunt build
|
||||
|
||||
## Cache NPM folder
|
||||
# cache:
|
||||
# directories:
|
||||
# - ~/.npm
|
||||
# - ~/.cache
|
||||
@@ -14,7 +14,7 @@
|
||||
"test-ui-2": "node ./node_modules/.bin/jest",
|
||||
"test-cli": "node test/cli/*.js | tap-spec",
|
||||
"setup": "npm i && npm i -g grunt grunt-cli && npm rebuild --build-from-source && grunt build",
|
||||
"start": "grunt serve"
|
||||
"start": "grunt serve"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
@@ -106,6 +106,7 @@
|
||||
"lint-staged": "^10.0.3",
|
||||
"looks-same": "^7.0.0",
|
||||
"matchdep": "^2.0.0",
|
||||
"resemblejs": "^3.2.5",
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^4.9.2",
|
||||
"tape-run": "^8.0.0",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
const test = require('tape'),
|
||||
base64Img = require('base64-img');
|
||||
|
||||
const compare = require('resemblejs').compare;
|
||||
|
||||
const ImageSequencer = require('../../../src/ImageSequencer');
|
||||
|
||||
const test_gif = require('../images/test.gif.js');
|
||||
@@ -15,19 +17,37 @@ target = 'test_outputs';
|
||||
* @param {String} [input="test_gif"] optional input image. Default is a test gif.
|
||||
*/
|
||||
module.exports = (moduleName, options, benchmark, input) => {
|
||||
let sequencer = ImageSequencer({ui: false});
|
||||
let sequencer = ImageSequencer({ ui: false });
|
||||
sequencer.loadImages(input || test_gif);
|
||||
sequencer.addSteps(moduleName, options);
|
||||
test(`${moduleName} module works correctly`, t => {
|
||||
sequencer.run({mode: 'test'}, () => {
|
||||
test(`${moduleName} module works correctly`, (t) => {
|
||||
sequencer.run({ mode: 'test' }, () => {
|
||||
let result = sequencer.steps[1].output.src;
|
||||
|
||||
base64Img.imgSync(result, target, `${moduleName}-result`);
|
||||
base64Img.imgSync(benchmark, target, `${moduleName}-benchmark`);
|
||||
|
||||
t.equal(result === benchmark, true, `${moduleName} module works correctly with Gif`);
|
||||
let mismatch = 100;
|
||||
compare(
|
||||
result,
|
||||
benchmark,
|
||||
{ returnEarlyThreshold: 5 },
|
||||
(err, { rawMisMatchPercentage }) => {
|
||||
if (err) {
|
||||
console.log('An error while comparing!');
|
||||
} else {
|
||||
mismatch = rawMisMatchPercentage;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
t.equal(
|
||||
mismatch < 5,
|
||||
true,
|
||||
`${moduleName} module works correctly with Gif`
|
||||
);
|
||||
sequencer = null;
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user