Nuxt/.circleci/config.disabled.yml

225 lines
6.0 KiB
YAML
Raw Normal View History

version: 2.1
executors:
node:
parameters:
browsers:
type: boolean
default: false
docker:
- image: circleci/node:lts<<# parameters.browsers >>-browsers<</ parameters.browsers >>
working_directory: ~/project
environment:
NODE_ENV: test
NODE_OPTIONS: --max_old_space_size=4096
2018-03-19 07:16:11 +00:00
commands:
attach-project:
steps:
- checkout
- attach_workspace:
at: ~/project
store-test-results:
steps:
- store_test_results:
path: reports/junit
release:
steps:
- attach-project
- run:
name: release
command: |
if [ -z "$COMMIT_MSG" ]; then
COMMIT_MSG=$(git --no-pager log --pretty=full -n1 $CIRCLE_SHA1)
fi
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
release_branches: &release_branches
branches:
only:
- dev
- next
2018-03-19 07:16:11 +00:00
2017-10-28 21:31:01 +00:00
jobs:
# --------------------------------------------------------------------------
# Phase 1: Setup
# --------------------------------------------------------------------------
2018-03-19 07:37:52 +00:00
setup:
executor: node
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
command: yarn --frozen-lockfile --non-interactive
2017-10-28 21:31:01 +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:
- node_modules
- packages/*/node_modules
- distributions/*/node_modules
2017-10-28 21:31:01 +00:00
# Persist workspace
2018-03-19 07:27:08 +00:00
- persist_to_workspace:
root: ~/project
paths:
- node_modules
- packages/*/node_modules
- distributions/*/node_modules
- packages/*/dist
2018-03-19 07:27:08 +00:00
# --------------------------------------------------------------------------
# Phase 2: Lint + Audit + Build Nuxt and fixtures
# --------------------------------------------------------------------------
2018-03-19 07:16:11 +00:00
lint:
executor: node
2018-03-19 07:21:50 +00:00
steps:
- attach-project
2018-03-19 07:21:50 +00:00
- run:
name: Lint
command: yarn test:lint
2017-11-24 16:17:27 +00:00
audit:
executor: node
steps:
- attach-project
- run:
name: Security Audit
2020-01-14 22:15:45 +00:00
command: yarn run audit
2018-03-19 07:16:11 +00:00
build:
executor: node
2018-03-19 07:21:50 +00:00
steps:
- attach-project
2018-03-19 07:21:50 +00:00
- run:
name: Build Fixtures
command: yarn test:fixtures -i
- store-test-results
2018-03-19 07:37:52 +00:00
- persist_to_workspace:
root: ~/project
paths:
- test/fixtures
2018-03-19 07:16:11 +00:00
2019-01-06 07:56:59 +00:00
lint-app:
executor: node
2019-01-06 07:56:59 +00:00
steps:
- attach-project
2019-01-06 07:56:59 +00:00
- run:
name: Lint vue-app templates
command: yarn lint:app
# --------------------------------------------------------------------------
# Phase 3: Unit and E2E tests
# --------------------------------------------------------------------------
test-dev:
executor: node
steps:
- attach-project
- run:
name: Dev Tests
command: yarn test:dev -w=2
2019-11-27 20:26:37 +00:00
- store-test-results
test-unit:
executor: node
2018-03-19 07:21:50 +00:00
steps:
- attach-project
2018-03-19 07:21:50 +00:00
- run:
name: Unit Tests
command: yarn test:unit --coverage && yarn coverage -F unit
environment:
JEST_JUNIT_OUTPUT_NAME: unit.xml
- store-test-results
2018-03-19 08:22:00 +00:00
test-e2e:
executor:
name: node
browsers: true
2018-03-19 08:22:00 +00:00
steps:
- attach-project
- run:
name: Download Chromium
command: |
cd /opt
sudo wget https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/641430/chrome-linux.zip
sudo unzip chrome-linux.zip
sudo ln -s `pwd`/chrome-linux/chrome /bin/chromium
2018-03-19 08:22:00 +00:00
- run:
name: E2E Tests
2019-05-17 09:36:33 +00:00
command: CHROME_PATH=/bin/chromium yarn test:e2e && yarn coverage -F e2e
environment:
JEST_JUNIT_OUTPUT_NAME: e2e.xml
- store-test-results
2018-03-19 07:16:11 +00:00
# --------------------------------------------------------------------------
# Phase 4: Release (dev branch only)
# --------------------------------------------------------------------------
2018-12-31 09:24:41 +00:00
release-commit:
executor: node
steps:
- release
2018-12-31 09:24:41 +00:00
release-nightly:
executor: node
steps:
- release
2018-12-31 09:24:41 +00:00
environment:
COMMIT_MSG: '[release]'
2018-03-19 07:16:11 +00:00
# Workflow definition
2018-03-19 07:16:11 +00:00
workflows:
version: 2
# Build and test after each commit
2019-01-06 07:56:59 +00:00
# Manually release on release branches
commit:
2018-03-19 07:16:11 +00:00
jobs:
2018-03-19 07:37:52 +00:00
- setup
- lint: { requires: [setup] }
- audit: { requires: [setup] }
- build: { requires: [setup] }
2019-01-06 07:56:59 +00:00
- lint-app: { requires: [build] }
- test-dev: { requires: [build] }
- test-unit: { requires: [build] }
- test-e2e: { requires: [build] }
2018-12-31 09:24:41 +00:00
- release-commit:
2019-11-27 20:26:37 +00:00
requires: [build, lint, lint-app, audit, test-dev, test-unit, test-e2e]
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] }
- test-dev: { requires: [build] }
- test-unit: { requires: [build] }
- test-e2e: { requires: [build] }
2018-12-31 09:24:41 +00:00
- release-nightly:
2019-11-27 20:26:37 +00:00
requires: [build, lint, lint-app, audit, test-dev, test-unit, test-e2e]
triggers:
- schedule:
cron: "0 0 * * *"
2018-03-27 22:33:23 +00:00
filters:
<<: *release_branches