ci: run test and lint in parallel

This commit is contained in:
Sérgio Ramos 2017-06-01 13:03:11 +01:00
parent 8cd863f394
commit 0fd6884e68
3 changed files with 38 additions and 18 deletions

View File

@ -1,4 +1,3 @@
# Customize the test machine
machine:
pre:
- git config --global user.email "circleci@joyent.zone"
@ -7,7 +6,7 @@ machine:
services:
- docker
node:
version: 7.7.3
version: 7.10.0
dependencies:
override:
@ -29,10 +28,18 @@ test:
# mkdir coverage artifact folders
- ls -1 packages | xargs -I % mkdir -p $CIRCLE_ARTIFACTS/"%"
override:
# lint
- yarn run lint-ci
# test
- yarn run test-ci
# lint
- ./scripts/parallel-run --cmd="lint-ci":
parallel: true
files:
- packages/*/package.json
- package.json
# test
- ./scripts/parallel-run --cmd="test-ci":
parallel: true
files:
- packages/*/package.json
- package.json
deployment:
pre:
@ -46,11 +53,3 @@ deployment:
branch: master
commands:
- ./scripts/deploy
# production:
# tag: /production-*/
# commands:
# - CIRCLE_BRANCH=staging ./bin/docker-login
# - CIRCLE_BRANCH=staging ./bin/on-changes-publish-ui
# - CIRCLE_BRANCH=staging make -j2 build
# - CIRCLE_BRANCH=staging make -j2 push
# - CIRCLE_BRANCH=staging ./bin/deploy

View File

@ -15,12 +15,10 @@
"lint-docs": "./scripts/quality-docs",
"lint:root": "eslint scripts/* --fix",
"lint:packages": "lerna run lint",
"lint-ci:packages": "lerna run lint-ci",
"lint-ci:root": "eslint scripts/* --format junit --output-file $CIRCLE_TEST_REPORTS/lint/container-pilot-dashboard.xml",
"lint": "redrun -s lint:*",
"test": "lerna run test",
"lint-ci": "redrun -p lint-ci:*",
"test-ci": "lerna run test-ci",
"lint-ci": "eslint scripts/* --format junit --output-file $CIRCLE_TEST_REPORTS/lint/container-pilot-dashboard.xml",
"test-ci": "exit 0",
"clean": "lerna clean --yes",
"bootstrap": "lerna bootstrap",
"dev": "redrun -p dev:*",

23
scripts/parallel-run Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env node
const argv = require('yargs').argv;
const forEach = require('apr-for-each');
const main = require('apr-main');
const execa = require('execa');
const path = require('path');
const ROOT = process.cwd();
if (!argv.cmd) {
throw new Error('Missing --cmd argument');
}
const run = () =>
forEach(argv._, file =>
execa('yarn', ['run', argv.cmd], {
cwd: path.dirname(path.join(ROOT, file)),
stdio: 'inherit'
})
);
main(run());