Skip to content
Snippets Groups Projects
Commit 5eb84387 authored by rschamp's avatar rschamp
Browse files

Aliasify

The equivalent config for Travis is only 87 lines long, and easy to read. Can CircleCI be similarly easy to read? Is this easy? Are you still reading this?
parent 4f0bf3c5
No related branches found
No related tags found
No related merge requests found
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2.1
jobs:
build:
aliases:
- &step_restore_git_cache
restore_cache:
keys:
- v1-git-{{ .Revision }}
- v1-git-
- &step_save_git_cache
save_cache:
paths:
- .git
key: v1-git-{{ .Revision }}
- &step_restore_dependency_cache
restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}
- v1-dependencies-
- &step_save_dependency_cache
save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package-lock.json" }}
- &step_save_build_cache
save_cache:
paths:
- build
key: v1-build-{{ .Revision }}
- &step_restore_build_cache
restore_cache:
keys:
- v1-build-{{ .Revision }}
- &step_save_dist_cache
save_cache:
paths:
- dist
key: v1-dist-{{ .Revision }}
- &step_restore_dist_cache
restore_cache:
keys:
- v1-dist-{{ .Revision }}
- &config_job_environment
docker:
- image: circleci/node:8.16-browsers
working_directory: ~/repo
- &config_deploy_requirements
requires:
- build
filters:
branches:
only:
- master
- develop
- smoke
- circle
- /^hotfix\/.*/
jobs:
build:
<<: *config_job_environment
environment:
NODE_ENV: production
JEST_JUNIT_OUTPUT_NAME: results.xml
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-git-{{ .Revision }}
- v1-git-
- *step_restore_git_cache
- checkout
- save_cache:
paths:
- .git
key: v1-git-{{ .Revision }}
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- *step_save_git_cache
- *step_restore_dependency_cache
- run: sudo npm install -g greenkeeper-lockfile
- run: npm --production=false install
- run: greenkeeper-lockfile-update
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package-lock.json" }}
- *step_save_dependency_cache
- run:
name: Lint
command: npm run test:lint -- --quiet --output-file test-results/eslint/results.xml --format junit
- run:
name: Unit
environment:
......@@ -51,7 +79,6 @@ jobs:
command: npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov
- store_artifacts:
path: coverage
- run:
name: Build
command: npm run build
......@@ -59,16 +86,8 @@ jobs:
path: build
- store_artifacts:
path: dist
- save_cache:
paths:
- build
key: v1-build-{{ .Revision }}
- save_cache:
paths:
- dist
key: v1-dist-{{ .Revision }}
- *step_save_build_cache
- *step_save_dist_cache
- run:
name: Integration
environment:
......@@ -76,12 +95,10 @@ jobs:
command: npm run test:integration -- --reporters="default" --reporters="jest-junit"
- store_test_results:
path: test-results
- run: greenkeeper-lockfile-upload
deploy-npm:
docker:
- image: circleci/node:8.16-browsers
working_directory: ~/repo
<<: *config_job_environment
environment:
NODE_OPTIONS: --max-old-space-size=4000
steps:
......@@ -94,14 +111,9 @@ jobs:
if [[ "$CIRCLE_BRANCH" == hotfix/* ]] # double brackets are important for matching the wildcard
then echo export NPM_TAG=circlehotfix >> $BASH_ENV
fi
- restore_cache:
keys:
- v1-git-{{ .Revision }}
- v1-git-
- *step_restore_git_cache
- checkout
- restore_cache:
keys:
- v1-dist-{{ .Revision }}
- *step_restore_dist_cache
- run: npm version --no-git-tag-version $RELEASE_VERSION
- run: |
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
......@@ -110,37 +122,16 @@ jobs:
- run: git push $CIRCLE_REPOSITORY_URL $RELEASE_VERSION
deploy-gh-pages:
docker:
- image: circleci/node:8.16-browsers
working_directory: ~/repo
<<: *config_job_environment
steps:
- restore_cache:
keys:
- v1-git-{{ .Revision }}
- v1-git-
- *step_restore_git_cache
- checkout
- run: |
git config --global user.email $(git log --pretty=format:"%ae" -n1)
git config --global user.name $(git log --pretty=format:"%an" -n1)
- restore_cache:
keys:
- v1-build-{{ .Revision }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}
- *step_restore_build_cache
- *step_restore_dependency_cache
- run: npm run deploy -- -e $CIRCLE_BRANCH
deploy-requirements: &deploy-requirements
requires:
- build
filters:
branches:
only:
- master
- develop
- smoke
- circle
- /^hotfix\/.*/
workflows:
version: 2
......@@ -148,6 +139,6 @@ workflows:
jobs:
- build
- deploy-npm:
<<: *deploy-requirements
<<: *config_deploy_requirements
- deploy-gh-pages:
<<: *deploy-requirements
<<: *config_deploy_requirements
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment