mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-18 03:35:17 +00:00
162 lines
3.8 KiB
YAML
Executable File
162 lines
3.8 KiB
YAML
Executable File
version: 2
|
|
|
|
defaults: &defaults
|
|
working_directory: ~/project
|
|
docker:
|
|
- image: banian/node-headless-chrome
|
|
environment:
|
|
- NODE_ENV: test
|
|
|
|
jobs:
|
|
# --------------------------------------------------------------------------
|
|
# Phase 1: Setup
|
|
# --------------------------------------------------------------------------
|
|
setup:
|
|
<<: *defaults
|
|
steps:
|
|
# Checkout repository
|
|
- checkout
|
|
|
|
# Restore cache
|
|
- restore_cache:
|
|
key: yarn-{{ checksum "yarn.lock" }}
|
|
|
|
# Install dependencies
|
|
- run:
|
|
name: Install Dependencies
|
|
command: yarn --frozen-lockfile --non-interactive
|
|
|
|
# Save cache
|
|
- save_cache:
|
|
key: yarn-{{ checksum "yarn.lock" }}
|
|
paths:
|
|
- node_modules
|
|
- packages/*/node_modules
|
|
- distributions/*/node_modules
|
|
|
|
# Persist workspace
|
|
- persist_to_workspace:
|
|
root: ~/project
|
|
paths:
|
|
- node_modules
|
|
- packages/*/node_modules
|
|
- distributions/*/node_modules
|
|
- packages/*/dist
|
|
|
|
# --------------------------------------------------------------------------
|
|
# Phase 2: Lint + Audit + Build Nuxt and fixtures
|
|
# --------------------------------------------------------------------------
|
|
lint:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- run:
|
|
name: Lint
|
|
command: yarn test:lint
|
|
|
|
audit:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- run:
|
|
name: Security Audit
|
|
command: npm install --package-lock-only && npm audit --audit-level=moderate
|
|
|
|
build:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- run:
|
|
name: Build Fixtures
|
|
command: yarn test:fixtures -w=4 --coverage && yarn coverage
|
|
- persist_to_workspace:
|
|
root: ~/project
|
|
paths:
|
|
- test/fixtures
|
|
|
|
# --------------------------------------------------------------------------
|
|
# Phase 3: Unit and E2E tests
|
|
# --------------------------------------------------------------------------
|
|
test-unit:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- run:
|
|
name: Unit Tests
|
|
command: yarn test:unit -w=4 --coverage && yarn coverage
|
|
|
|
test-e2e:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- run:
|
|
name: E2E Tests
|
|
command: yarn test:e2e && yarn coverage
|
|
|
|
# --------------------------------------------------------------------------
|
|
# Phase 4: Release (dev branch only)
|
|
# --------------------------------------------------------------------------
|
|
release:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ~/project
|
|
- run:
|
|
name: release
|
|
command: |
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
yarn lerna version
|
|
PACKAGE_SUFFIX=edge yarn build
|
|
./scripts/workspace-run npm publish
|
|
|
|
# Workflow definition
|
|
workflows:
|
|
version: 2
|
|
setup-and-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
|