Skip to content

Commit

Permalink
feat(ci): added CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
serge1peshcoff committed Feb 4, 2020
1 parent 4b3c788 commit 52c331a
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
orbs:
slack: circleci/slack@3.4.1
version: 2.1
jobs:
test:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run: docker run --name postgres -p 5432:5432 -d postgres:10.6
- run:
name: Install Node
command: |
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
echo 'export PATH=/usr/bin:$PATH' >> $BASH_ENV
which node && node -v
- run: npm install
- run: mkdir -p ~/reports/jest
- run:
name: Run tests
command: JEST_JUNIT_OUTPUT_DIR=$HOME/reports/jest npm test -- --reporters=default --reporters=jest-junit
- run: ./node_modules/.bin/codecov
- store_test_results:
path: ~/reports
- store_artifacts:
path: ~/reports
build:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run: docker-compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml build --no-cache oms-core-js
lint:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Install Node
command: |
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
echo 'export PATH=/usr/bin:$PATH' >> $BASH_ENV
which node && node -v
- run: npm install
- run: mkdir -p ~/reports
- run: npm run lint -- --format junit --output-file ~/reports/eslint.xml
- store_test_results:
path: ~/reports
- store_artifacts:
path: ~/reports
audit:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run: npm audit
docker-build-and-push:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run: docker build --tag aegee/oms-core-js:$(node -p "require('./package.json').version") --tag aegee/oms-core-js:latest -f docker/oms-core-js/Dockerfile .
- run: docker login --username $DOCKER_LOGIN --password $DOCKER_PASSWORD
- run: docker push aegee/oms-core-js:$(node -p "require('./package.json').version")
- run: docker push aegee/oms-core-js:latest
- slack/status:
success_message: The Docker image for \`$CIRCLE_PROJECT_REPONAME\` with tags \`$(node -p "require('./package.json').version")\` and \`latest\` has been pushed to Dockerhub.
failure_message: The Docker image for \`$CIRCLE_PROJECT_REPONAME\` build and push has failed.

workflows:
version: 2
# test:
# jobs:
# - test
lint:
jobs:
- lint
audit:
jobs:
- audit
build:
jobs:
- build
# docker-build-and-push:
# jobs:
# - docker-build-and-push:
# filters:
# branches:
# only: master

0 comments on commit 52c331a

Please sign in to comment.