Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version: 2.1
- orbs:
- codecov: codecov/codecov@1.0.4
- jobs: # here we define two jobs: \"build\" and \"test\"
- build:
- working_directory: ~/simpleServer
- docker:
- - image: circleci/node:10
- steps:
- - checkout
- - run:
- name: Install Dependencies
- command: npm install
- - run:
- name: Build Application
- command: npm run build:js
- - run: mkdir dist
- - persist_to_workspace:
- root: dist
- paths:
- - ./
- test:
- environment:
- NODE_ENV: test
- JWT_SECRET: secret
- JWT_EXPIRES_IN: 90d
- JWT_COOKIE_EXPIRES_IN: 90
- MONGOSTRING: "mongodb://localhost:27017/test"
- MYSQL_ROOT_PASSWORD: ""
- MYSQL_ALLOW_EMPTY_PASSWORD: true
- MYSQL_DATABASE: circle_test
- MYSQL_USER: root
- MYSQL_PASSWORD: ""
- working_directory: ~/simpleServer
- docker:
- - image: circleci/node:10
- - image: gmaster0o0/circlecimysql:v1
- - image: circleci/mongo:latest
- steps:
- - checkout
- - run:
- name: Install Dependencies
- command: npm install
- - run:
- name: Run Tests
- command: npm run ci
- - run:
- name: Run Linter
- command: npm run lint
- - run:
- name: Run Security check
- command: npm audit
- - run:
- name: Run Code Coverage
- command: npm run coverage
- - store_artifacts:
- path: coverage
- - codecov/upload:
- file: coverage
- deploy:
- environment:
- NODE_ENV: test
- JWT_SECRET: secret
- JWT_EXPIRES_IN: 90d
- JWT_COOKIE_EXPIRES_IN: 90
- MONGOSTRING: "mongodb://localhost:27017/test"
- MYSQL_ROOT_PASSWORD: rootpw
- MYSQL_ALLOW_EMPTY_PASSWORD: true
- MYSQL_DATABASE: test_db
- MYSQL_USER: user
- MYSQL_PASSWORD: ""
- DB_DATABASE: test_db
- DB_HOST: localhost
- DB_USER: root
- DB_PASSWORD: rootpw
- working_directory: ~/simpleServer
- docker:
- - image: circleci/node:10
- steps:
- - attach_workspace :
- at: ~/simpleServer/dist
- - add_ssh_keys:
- fingerprints:
- b9:10:b5:60:0d:f1:50:45:23:4d:ab:77:42:b3:90:ad
- - run:
- name: Deploy to remote server
- command: ssh -o "StrictHostKeyChecking no" $SSH_USER@$SSH_HOST "cd ~/simpleServer; git pull origin master; npm install; npm run build:js"
- workflows:
- version: 2
- build_and_test_deploy:
- jobs:
- - build
- - test:
- requires:
- - build
- - deploy:
- requires:
- - build
- - test
- filters:
- branches:
- only:
- - master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement