mirror of
https://github.com/SomboChea/ui
synced 2024-11-05 14:14:26 +07:00
186 lines
4.0 KiB
YAML
186 lines
4.0 KiB
YAML
version: 2
|
|
|
|
aliases:
|
|
- &repo_path
|
|
~/ui-theme
|
|
- &defaults
|
|
working_directory: *repo_path
|
|
- &node_latest_executor
|
|
docker:
|
|
- image: circleci/node:latest
|
|
- &node_lts_executor
|
|
docker:
|
|
- image: circleci/node:lts
|
|
- &node_8_executor
|
|
docker:
|
|
- image: circleci/node:8
|
|
- &default_executor
|
|
<<: *node_latest_executor
|
|
- &yarn_cache_key
|
|
yarn-sha-{{ checksum "yarn.lock" }}
|
|
- &coverage_key
|
|
coverage-{{ .Branch }}-{{ .Revision }}
|
|
- &restore_repo
|
|
attach_workspace:
|
|
at: *repo_path
|
|
- &ignore_non_dev_branches
|
|
filters:
|
|
tags:
|
|
only: /.*/
|
|
branches:
|
|
ignore:
|
|
- /release\/.*/
|
|
- &execute_on_release
|
|
filters:
|
|
tags:
|
|
only: /v?[0-9]+(\.[0-9]+)*([-+\.][a-zA-Z0-9]+)*/
|
|
branches:
|
|
ignore:
|
|
- /.*/
|
|
|
|
jobs:
|
|
prepare:
|
|
<<: *defaults
|
|
<<: *default_executor
|
|
steps:
|
|
- *restore_repo
|
|
- checkout
|
|
- restore_cache:
|
|
key: *yarn_cache_key
|
|
- run:
|
|
name: Install dependencies
|
|
command: yarn install --frozen-lockfile
|
|
- run:
|
|
name: Build project
|
|
command: yarn run build
|
|
- save_cache:
|
|
key: *yarn_cache_key
|
|
paths:
|
|
- ~/.yarn
|
|
- ~/.cache/yarn
|
|
- node_modules
|
|
- persist_to_workspace:
|
|
root: *repo_path
|
|
paths:
|
|
- ./*
|
|
|
|
lint:
|
|
<<: *defaults
|
|
<<: *default_executor
|
|
steps:
|
|
- *restore_repo
|
|
- run:
|
|
name: Lint code
|
|
command: yarn lint
|
|
|
|
test_bundlesize:
|
|
<<: *defaults
|
|
<<: *default_executor
|
|
steps:
|
|
- *restore_repo
|
|
- run:
|
|
name: Test BundleSize
|
|
command: yarn test:size
|
|
|
|
test_node_latest:
|
|
<<: *defaults
|
|
<<: *node_latest_executor
|
|
steps:
|
|
- *restore_repo
|
|
- run:
|
|
name: Test with Node (Latest)
|
|
command: yarn test
|
|
- save_cache:
|
|
key: *coverage_key
|
|
paths:
|
|
- coverage
|
|
|
|
test_node_lts:
|
|
<<: *defaults
|
|
<<: *node_lts_executor
|
|
steps:
|
|
- *restore_repo
|
|
- run:
|
|
name: Test with Node (LTS)
|
|
command: yarn test
|
|
|
|
test_node_8:
|
|
<<: *defaults
|
|
<<: *node_8_executor
|
|
steps:
|
|
- *restore_repo
|
|
- run:
|
|
name: Test with Node (8)
|
|
command: yarn run test
|
|
|
|
coverage:
|
|
<<: *defaults
|
|
<<: *default_executor
|
|
steps:
|
|
- *restore_repo
|
|
- restore_cache:
|
|
key: *coverage_key
|
|
- run:
|
|
name: Publish coverage
|
|
command: yarn run coverage:publish
|
|
- store_artifacts:
|
|
path: coverage/clover.xml
|
|
prefix: tests
|
|
- store_artifacts:
|
|
path: coverage
|
|
prefix: coverage
|
|
- store_test_results:
|
|
path: coverage/clover.xml
|
|
|
|
publish_package:
|
|
<<: *defaults
|
|
<<: *default_executor
|
|
steps:
|
|
- *restore_repo
|
|
- run:
|
|
name: 'Setup publish credentials'
|
|
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
- run:
|
|
name: Publish
|
|
command: yarn publish
|
|
|
|
workflows:
|
|
version: 2
|
|
workflow:
|
|
jobs:
|
|
- prepare:
|
|
<<: *ignore_non_dev_branches
|
|
- lint:
|
|
requires:
|
|
- prepare
|
|
<<: *ignore_non_dev_branches
|
|
- test_bundlesize:
|
|
requires:
|
|
- prepare
|
|
<<: *ignore_non_dev_branches
|
|
- test_node_latest:
|
|
requires:
|
|
- prepare
|
|
<<: *ignore_non_dev_branches
|
|
- test_node_lts:
|
|
requires:
|
|
- prepare
|
|
<<: *ignore_non_dev_branches
|
|
- test_node_8:
|
|
requires:
|
|
- prepare
|
|
<<: *ignore_non_dev_branches
|
|
- coverage:
|
|
requires:
|
|
- test_node_latest
|
|
<<: *ignore_non_dev_branches
|
|
- publish_package:
|
|
requires:
|
|
- lint
|
|
- test_bundlesize
|
|
- test_node_latest
|
|
- test_node_lts
|
|
- test_node_8
|
|
- coverage
|
|
<<: *execute_on_release
|