Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize CI workflow #2331

Merged
merged 7 commits into from
Nov 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 95 additions & 52 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,51 @@ jobs:
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- dependencies-{{ checksum "yarn.lock" }}
- core-dependencies-{{ checksum "yarn.lock" }}
- run:
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
name: "Dirty check"
command: |
yarn bootstrap --core --docs --reactnative --reactnativeapp
yarn repo-dirty-check
- run:
name: "Dirty checking"
name: "Bootstrap"
command: |
yarn repo-dirty-check
yarn bootstrap --core
- save_cache:
key: dependencies-{{ checksum "yarn.lock" }}
name: "Cache core dependencies"
key: core-dependencies-{{ checksum "yarn.lock" }}
paths:
- node_modules
- docs/node_modules
- examples/react-native-vanilla/node_modules
- examples/crna-kitchen-sink/node_modules
- example/cra-kitchen-sink/node_modules
- example/vue-kitchen-sink/node_modules
- save_cache:
name: "Cache core dist"
key: core-dist-{{ .Revision }}
paths:
- addons
- app
- lib
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caches app, addons, and lib directories using current commit hash as a part of the cache key.

bootstrap --core transpiles all the packages in those directories (src to dist).

Ideally, it should be

paths:
  - addons/*/dist
  - app/*/dist
  - lib/*/dist

But unfortunately, wildcards are not supported in cached directories paths

example-kitchen-sinks:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- dependencies-{{ checksum "yarn.lock" }}
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Install dependencies"
name: "Link packages"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
yarn bootstrap --core
- run:
name: "Build react kitchen-sink"
command: |
Expand All @@ -60,15 +69,15 @@ jobs:
cd examples/vue-kitchen-sink
yarn build-storybook
- run:
name: "Run vue kitchen-sink"
name: "Run react kitchen-sink"
command: |
cd examples/vue-kitchen-sink
cd examples/cra-kitchen-sink
yarn storybook
background: true
- run:
name: "Run react kitchen-sink"
name: "Run vue kitchen-sink"
command: |
cd examples/cra-kitchen-sink
cd examples/vue-kitchen-sink
yarn storybook
background: true
- run:
Expand All @@ -80,88 +89,114 @@ jobs:
- store_artifacts:
path: integration/__image_snapshots__
destination: integration_image_snapshots
example-react-native:
react-native:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- dependencies-{{ checksum "yarn.lock" }}
- run:
name: "Install dependencies"
command: |
yarn install
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Bootstrapping packages"
name: "Bootstrap"
command: |
yarn bootstrap --core --reactnative --reactnativeapp
yarn bootstrap --reactnative --reactnativeapp
- run:
name: "Running React-Native example"
name: "Run React-Native example"
command: |
cd examples/react-native-vanilla
yarn storybook --smoke-test
- run:
name: "Running React-Native-App example"
name: "Run React-Native-App example"
command: |
cd examples/crna-kitchen-sink
yarn storybook --smoke-test
- run:
name: "Run React-Native unit tests"
command: |
yarn test --coverage --runInBand --reactnative
yarn coverage
docs:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- dependencies-{{ checksum "yarn.lock" }}
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore docs dependencies cache"
keys:
- docs-dependencies-{{ checksum "docs/yarn.lock" }}
- run:
name: "Install dependencies"
name: "Install core dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
name: "Install dependencies"
command: |
yarn bootstrap --docs
- run:
name: "Running docs"
name: "Dirty check"
command: |
yarn repo-dirty-check
- run:
name: "Run docs"
command: |
yarn docs:build
- save_cache:
name: "Cache dependencies"
key: docs-dependencies-{{ checksum "docs/yarn.lock" }}
paths:
- docs/node_modules
lint:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- dependencies-{{ checksum "yarn.lock" }}
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore docs dependencies cache"
keys:
- docs-dependencies-{{ checksum "docs/yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Install dependencies"
name: "Link packages"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
yarn bootstrap --core --docs
- run:
name: "Linting"
name: "Lint"
command: |
yarn lint
unit-test:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- dependencies-{{ checksum "yarn.lock" }}
- core-dist-{{ .Revision }}
- run:
name: "Install dependencies"
name: "Link packages"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
yarn bootstrap --core --reactnative
- run:
name: "Unit testing"
name: "Run unit tests"
command: |
yarn test --coverage --runInBand --core --reactnative
yarn test --coverage --runInBand --core
yarn coverage
deploy:
<<: *defaults
Expand All @@ -175,8 +210,16 @@ workflows:
build_accept_deploy:
jobs:
- build
- example-kitchen-sinks
- example-react-native
- example-kitchen-sinks:
requires:
- build
- react-native:
requires:
- build
- docs
- lint
- unit-test
- lint:
requires:
- build
- unit-test:
requires:
- build