-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
295 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
discord: antonioned/[email protected] | ||
node: circleci/[email protected] | ||
|
||
commands: | ||
setup: | ||
description: 'Set of common setup steps.' | ||
steps: | ||
- checkout | ||
- node/install-packages | ||
|
||
get_env: | ||
description: 'Getting the environment variables loaded into the shell when needed.' | ||
steps: | ||
- attach_workspace: | ||
at: '.' | ||
- run: cat .env >> $BASH_ENV | ||
|
||
failure_handler: | ||
steps: | ||
- discord/status: | ||
fail_only: true | ||
failure_message: ':skull_crossbones: Bruh! The CI workflow for the branch **$CIRCLE_BRANCH** failed. Get the branch fixed before deployment!' | ||
|
||
success_handler: | ||
steps: | ||
- get_env | ||
- discord/status: | ||
success_only: true | ||
success_message: ':rocket: Hurray! The CI workflow for the branch **$CIRCLE_BRANCH** is a success! Version ${BUILD_VERSION} is up!' | ||
|
||
defaults: &defaults | ||
docker: | ||
- image: cimg/node:18.1.0 | ||
|
||
jobs: | ||
build: | ||
<<: *defaults | ||
steps: | ||
- setup | ||
|
||
set_env: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- run: mkdir -p tmp | ||
- run: echo "export BUILD_VERSION=$(npm pkg get version | tr -d '\"')" >> tmp/.env | ||
- persist_to_workspace: | ||
root: tmp | ||
paths: | ||
- .env | ||
|
||
lint: | ||
<<: *defaults | ||
steps: | ||
- setup | ||
- run: npm run lint | ||
|
||
test: | ||
<<: *defaults | ||
steps: | ||
- setup | ||
- run: npm run test | ||
- store_test_results: | ||
path: reports/mocha | ||
- store_artifacts: | ||
path: coverage | ||
|
||
publish: | ||
<<: *defaults | ||
steps: | ||
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc | ||
- run: npm publish | ||
|
||
workflows: | ||
master-workflow: | ||
when: | ||
equal: [<< pipeline.git.branch >>, 'master'] | ||
jobs: | ||
- build: | ||
post-steps: | ||
- failure_handler | ||
- set_env: | ||
post-steps: | ||
- failure_handler | ||
requires: | ||
- build | ||
- lint: | ||
post-steps: | ||
- failure_handler | ||
requires: | ||
- set_env | ||
- test: | ||
post-steps: | ||
- failure_handler | ||
requires: | ||
- lint | ||
- publish: | ||
post-steps: | ||
- failure_handler | ||
- success_handler | ||
requires: | ||
- test | ||
pr-workflow: | ||
unless: | ||
equal: [<< pipeline.git.branch >>, 'master'] | ||
jobs: | ||
- build | ||
- lint: | ||
requires: | ||
- build | ||
- test: | ||
requires: | ||
- build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.nyc_output | ||
.npmrc | ||
coverage | ||
node_modules | ||
node_modules | ||
reports |
Oops, something went wrong.