2017-10-28 21:31:01 +00:00
|
|
|
version: 2
|
2018-03-19 07:16:11 +00:00
|
|
|
|
|
|
|
defaults: &defaults
|
2018-10-17 21:28:25 +00:00
|
|
|
working_directory: ~/project
|
2018-03-19 07:16:11 +00:00
|
|
|
docker:
|
2019-01-12 21:46:58 +00:00
|
|
|
- image: circleci/node:latest
|
2018-10-17 21:28:25 +00:00
|
|
|
environment:
|
2018-12-29 21:20:41 +00:00
|
|
|
NODE_ENV: test
|
|
|
|
|
|
|
|
release_branches: &release_branches
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- dev
|
|
|
|
- next
|
2018-03-19 07:16:11 +00:00
|
|
|
|
2018-12-31 09:24:41 +00:00
|
|
|
release: &release
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: ~/project
|
|
|
|
- run:
|
|
|
|
name: release
|
|
|
|
command: |
|
2019-01-03 14:38:24 +00:00
|
|
|
if [ -z "$COMMIT_MSG" ]; then
|
2019-01-04 19:44:01 +00:00
|
|
|
COMMIT_MSG=$(git --no-pager log --pretty=full -n1 $CIRCLE_SHA1)
|
2019-01-03 14:38:24 +00:00
|
|
|
fi
|
2018-12-31 09:24:41 +00:00
|
|
|
if echo "$COMMIT_MSG" | grep -o "\[release\]"; then
|
|
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
|
|
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
|
|
yarn lerna version --yes --no-git-tag-version --no-push
|
|
|
|
PACKAGE_SUFFIX=edge yarn build
|
|
|
|
if [ "$CIRCLE_BRANCH" = "next" ]; then tag="--tag next"; fi
|
|
|
|
./scripts/workspace-run npm publish $tag -q
|
|
|
|
else
|
|
|
|
echo "Release phase is skipped."
|
|
|
|
fi
|
|
|
|
|
2017-10-28 21:31:01 +00:00
|
|
|
jobs:
|
2018-10-17 21:28:25 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Phase 1: Setup
|
|
|
|
# --------------------------------------------------------------------------
|
2018-03-19 07:37:52 +00:00
|
|
|
setup:
|
2018-03-19 07:16:11 +00:00
|
|
|
<<: *defaults
|
2017-10-28 21:31:01 +00:00
|
|
|
steps:
|
|
|
|
# Checkout repository
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
# Restore cache
|
|
|
|
- restore_cache:
|
2019-01-12 21:31:37 +00:00
|
|
|
key: lock-{{ checksum "yarn.lock" }}
|
2017-10-28 21:31:01 +00:00
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
- run:
|
|
|
|
name: Install Dependencies
|
2018-10-17 21:28:25 +00:00
|
|
|
command: yarn --frozen-lockfile --non-interactive
|
2017-10-28 21:31:01 +00:00
|
|
|
|
2018-10-17 21:28:25 +00:00
|
|
|
# Save cache
|
2017-10-28 21:31:01 +00:00
|
|
|
- save_cache:
|
2019-01-12 21:31:37 +00:00
|
|
|
key: lock-{{ checksum "yarn.lock" }}
|
2017-10-28 21:31:01 +00:00
|
|
|
paths:
|
2018-10-17 21:28:25 +00:00
|
|
|
- node_modules
|
|
|
|
- packages/*/node_modules
|
2018-10-30 20:42:53 +00:00
|
|
|
- distributions/*/node_modules
|
2017-10-28 21:31:01 +00:00
|
|
|
|
2018-10-17 21:28:25 +00:00
|
|
|
# Persist workspace
|
2018-03-19 07:27:08 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: ~/project
|
|
|
|
paths:
|
2018-10-17 21:28:25 +00:00
|
|
|
- node_modules
|
|
|
|
- packages/*/node_modules
|
2018-10-30 20:42:53 +00:00
|
|
|
- distributions/*/node_modules
|
|
|
|
- packages/*/dist
|
2018-03-19 07:27:08 +00:00
|
|
|
|
2018-10-17 21:28:25 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Phase 2: Lint + Audit + Build Nuxt and fixtures
|
|
|
|
# --------------------------------------------------------------------------
|
2018-03-19 07:16:11 +00:00
|
|
|
lint:
|
2018-03-19 07:21:50 +00:00
|
|
|
<<: *defaults
|
|
|
|
steps:
|
2018-10-17 21:28:25 +00:00
|
|
|
- checkout
|
2018-03-19 07:27:08 +00:00
|
|
|
- attach_workspace:
|
2018-03-19 07:30:03 +00:00
|
|
|
at: ~/project
|
2018-03-19 07:21:50 +00:00
|
|
|
- run:
|
2018-09-14 06:42:50 +00:00
|
|
|
name: Lint
|
2018-03-27 22:28:17 +00:00
|
|
|
command: yarn test:lint
|
2017-11-24 16:17:27 +00:00
|
|
|
|
2018-09-14 06:42:50 +00:00
|
|
|
audit:
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
2018-10-17 21:28:25 +00:00
|
|
|
- checkout
|
2018-09-14 06:42:50 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/project
|
|
|
|
- run:
|
|
|
|
name: Security Audit
|
2018-12-20 14:52:40 +00:00
|
|
|
command: yarn audit
|
2018-09-14 06:42:50 +00:00
|
|
|
|
2018-03-19 07:16:11 +00:00
|
|
|
build:
|
2018-03-19 07:21:50 +00:00
|
|
|
<<: *defaults
|
|
|
|
steps:
|
2018-10-17 21:28:25 +00:00
|
|
|
- checkout
|
2018-03-19 07:27:08 +00:00
|
|
|
- attach_workspace:
|
2018-03-19 07:30:03 +00:00
|
|
|
at: ~/project
|
2018-03-19 07:21:50 +00:00
|
|
|
- run:
|
|
|
|
name: Build Fixtures
|
2019-01-14 09:43:39 +00:00
|
|
|
command: yarn test:fixtures -w=2 --coverage && yarn coverage
|
2018-03-19 07:37:52 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: ~/project
|
|
|
|
paths:
|
2018-10-30 20:42:53 +00:00
|
|
|
- test/fixtures
|
2018-03-19 07:16:11 +00:00
|
|
|
|
2019-01-06 07:56:59 +00:00
|
|
|
lint-app:
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: ~/project
|
|
|
|
- run:
|
|
|
|
name: Lint vue-app templates
|
|
|
|
command: yarn lint:app
|
|
|
|
|
2018-10-17 21:28:25 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Phase 3: Unit and E2E tests
|
|
|
|
# --------------------------------------------------------------------------
|
2018-03-27 22:28:17 +00:00
|
|
|
test-unit:
|
2018-03-19 07:21:50 +00:00
|
|
|
<<: *defaults
|
|
|
|
steps:
|
2018-10-17 21:28:25 +00:00
|
|
|
- checkout
|
2018-03-19 07:27:08 +00:00
|
|
|
- attach_workspace:
|
2018-03-19 07:30:03 +00:00
|
|
|
at: ~/project
|
2018-03-19 07:21:50 +00:00
|
|
|
- run:
|
2018-10-17 21:28:25 +00:00
|
|
|
name: Unit Tests
|
2019-01-14 09:43:39 +00:00
|
|
|
command: yarn test:unit -w=2 --coverage && yarn coverage
|
2018-03-19 08:22:00 +00:00
|
|
|
|
|
|
|
test-e2e:
|
|
|
|
<<: *defaults
|
2019-01-12 21:24:58 +00:00
|
|
|
docker:
|
2019-01-12 21:46:58 +00:00
|
|
|
- image: circleci/node:latest-browsers
|
2018-03-19 08:22:00 +00:00
|
|
|
steps:
|
2018-10-17 21:28:25 +00:00
|
|
|
- checkout
|
2018-03-19 08:22:00 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/project
|
|
|
|
- run:
|
2018-10-17 21:28:25 +00:00
|
|
|
name: E2E Tests
|
2018-03-19 15:49:16 +00:00
|
|
|
command: yarn test:e2e && yarn coverage
|
2018-03-19 07:16:11 +00:00
|
|
|
|
2018-10-17 21:28:25 +00:00
|
|
|
# --------------------------------------------------------------------------
|
|
|
|
# Phase 4: Release (dev branch only)
|
|
|
|
# --------------------------------------------------------------------------
|
2018-12-31 09:24:41 +00:00
|
|
|
release-commit:
|
|
|
|
<<: *release
|
|
|
|
|
|
|
|
release-nightly:
|
|
|
|
<<: *release
|
|
|
|
environment:
|
2018-12-31 13:48:07 +00:00
|
|
|
COMMIT_MSG: '[release]'
|
2018-03-19 07:16:11 +00:00
|
|
|
|
2018-10-17 21:28:25 +00:00
|
|
|
# Workflow definition
|
2018-03-19 07:16:11 +00:00
|
|
|
workflows:
|
|
|
|
version: 2
|
2018-12-29 21:20:41 +00:00
|
|
|
|
|
|
|
# Build and test after each commit
|
2019-01-06 07:56:59 +00:00
|
|
|
# Manually release on release branches
|
2018-12-29 21:20:41 +00:00
|
|
|
commit:
|
2018-03-19 07:16:11 +00:00
|
|
|
jobs:
|
2018-03-19 07:37:52 +00:00
|
|
|
- setup
|
2018-12-29 21:20:41 +00:00
|
|
|
- lint: { requires: [setup] }
|
|
|
|
- audit: { requires: [setup] }
|
|
|
|
- build: { requires: [setup] }
|
2019-01-06 07:56:59 +00:00
|
|
|
- lint-app: { requires: [build] }
|
2018-12-29 21:20:41 +00:00
|
|
|
- test-unit: { requires: [build] }
|
|
|
|
- test-e2e: { requires: [build] }
|
2018-12-31 09:24:41 +00:00
|
|
|
- release-commit:
|
2019-01-06 07:56:59 +00:00
|
|
|
requires: [build, lint, lint-app, audit, test-unit, test-e2e]
|
2018-12-29 21:20:41 +00:00
|
|
|
filters:
|
|
|
|
<<: *release_branches
|
|
|
|
|
|
|
|
# Release nightly builds on release branches
|
|
|
|
nightly:
|
|
|
|
jobs:
|
|
|
|
- setup
|
|
|
|
- lint: { requires: [setup] }
|
|
|
|
- audit: { requires: [setup] }
|
|
|
|
- build: { requires: [setup] }
|
2019-01-06 07:56:59 +00:00
|
|
|
- lint-app: { requires: [build] }
|
2018-12-29 21:20:41 +00:00
|
|
|
- test-unit: { requires: [build] }
|
|
|
|
- test-e2e: { requires: [build] }
|
2018-12-31 09:24:41 +00:00
|
|
|
- release-nightly:
|
2019-01-06 07:56:59 +00:00
|
|
|
requires: [build, lint, lint-app, audit, test-unit, test-e2e]
|
2018-12-29 21:20:41 +00:00
|
|
|
triggers:
|
|
|
|
- schedule:
|
|
|
|
cron: "0 0 * * *"
|
2018-03-27 22:33:23 +00:00
|
|
|
filters:
|
2018-12-29 21:20:41 +00:00
|
|
|
<<: *release_branches
|