Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI process #1759

Merged
merged 7 commits into from
Sep 7, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 122 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,134 @@
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
version: 2.1

defaults: &defaults
working_directory: ~/project
docker:
- image: circleci/node:latest

jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:10.15.2

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4
#------------------------------------------------------------
# 1. Install dependencies
#------------------------------------------------------------

install-dependencies:
<<: *defaults
steps:
- checkout

- restore_cache:
keys:
- v1-deps-{{ checksum "yarn.lock" }}
- v1-deps

- run:
name: 'Install dependencies'
command: yarn --frozen-lockfile --non-interactive

- save_cache:
key: v1-deps-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn

- persist_to_workspace:
root: ~/project
paths:
- node_modules
- packages/*/node_modules
- packages/@vuepress/*/node_modules

#------------------------------------------------------------
# 2. Run parallel jobs:
# => lerna-boostrap
# => tsc
# => tests
# => linter
# => docs linter
#------------------------------------------------------------

working_directory: ~/repo
lerna-bootstrap:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: 'Lerna bootstrap'
command: yarn lerna:bootstrap

run-tsc:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: 'Run tsc'
command: yarn tsc
- persist_to_workspace:
root: ~/project
paths:
- packages/@vuepress/shared-utils/lib

run-tests:
<<: *defaults
steps:
- checkout
- checkout
- attach_workspace:
at: ~/project
- run:
name: 'Run tests'
command: yarn test

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
run-linter-check:
flozero marked this conversation as resolved.
Show resolved Hide resolved
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: 'Run linter'
command: yarn lint:check

run-docs-linter-check:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: 'Run md linter'
command: yarn workspace docs lint-md

#------------------------------------------------------------
# 3. Build VuePress
#------------------------------------------------------------

- run: yarn bootstrap
build:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: 'Run tests'
command: yarn build

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
#------------------------------------------------------------
# Workflows
#------------------------------------------------------------

# run tests!
- run: yarn build && yarn lint && yarn test
workflows:
version: 2
build:
jobs:
- install-dependencies
- lerna-bootstrap: { requires: [install-dependencies] }
- run-linter-check: { requires: [install-dependencies] }
- run-docs-linter-check: { requires: [install-dependencies] }
- run-tsc: { requires: [install-dependencies] }
- run-tests: { requires: [run-tsc] }
- build: { requires: [run-tests, run-linter-check, run-docs-linter-check, lerna-bootstrap] }
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"description": "Minimalistic doc generator with Vue component based layout system",
"scripts": {
"precommit": "lint-staged",
"bootstrap": "yarn && lerna bootstrap && yarn tsc",
"bootstrap": "yarn && yarn lerna:bootstrap && yarn tsc",
"lerna:bootstrap": "lerna bootstrap",
"clean": "lerna clean && rm -rf node_modules",
"boot": "node scripts/bootstrap.js",
"remote-version": "node scripts/remote-version.js",
Expand All @@ -19,7 +20,8 @@
"view-info": "yarn tsc && yarn workspace docs view-info",
"show-help": "yarn workspace docs show-help",
"register-vuepress": "lerna exec --scope vuepress -- yarn link",
"lint": "eslint packages --fix --ext .js,.vue",
"lint": "yarn lint:check --fix",
"lint:check": "eslint packages --ext .js,.vue",
"release": "yarn --pure-lockfile && yarn tsc && node scripts/release.js",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2",
"test": "node scripts/test.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
$themeLocaleConfig.sidebarDepth,
$themeConfig.sidebarDepth,
1
].find(depth => depth !== undefined);
].find(depth => depth !== undefined)

const displayAllHeaders = $themeLocaleConfig.displayAllHeaders
|| $themeConfig.displayAllHeaders
Expand Down