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: machine:
pre: pre:
- git config --global user.email "circleci@joyent.zone" - git config --global user.email "circleci@joyent.zone"
@ -7,7 +6,7 @@ machine:
services: services:
- docker - docker
node: node:
version: 7.7.3 version: 7.10.0
dependencies: dependencies:
override: override:
@ -30,9 +29,17 @@ test:
- ls -1 packages | xargs -I % mkdir -p $CIRCLE_ARTIFACTS/"%" - ls -1 packages | xargs -I % mkdir -p $CIRCLE_ARTIFACTS/"%"
override: override:
# lint # lint
- yarn run lint-ci - ./scripts/parallel-run --cmd="lint-ci":
parallel: true
files:
- packages/*/package.json
- package.json
# test # test
- yarn run test-ci - ./scripts/parallel-run --cmd="test-ci":
parallel: true
files:
- packages/*/package.json
- package.json
deployment: deployment:
pre: pre:
@ -46,11 +53,3 @@ deployment:
branch: master branch: master
commands: commands:
- ./scripts/deploy - ./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-docs": "./scripts/quality-docs",
"lint:root": "eslint scripts/* --fix", "lint:root": "eslint scripts/* --fix",
"lint:packages": "lerna run lint", "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:*", "lint": "redrun -s lint:*",
"test": "lerna run test", "test": "lerna run test",
"lint-ci": "redrun -p lint-ci:*", "lint-ci": "eslint scripts/* --format junit --output-file $CIRCLE_TEST_REPORTS/lint/container-pilot-dashboard.xml",
"test-ci": "lerna run test-ci", "test-ci": "exit 0",
"clean": "lerna clean --yes", "clean": "lerna clean --yes",
"bootstrap": "lerna bootstrap", "bootstrap": "lerna bootstrap",
"dev": "redrun -p dev:*", "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());