storybook/.circleci/config.yml
Hypnosphi 1c1aa4803a Don't run chromatic twice
(cherry picked from commit 51cae39)
2018-04-23 17:38:28 +03:00

336 lines
9.2 KiB
YAML

defaults: &defaults
working_directory: /tmp/storybook
docker:
- image: circleci/node:8
version: 2
dependencies:
pre:
- yarn global add npm
jobs:
build:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- run:
name: "Install dependencies"
command: |
yarn install
- run:
name: "Dirty check"
command: |
yarn repo-dirty-check
- run:
name: "Bootstrap"
command: |
yarn bootstrap --core
- save_cache:
name: "Cache core dependencies"
key: core-dependencies-{{ checksum "yarn.lock" }}
paths:
- node_modules
- examples/angular-cli/node_modules
- examples/cra-kitchen-sink/node_modules
- examples/mithril-kitchen-sink/node_modules
- examples/official-storybook/node_modules
- examples/polymer-cli/node_modules
- examples/vue-kitchen-sink/node_modules
- save_cache:
name: "Cache core dist"
key: core-dist-{{ .Revision }}
paths:
- addons
- app
- lib
example-kitchen-sinks:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: Workaround for https://github.com/GoogleChrome/puppeteer/issues/290
command: sh ./scripts/workaround-puppeteer-issue-290.sh
- run:
name: "Build react kitchen-sink"
command: |
cd examples/cra-kitchen-sink
yarn build-storybook
- run:
name: "Build vue kitchen-sink"
command: |
cd examples/vue-kitchen-sink
yarn build-storybook
- run:
name: "Build angular-cli"
command: |
cd examples/angular-cli
yarn build-storybook
- run:
name: "Build polymer-cli"
command: |
cd examples/polymer-cli
yarn build-storybook
- run:
name: "Build official-storybook"
command: |
cd examples/official-storybook
yarn build-storybook
- run:
name: "Build mithril kitchen-sink"
command: |
cd examples/mithril-kitchen-sink
yarn build-storybook
- run:
name: "Run image snapshots"
command: yarn test --image
- store_artifacts:
path: examples/official-storybook/image-snapshots/__image_snapshots__
destination: official_storybook_image_snapshots
smoke-tests:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Run react kitchen-sink (smoke test)"
command: |
cd examples/cra-kitchen-sink
yarn storybook --smoke-test
- run:
name: "Run vue kitchen-sink (smoke test)"
command: |
cd examples/vue-kitchen-sink
yarn storybook --smoke-test
- run:
name: "Run angular-cli (smoke test)"
command: |
cd examples/angular-cli
yarn storybook --smoke-test
- run:
name: "Run polymer-cli (smoke test)"
command: |
cd examples/polymer-cli
yarn storybook --smoke-test
- run:
name: "Run official-storybook (smoke test)"
command: |
cd examples/official-storybook
yarn storybook --smoke-test
- run:
name: "Run mithril kitchen-sink (smoke test)"
command: |
cd examples/mithril-kitchen-sink
yarn storybook --smoke-test
react-native:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Bootstrap"
command: |
yarn bootstrap --reactnative --reactnativeapp
- run:
name: "Run React-Native example"
command: |
cd examples/react-native-vanilla
yarn storybook --smoke-test
- run:
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 dependencies cache"
keys:
- docs-dependencies-{{ checksum "docs/yarn.lock" }}
- run:
name: "Install dependencies"
command: |
cd docs
yarn install --frozen-lockfile
- run:
name: "Build docs"
command: |
cd docs
yarn build
- save_cache:
name: "Cache dependencies"
key: docs-dependencies-{{ checksum "docs/yarn.lock" }}
paths:
- docs/node_modules
- save_cache:
name: "Cache built docs"
key: built-docs-{{ .Revision }}
paths:
- docs/public
lint:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- 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: "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:
- core-dist-{{ .Revision }}
- run:
name: "Run unit tests"
command: |
yarn test --coverage --runInBand --core
yarn coverage
cli:
working_directory: /tmp/storybook
docker:
- image: andthensome/docker-node-rsync
environment:
BASH_ENV: ~/.bashrc
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Test CLI"
command: |
yarn test --cli
cli-latest-cra:
working_directory: /tmp/storybook
docker:
- image: andthensome/docker-node-rsync
environment:
BASH_ENV: ~/.bashrc
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Test CLI with latest CR(N)A"
command: |
yarn test-latest-cra
deploy:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore docs dependencies cache"
keys:
- docs-dependencies-{{ checksum "docs/yarn.lock" }}
- restore_cache:
name: "Restore built docs"
keys:
- built-docs-{{ .Revision }}
- add_ssh_keys:
fingerprints:
- "35:aa:b9:c3:b8:1c:27:1f:02:0a:73:1a:ac:58:77:df"
- run:
name: "Deploy"
command: |
cd docs
git config --global user.email "gh-pages@localhost"
git config --global user.name "npm gh-pages"
yarn deploy:ci
workflows:
version: 2
build_accept_deploy:
jobs:
- build
- example-kitchen-sinks:
requires:
- build
- smoke-tests:
requires:
- build
- react-native:
requires:
- build
- docs
- lint:
requires:
- docs
- build
- unit-test:
requires:
- build
- cli:
requires:
- build
- cli-latest-cra:
requires:
- build
- deploy:
requires:
- docs
filters:
branches:
only:
- release/3.4