Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
126 changes: 35 additions & 91 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,44 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:8.6.0

# 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

working_directory: ~/repo

steps:
- checkout

# 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: npm install
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
orbs:
# The Node.js orb contains a set of prepackaged CircleCI configuration you can utilize
# Orbs reduce the amount of configuration required for common tasks.
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
node: circleci/node@4.1

# run tests!
- run: npm test

# deploy to staging!
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
npm rebuild node-sass &&
npm run generate
./node_modules/.bin/firebase use staging
./node_modules/.bin/firebase deploy --token=$FIREBASE_TOKEN --non-interactive
fi
deploy:
jobs:
# Below is the definition of your job to build and test your app, you can rename and customize it as you want.
build-and-test:
# These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/node
docker:
# specify the version you desire here
- image: circleci/node:7.10

# 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

working_directory: ~/repo

- image: cimg/node:15.1
# Then run your tests!
# CircleCI will report the results back to your VCS provider.
steps:
# Checkout the code as the first step.
- checkout
# Next, the node orb's install-packages step will install the dependencies from a package.json.
# The orb install-packages step will also automatically cache them for faster future runs.
- node/install-packages
# If you are using yarn instead npm, remove the line above and uncomment the two lines below.
# - node/install-packages:
# pkg-manager: yarn
- run:
name: Run tests
command: npm 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: npm install

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

# run tests!
- run: npm test

# deploy to production!
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
npm run generate
./node_modules/.bin/firebase use default
./node_modules/.bin/firebase deploy --token=$FIREBASE_TOKEN --non-interactive
fi
workflows:
version: 2
build-and-approval-deploy:
# Below is the definition of your workflow.
# Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
# CircleCI will run this workflow on every commit.
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
sample:
jobs:
- build
- hold:
type: approval
requires:
- build
- deploy:
requires:
- hold

- build-and-test
# For running simple node tests, you could optionally use the node/test job from the orb to replicate and replace the job above in fewer lines.
# - node/test
Loading