130 lines
3 KiB
YAML
130 lines
3 KiB
YAML
aliases:
|
|
- &install_yarn_version
|
|
name: Install specific Yarn version
|
|
command: |
|
|
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.5
|
|
echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV
|
|
|
|
- &restore_yarn_cache
|
|
name: Restore Yarn cache
|
|
keys:
|
|
- yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
|
|
|
|
- &save_yarn_cache
|
|
name: Save Yarn cache
|
|
key: yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
|
|
paths:
|
|
- ~/.cache/yarn
|
|
|
|
- &run_yarn_install
|
|
name: Install dependencies
|
|
command: yarn install
|
|
|
|
defaults: &defaults
|
|
working_directory: ~/docsearch
|
|
docker:
|
|
- image: circleci/node:14.15.0
|
|
|
|
cypress: &cypress
|
|
working_directory: ~/docsearch
|
|
docker:
|
|
- image: cypress/browsers:node13.8.0-chrome81-ff75
|
|
environment:
|
|
## this enables colors in the output
|
|
TERM: xterm
|
|
|
|
version: 2.1
|
|
|
|
jobs:
|
|
test_build:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- run: *install_yarn_version
|
|
- restore_cache: *restore_yarn_cache
|
|
- run: *run_yarn_install
|
|
- save_cache: *save_yarn_cache
|
|
- run:
|
|
name: Build & Test packages size
|
|
command: |
|
|
yarn run build
|
|
yarn run test:size
|
|
|
|
test_lint:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- run: *install_yarn_version
|
|
- restore_cache: *restore_yarn_cache
|
|
- run: *run_yarn_install
|
|
- save_cache: *save_yarn_cache
|
|
- run:
|
|
name: Lint & Code styles
|
|
command: yarn run lint
|
|
- run:
|
|
name: Type Checking
|
|
command: yarn run test:types
|
|
|
|
test_unit:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- run: *install_yarn_version
|
|
- restore_cache: *restore_yarn_cache
|
|
- run: *run_yarn_install
|
|
- save_cache: *save_yarn_cache
|
|
- run:
|
|
name: Unit tests
|
|
command: yarn run test --maxWorkers=4
|
|
|
|
release:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- run: *install_yarn_version
|
|
- restore_cache: *restore_yarn_cache
|
|
- run: *run_yarn_install
|
|
- save_cache: *save_yarn_cache
|
|
- run:
|
|
name: Release if needed
|
|
command: yarn run shipjs trigger
|
|
|
|
test_cypress:
|
|
<<: *cypress
|
|
steps:
|
|
- checkout
|
|
- run: *install_yarn_version
|
|
- restore_cache: *restore_yarn_cache
|
|
- run: *run_yarn_install
|
|
- save_cache: *save_yarn_cache
|
|
- run:
|
|
name: Cypress test Actions
|
|
command: yarn run cy:run
|
|
- store_test_results:
|
|
path: cypress-results
|
|
- store_artifacts:
|
|
path: cypress\screenshots
|
|
- store_artifacts:
|
|
path: cypress\videos
|
|
|
|
workflows:
|
|
version: 2.1
|
|
ci:
|
|
jobs:
|
|
- test_build:
|
|
filters:
|
|
branches:
|
|
only: next
|
|
- test_unit:
|
|
filters:
|
|
branches:
|
|
only: next
|
|
- test_lint:
|
|
filters:
|
|
branches:
|
|
only: next
|
|
- test_cypress
|
|
- release:
|
|
filters:
|
|
branches:
|
|
only: next
|