Skip to content

Instantly share code, notes, and snippets.

@tombiscan
Created April 30, 2018 13:16
Show Gist options
  • Save tombiscan/6f82cfd516e8f9f6fe6429471a53d878 to your computer and use it in GitHub Desktop.
Save tombiscan/6f82cfd516e8f9f6fe6429471a53d878 to your computer and use it in GitHub Desktop.
Circle CI config for React App
version: 2
jobs:
build:
docker:
- image: circleci/node:9.11.1
working_directory: ~/app
branches:
only:
- master
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:
name: "Yarn Install"
command: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: "JavaScript Linter"
command: yarn lint --format junit -o reports/junit/js-lint-results.xml
- run:
name: "JavaScript Test Suite"
environment:
JEST_JUNIT_OUTPUT: reports/junit/js-test-results.xml
CI: true
command: yarn test --testResultsProcessor="jest-junit"
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit
- run:
name: "Yarn Build"
command: yarn build
no_output_timeout: 3600
- deploy:
name: "Deploy to Firebase"
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./node_modules/.bin/firebase use --token $FIREBASE_DEPLOY_TOKEN $FIREBASE_PROJECT_ID
./node_modules/.bin/firebase deploy --non-interactive --token "$FIREBASE_DEPLOY_TOKEN"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment