@anansi/generator-js
Version:
Generate Fast React Web Apps
97 lines (91 loc) • 2.54 kB
YAML
# Javascript Node CircleCI 2.1 configuration file
#
# Check https://circleci.com/docs/2.1/language-javascript/ for more details
#
version: 2.1
jobs:
setup:
docker:
# specify the version you desire here
- image: <%= nodeImage %>
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: yarn install
command: |
sudo corepack enable
yarn install --immutable
yarn build:pkg
- save_cache:
paths:
- .yarn/cache
- .yarn/install-state.gz
key: v1-dependencies-{{ checksum "yarn.lock" }}
- persist_to_workspace:
root: ~/
paths:
- project
build:
docker:
steps:
- attach_workspace:
at: ~/
- run: yarn run build
lint:
parallelism: <%= circleParallelism %>
docker:
steps:
- attach_workspace:
at: ~/
- run:
#- run: yarn run lint packages/*/src
command: |
FILES=$(circleci tests glob "<%= rootPath %>/**/*.[jt]{s,}" | circleci tests split --split-by=timings)
yarn lint $FILES
<% if (testing) { %>
unit_tests:
parallelism: <%= circleParallelism * 2 %>
docker:
steps:
- attach_workspace:
at: ~/
- run:
command: |
FILES=$(circleci tests glob "<%= rootPath %>/**/*.test.[jt]{s,}" | circleci tests split --split-by=timings)
yarn test:ci -- -- --maxWorkers=4 $FILES
test_coverage:
parallelism: <%= circleParallelism * 2 %>
docker:
steps:
- attach_workspace:
at: ~/
- run:
command: |
FILES=$(circleci tests glob "<%= assetPath %>/**/*.test.[jt]{s,}" | circleci tests split --split-by=timings)
if [ "$COVERALLS_REPO_TOKEN" != "" ]; then yarn run test:coverage --maxWorkers=4 --coverageReporters=text-lcov $FILES | yarn run coveralls; fi
<% } %>
workflows:
version: 2
build:
jobs:
- setup
<% if (testing) { %>
- unit_tests:
requires:
- setup
- test_coverage:
requires:
- setup
<% } %>
- lint:
requires:
- setup
- build:
requires:
- setup