storybook/.circleci/config.yml
2019-03-06 02:08:02 +08:00

336 lines
8.7 KiB
YAML

version: 2
aliases:
- &defaults
working_directory: /tmp/storybook
docker:
- image: circleci/node:8
dependencies:
pre:
- yarn global add npm
jobs:
build:
<<: *defaults
steps:
- checkout
- restore_cache:
name: Restore core dependencies cache
keys:
- core-dependencies-v3-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: yarn install
- run:
name: Check that yarn.lock is not corrupted
command: yarn repo-dirty-check
- run:
name: Bootstrap
command: yarn bootstrap --core
- save_cache:
name: Cache core dependencies
key: core-dependencies-v3-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- persist_to_workspace:
root: .
paths:
- node_modules
- examples
- addons
- app
- lib
examples:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- 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 react typescript kitchen-sink
command: |
cd examples/cra-ts-kitchen-sink
yarn build-storybook
- run:
name: Build vue kitchen-sink
command: |
cd examples/vue-kitchen-sink
yarn build-storybook
- run:
name: Build svelte kitchen-sink
command: |
cd examples/svelte-kitchen-sink
yarn build-storybook
- run:
name: Build angular-cli
command: |
cd examples/angular-cli
yarn build-storybook
- run:
name: Build ember-cli
command: |
cd examples/ember-cli
yarn build-storybook
- run:
name: Build polymer-cli
command: |
cd examples/polymer-cli
yarn build-storybook
- run:
name: Build marko-cli
command: |
cd examples/marko-cli
yarn build-storybook
- run:
name: Build mithril kitchen-sink
command: |
cd examples/mithril-kitchen-sink
yarn build-storybook
- run:
name: Build html kitchen-sink
command: |
cd examples/html-kitchen-sink
yarn build-storybook
- run:
name: Build riot kitchen-sink
command: |
cd examples/riot-kitchen-sink
yarn build-storybook
- run:
name: Build preact kitchen-sink
command: |
cd examples/preact-kitchen-sink
yarn build-storybook
- run:
name: Build official-storybook
command: |
cd examples/official-storybook
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
- attach_workspace:
at: .
- run:
name: Run react kitchen-sink (smoke test)
command: |
cd examples/cra-kitchen-sink
yarn storybook --smoke-test --quiet
- run:
name: Run react typescript kitchen-sink (smoke test)
command: |
cd examples/cra-ts-kitchen-sink
yarn storybook --smoke-test --quiet
- run:
name: Run vue kitchen-sink (smoke test)
command: |
cd examples/vue-kitchen-sink
yarn storybook --smoke-test --quiet
- run:
name: Run svelte kitchen-sink (smoke test)
command: |
cd examples/svelte-kitchen-sink
yarn storybook --smoke-test --quiet
- run:
name: Run angular-cli (smoke test)
command: |
cd examples/angular-cli
yarn storybook --smoke-test --quiet
- run:
name: Run ember-cli (smoke test)
command: |
cd examples/ember-cli
yarn storybook --smoke-test --quiet
- run:
name: Run polymer-cli (smoke test)
command: |
cd examples/polymer-cli
yarn storybook --smoke-test --quiet
- run:
name: Run marko-cli (smoke test)
command: |
cd examples/marko-cli
yarn storybook --smoke-test --quiet
- run:
name: Run official-storybook (smoke test)
command: |
cd examples/official-storybook
yarn storybook --smoke-test --quiet
- run:
name: Run mithril kitchen-sink (smoke test)
command: |
cd examples/mithril-kitchen-sink
yarn storybook --smoke-test --quiet
- run:
name: Run riot kitchen-sink (smoke test)
command: |
cd examples/riot-kitchen-sink
yarn storybook --smoke-test --quiet
- run:
name: Run preact kitchen-sink (smoke test)
command: |
cd examples/preact-kitchen-sink
yarn storybook --smoke-test --quiet
native-smoke-tests:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Bootstrap
command: yarn bootstrap --reactnativeapp
- run:
name: Run React-Native-App example
command: |
cd examples-native/crna-kitchen-sink
yarn storybook --smoke-test
frontpage:
<<: *defaults
steps:
- checkout
- restore_cache:
name: Restore core dependencies cache
keys:
- core-dependencies-v3-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: yarn install
- run:
name: Trigger build
command: ./scripts/build-frontpage.js
- save_cache:
name: Cache core dependencies
key: core-dependencies-v3-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
docs:
<<: *defaults
steps:
- checkout
- restore_cache:
name: Restore docs dependencies cache
keys:
- docs-dependencies-v2-{{ checksum "docs/yarn.lock" }}
- run:
name: Install dependencies
command: |
cd docs
yarn install
- run:
name: Build docs
command: |
cd docs
yarn build
- save_cache:
name: Cache docs dependencies
key: docs-dependencies-v2-{{ checksum "docs/yarn.lock" }}
paths:
- ~/.cache/yarn
- persist_to_workspace:
root: .
paths:
- docs/public
- docs/node_modules
lint:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Lint
command: yarn lint
test:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Test
command: yarn test --coverage --runInBand --core
- persist_to_workspace:
root: .
paths:
- coverage
coverage:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Upload coverage
command: yarn coverage
cli-test:
<<: *defaults
environment:
BASH_ENV: ~/.bashrc
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Test
command: yarn test --cli
no_output_timeout: 1800
cli-test-latest-cra:
<<: *defaults
environment:
BASH_ENV: ~/.bashrc
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Test CLI with latest CR(N)A
command: yarn test-latest-cra
workflows:
version: 2
build_test_deploy:
jobs:
- build
- docs
- frontpage
- lint:
requires:
- docs
- build
- examples:
requires:
- build
- smoke-tests:
requires:
- build
- native-smoke-tests:
requires:
- build
- test:
requires:
- build
- coverage:
requires:
- test
- cli-test:
requires:
- build
- cli-test-latest-cra:
requires:
- build