Skip to content

Commit

Permalink
Merge branch 'release/2.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Spring3 committed Mar 11, 2019
2 parents 6161ee9 + 1672f1f commit be7356e
Show file tree
Hide file tree
Showing 16 changed files with 3,386 additions and 223 deletions.
84 changes: 84 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
working_directory: ~/node-bunnymq
docker:
- image: circleci/node:10.15.1
- image: rabbitmq:3.6
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
steps:
- checkout
- setup_remote_docker
- run:
name: Install make
command: sudo apt-get update && sudo apt-get -y install gcc make

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}
- v1-dependencies-{{ .Branch }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies

- run:
name: Install dependencies
command: make deps

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

#Initialize the project and run tests
- run:
name: Initialize
command: make init

- run:
name: Test project
command: make cover

# Special step used to persist a temporary file to be used by another job in the workflow
- persist_to_workspace:
root: ~/node-bunnymq
paths:
- coverage

sonarqube:
working_directory: ~/node-bunnymq
docker:
# Sonarqube need OpenJDK 8 to run his analysis correctly
- image: circleci/openjdk:8-jdk-browsers
steps:
- checkout
# Special step used to attach the workflow’s workspace to the current container
# Retrieve coverage's folder for sonarqube
- attach_workspace:
at: ~/node-bunnymq

# Sonarqube need to have node installed to run his analysis
- run:
name: Install node
command: |
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt install nodejs
- run:
name: Sonar analysis
command: make sonar

workflows:
version: 2
build_and_test:
jobs:
- build
- sonarqube:
# sonarqube's job waiting for build's job before to run
requires:
- build
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
/.sonar/**
/logs/**
/.idea/**
/samples/**
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"mongo":true
},
"rules": {
// disable requiring trailing commas
"implicit-arrow-linebreak": "warn",
"comma-dangle": 0,
"max-len": ["error", {"code": 120, "ignoreComments": true, "ignoreUrls": true}],
"no-underscore-dangle": [1, { "allow": ["_config", "_connection", "_maxListeners"] }]
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ build/Release
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
.env
# Because we want people to receive patch fixes of dependency modules during the npm install
package-lock.json

# documentation
docs
Expand Down
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.PHONY: test

deps:
docker pull rabbitmq:3.6
npm install

init:
docker pull rabbitmq:3.6
cp .env.tpl .env

run:
Expand All @@ -14,6 +14,7 @@ lint:
npm run lint

cover:
make lint
npm run cover

test:
Expand All @@ -22,12 +23,12 @@ test:
sonar:
sed '/sonar.projectVersion/d' ./sonar-project.properties > tmp && mv tmp sonar-project.properties
echo sonar.projectVersion=`cat package.json | python -c "import json,sys;obj=json.load(sys.stdin);print obj['version'];"` >> sonar-project.properties
wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.8.zip
unzip sonar-scanner-2.8.zip
ifdef CI_PULL_REQUEST
@sonar-scanner-2.8/bin/sonar-scanner -e -Dsonar.analysis.mode=preview -Dsonar.github.pullRequest=${shell basename $(CI_PULL_REQUEST)} -Dsonar.github.repository=$(REPO_SLUG) -Dsonar.github.oauth=$(GITHUB_TOKEN) -Dsonar.login=$(SONAR_LOGIN) -Dsonar.password=$(SONAR_PASS) -Dsonar.host.url=$(SONAR_HOST_URL)
wget https://d3ayv6nsn4rwn3.cloudfront.net/utilities/sonar-scanner-cli.zip
unzip sonar-scanner-*
ifdef CIRCLE_PULL_REQUEST
@sonar-scanner/bin/sonar-scanner -e -Dsonar.analysis.mode=preview -Dsonar.github.pullRequest=${shell basename $(CIRCLE_PULL_REQUEST)} -Dsonar.github.repository=$(REPO_SLUG) -Dsonar.github.oauth=$(GITHUB_TOKEN) -Dsonar.login=$(SONAR_LOGIN) -Dsonar.password=$(SONAR_PASS) -Dsonar.host.url=$(SONAR_HOST_URL)
endif
ifeq ($(CIRCLE_BRANCH),develop)
@sonar-scanner-2.8/bin/sonar-scanner -e -Dsonar.analysis.mode=publish -Dsonar.host.url=$(SONAR_HOST_URL) -Dsonar.login=$(SONAR_LOGIN) -Dsonar.password=$(SONAR_PASS)
@sonar-scanner/bin/sonar-scanner -e -Dsonar.analysis.mode=publish -Dsonar.host.url=$(SONAR_HOST_URL) -Dsonar.login=$(SONAR_LOGIN) -Dsonar.password=$(SONAR_PASS)
endif
rm -rf sonar-scanner-2.8 sonar-scanner-2.8.zip
rm -rf sonar-scanner*
Loading

0 comments on commit be7356e

Please sign in to comment.