Skip to content

Commit

Permalink
ci: improve build time (#25)
Browse files Browse the repository at this point in the history
Use a **travis-ci** matrix to improve the build times.

Closes #19
  • Loading branch information
ifiokjr committed Mar 5, 2019
1 parent cfe514f commit b56a297
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 27 deletions.
46 changes: 35 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,48 @@ node_js:
env:
global:
- PATH=$HOME/.yarn/bin:$HOME/bin:$PATH
# Do multiple runs for testing and linting.
matrix:
- YARN_CMD=test
- YARN_CMD=test:integration
- YARN_CMD=ci:checks # Run linting and typechecks
- YARN_CMD=build:docs
- YARN_CMD=build:production

before_install:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
> $HOME/bin/cc-test-reporter
- chmod +x $HOME/bin/cc-test-reporter
- cc-test-reporter before-build
- |
set -e
if [[ $YARN_CMD == 'test' ]]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $HOME/bin/cc-test-reporter;
chmod +x $HOME/bin/cc-test-reporter;
cc-test-reporter before-build;
fi
set +e
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$HOME/bin:$PATH

install:
- yarn install
- yarn ci

script:
- yarn ci:checks
- yarn $YARN_CMD

after_script:
- cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
- |
set -e
if [[ $YARN_CMD == 'test' ]]; then
cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT;
fi
if [[ $YARN_CMD == 'build:production' ]]; then
yarn size:ci;
fi
set +e
notifications:
slack:
rooms:
secure: j2M2e9gEo/aSsywv3P7ccqVNmN7eVNK4zJoSJy1SOtVqcZtYQChxM4nkTha86PnhCzGlBMpFbL6jl0OeEWvQfeAk2GOvDwqMM4o0/Mi5twWJM8bXkGhIbvCswoHXbZOgdpa6jbwOufUGOzKS19YSkr+TDmhK1M5R0aXUASKprrwgT/rZ/yLrN0IbGVsYw2PpV3V3HRLTrWjguAiJqcIUD8/58mwjN6J163Z3e/2NWdFivzYyH9LTRgMShD2opvP89pp2GiSgOkfAMfv+AN4t8v877b2toRbdAJQvtNFaHTvcCuoXaOK9hAKXK3NrunR7XLQZCayywQI5dcrcKW+ad/KiM3y6NVZJYoqOSyVkv/QTJt0/LNUp/Llv3EfS654D1NEDj+9FhZSxJz3heV7RdOOVoTy6RiyA1VGd54ED5DZQ5NZE14uZY38/NuhawSMRkBYBrb0AiQez5pqQ3/Bbmkj8d9RjbMiJm9nhHcCiyXUz1wEB3v3HLmS2cyIAe1gNcuyw0MDp2MpMm9GQZCbbomQJItnQy2SZLco3ig1sUpZoyAlTPM8ANWN6hVpd7CEd75fXPThxadVdeQaZ7OtY11fkCeQxpASBRIliTY+ZrVe37uOBWrvbo8jg0vBUMhbn34ksYzfSq+fJ0DNCSAu1eRRQFuvFBVviDSaKce2XKqA=
# branches:
# only:
# - master
# - ci/*

branches:
only:
- master
- ci/*
2 changes: 1 addition & 1 deletion @remirror/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"version": "0.0.1-alpha.3",
"main": "lib/index.js",
"module": "lib/dist/remirror-react.esm.js",
"module": "lib/dist/react.esm.js",
"files": [
"lib",
"src"
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
]
},
"scripts": {
"build": "run-s build:modules build:rollup build:docs",
"build": "run-s build:modules build:rollup",
"build:docs": "docz build",
"build:modules": "lerna run build --stream",
"build:production": "cross-env NODE_ENV=production run-s build",
"build:production": "cross-env NODE_ENV=production yarn build",
"build:rollup": "rollup --config ./support/rollup/rollup.config.js",
"checks": "run-s integrity lint typecheck test",
"checks:parallel": "run-p lint typecheck test",
"ci": "yarn if-clean yarn clean; yarn frozen;",
"ci:checks": "run-s integrity lint typecheck build test:ci size:ci",
"ci:checks": "run-s integrity lint typecheck",
"clean": "yarn if-clean git clean -fdx",
"clean:modules": "yarn if-clean git clean -fdx @remirror support docs",
"dev": "lerna run dev --parallel",
Expand All @@ -39,12 +39,12 @@
"lint:support": "tslint --project support/tsconfig.json --config tslint.json",
"lint:ts": "lerna run lint --parallel",
"prepublish:alpha": "run-s ci:checks",
"publish:alpha": "lerna publish prerelease --preid=alpha --exact --dist-tag=alpha",
"publish:alpha": "lerna publish prerelease --preid=alpha --exact",
"size": "size-limit",
"size:ci": "bundlesize",
"test": "jest",
"test:ci": "cross-env TEST_ENV=live start-server-and-test launch:docs http-get://localhost:3000 test",
"test:ci:watch": "cross-env TEST_ENV=live yarn test:watch",
"test:integration": "cross-env TEST_ENV=integration start-server-and-test launch:docs http-get://localhost:3000 test",
"test:integration:watch": "cross-env TEST_ENV=integration yarn test:watch",
"test:watch": "jest --watch --verbose=false --coverage=false",
"typecheck": "lerna run typecheck"
},
Expand Down
9 changes: 6 additions & 3 deletions support/jest/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ const { join, resolve } = require('path');

const baseDir = (...paths) => resolve(__dirname, '..', '..', join(...paths));
const jestSupportDir = (...args) => baseDir(join('support', 'jest', ...args));
const testRegex = process.env.TEST_ENV
? '/__tests__/.*\\.(spec|test)\\.tsx?$'
: '/__tests__/.*\\.spec\\.tsx?$';
const testRegex =
process.env.TEST_ENV === 'integration'
? '/__tests__/.*\\.test\\.tsx?$'
: process.env.TEST_ENV === 'e2e'
? '/__tests__/.*\\.e2e\\.tsx?$'
: '/__tests__/.*\\.spec\\.tsx?$';

module.exports = {
clearMocks: true,
Expand Down
12 changes: 6 additions & 6 deletions support/rollup/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ function configure(pkg, env, target, rootFolder = '@remirror') {
format: 'es',
sourcemap: true,
},
{
file: `${rootFolder}/${folderName}/lib/dist/${folderName}.js`,
format: 'cjs',
exports: 'named',
sourcemap: true,
},
// {
// file: `${rootFolder}/${folderName}/lib/dist/${folderName}.js`,
// format: 'cjs',
// exports: 'named',
// sourcemap: true,
// },
],
// We need to explicitly state which modules are external, meaning that
// they are present at runtime. In the case of non-UMD configs, this means
Expand Down

0 comments on commit b56a297

Please sign in to comment.