Created
August 2, 2018 10:48
-
-
Save sathiyaseelan/51278a94b9b802ce23a774dafaad48cf to your computer and use it in GitHub Desktop.
Sample Circle ci config to deploy a node application in heroku and run integration tests before and after release using cypress
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
# .circleci/config.yml | |
version: 2 | |
defaults: &defaults | |
working_directory: ~/app | |
docker: | |
# the Docker image with Cypress dependencies | |
- image: cypress/base:8 | |
environment: | |
## this enables colors in the output | |
TERM: xterm | |
jobs: | |
build: | |
<<: *defaults | |
steps: | |
- checkout | |
- restore_cache: | |
key: v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} | |
key: v2-deps-{{ .Branch }} | |
key: v2-deps | |
- run: | |
name: Install Dependencies | |
command: npm install | |
- save_cache: | |
key: v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} | |
paths: | |
- node_modules | |
- ~/.npm | |
- ~/.cache | |
- run: | |
name: Run Tests | |
command: npm run ci | |
- store_test_results: | |
path: results | |
- store_artifacts: | |
path: cypress/screenshots | |
deploy: | |
<<: *defaults | |
steps: | |
- checkout | |
- restore_cache: | |
key: v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} | |
key: v2-deps-{{ .Branch }} | |
key: v2-deps | |
- run: | |
name: Deploy Master to Heroku | |
command: | | |
git push https://heroku:[email protected]/$HEROKU_APP.git master --force | |
- run: | |
name: Run tests on Staging Server | |
command: npm run cy-test -- --config=baseUrl=https://$HEROKU_APP.herokuapp.com/en | |
- store_test_results: | |
path: results | |
- store_artifacts: | |
path: cypress/screenshots | |
workflows: | |
version: 2 | |
build-deploy: | |
jobs: | |
- build | |
- deploy: | |
requires: | |
- build | |
filters: | |
branches: | |
only: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment