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:
|
|
|
|
|
- image: banian/node-headless-chrome
|
2018-10-17 21:28:25 +00:00
|
|
|
|
environment:
|
|
|
|
|
- NODE_ENV: test
|
2018-03-19 07:16:11 +00:00
|
|
|
|
|
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:
|
|
|
|
|
key: yarn-{{ checksum "yarn.lock" }}
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# Link
|
|
|
|
|
- run:
|
|
|
|
|
name: Link
|
|
|
|
|
command: yarn lerna link
|
|
|
|
|
|
|
|
|
|
# Save cache
|
2017-10-28 21:31:01 +00:00
|
|
|
|
- save_cache:
|
|
|
|
|
key: yarn-{{ checksum "yarn.lock" }}
|
|
|
|
|
paths:
|
2018-10-17 21:28:25 +00:00
|
|
|
|
- node_modules
|
|
|
|
|
- distributions/*/node_modules
|
|
|
|
|
- packages/*/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
|
|
|
|
|
- distributions/*/node_modules
|
|
|
|
|
- packages/*/node_modules
|
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
|
|
|
|
|
command: npm install --package-lock-only && npm audit --audit-level=moderate
|
|
|
|
|
|
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-10-17 21:28:25 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Build Nuxt
|
|
|
|
|
command: yarn build
|
2018-03-19 07:21:50 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Build Fixtures
|
2018-08-31 19:05:55 +00:00
|
|
|
|
command: yarn build && yarn test:fixtures -w=4 --coverage && yarn coverage
|
2018-03-19 07:37:52 +00:00
|
|
|
|
- persist_to_workspace:
|
|
|
|
|
root: ~/project
|
|
|
|
|
paths:
|
2018-10-17 21:28:25 +00:00
|
|
|
|
- test/fixtures # TODO
|
|
|
|
|
- distributions/**/dist
|
|
|
|
|
- packages/**/dist
|
2018-03-19 07:16:11 +00:00
|
|
|
|
|
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
|
2018-07-24 10:37:56 +00:00
|
|
|
|
command: yarn test:unit -w=4 --coverage && yarn coverage
|
2018-03-19 08:22:00 +00:00
|
|
|
|
|
|
|
|
|
test-e2e:
|
|
|
|
|
<<: *defaults
|
|
|
|
|
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-03-19 07:16:11 +00:00
|
|
|
|
release:
|
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-03-19 07:30:03 +00:00
|
|
|
|
name: release
|
|
|
|
|
command: |
|
2018-03-27 22:28:17 +00:00
|
|
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
|
|
|
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
2018-10-17 21:28:25 +00:00
|
|
|
|
yarn lerna version
|
|
|
|
|
PACKAGE_SUFFIX=edge yarn build
|
2018-10-17 22:25:21 +00:00
|
|
|
|
./scripts/workspace-run npm publish
|
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-10-17 21:28:25 +00:00
|
|
|
|
setup-and-test:
|
2018-03-19 07:16:11 +00:00
|
|
|
|
jobs:
|
2018-03-19 07:37:52 +00:00
|
|
|
|
- setup
|
2018-03-19 07:16:11 +00:00
|
|
|
|
|
|
|
|
|
- lint:
|
|
|
|
|
requires:
|
2018-03-19 07:37:52 +00:00
|
|
|
|
- setup
|
2018-03-19 07:16:11 +00:00
|
|
|
|
|
2018-09-14 06:42:50 +00:00
|
|
|
|
- audit:
|
|
|
|
|
requires:
|
|
|
|
|
- setup
|
|
|
|
|
|
2018-03-19 07:16:11 +00:00
|
|
|
|
- build:
|
|
|
|
|
requires:
|
2018-03-19 07:37:52 +00:00
|
|
|
|
- setup
|
2018-03-19 07:16:11 +00:00
|
|
|
|
|
2018-03-27 22:28:17 +00:00
|
|
|
|
- test-unit:
|
2018-03-19 07:16:11 +00:00
|
|
|
|
requires:
|
|
|
|
|
- build
|
|
|
|
|
|
2018-03-19 08:22:00 +00:00
|
|
|
|
- test-e2e:
|
|
|
|
|
requires:
|
|
|
|
|
- build
|
|
|
|
|
|
2018-03-19 07:16:11 +00:00
|
|
|
|
- release:
|
|
|
|
|
requires:
|
|
|
|
|
- build
|
|
|
|
|
- lint
|
2018-09-14 06:42:50 +00:00
|
|
|
|
- audit
|
2018-03-27 22:28:17 +00:00
|
|
|
|
- test-unit
|
2018-03-19 08:22:00 +00:00
|
|
|
|
- test-e2e
|
2018-03-27 22:33:23 +00:00
|
|
|
|
filters:
|
|
|
|
|
branches:
|
|
|
|
|
only:
|
|
|
|
|
- dev
|