Nuxt/.circleci/config.yml

149 lines
3.0 KiB
YAML
Executable File

version: 2
defaults: &defaults
working_directory: ~/project/nuxt
docker:
- image: banian/node-headless-chrome
jobs:
setup:
<<: *defaults
steps:
# Checkout repository
- checkout
# Restore cache
- restore_cache:
key: yarn-{{ checksum "yarn.lock" }}
# Install dependencies
- run:
name: Install Dependencies
command: NODE_ENV=dev yarn
# Keep cache
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
paths:
- "node_modules"
# Persist files
- persist_to_workspace:
root: ~/project
paths:
- nuxt
lint:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run:
name: Lint
command: yarn test:lint
audit:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run:
name: Security Audit
command: npm install --package-lock-only && npm audit --audit-level=moderate
build:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run:
name: Build Fixtures
command: yarn build && yarn test:fixtures -w=4 --coverage && yarn coverage
- persist_to_workspace:
root: ~/project
paths:
- nuxt/test/fixtures
- nuxt/dist
environment:
- NODE_ENV: "test"
test-unit:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run:
name: Unit Test
command: yarn test:unit -w=4 --coverage && yarn coverage
environment:
- NODE_ENV: "test"
test-e2e:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run:
name: E2E Test
command: yarn test:e2e && yarn coverage
environment:
- NODE_ENV: "test"
release:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run:
name: release
command: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
BUILD_SUFFIX=edge yarn build
npm publish
for p in packages/*; do
if [ -f "$p/package.json" ]; then
cd $p
npm publish
cd -
fi
done
workflows:
version: 2
setup-and-parallel-test:
jobs:
- setup
- lint:
requires:
- setup
- audit:
requires:
- setup
- build:
requires:
- setup
- test-unit:
requires:
- build
- test-e2e:
requires:
- build
- release:
requires:
- build
- lint
- audit
- test-unit
- test-e2e
filters:
branches:
only:
- dev