Skip to content

Commit

Permalink
Merge pull request #44 from MitocGroup/dev
Browse files Browse the repository at this point in the history
Merge dev branch
  • Loading branch information
AlexanderC authored Jun 21, 2016
2 parents 45ba2a0 + 4e4d7a3 commit c31b43b
Show file tree
Hide file tree
Showing 68 changed files with 511 additions and 177 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Interested in contributing to deep-microservices-helloworld?
Looking for web applications that use (or are similar to) deep-microservices-helloworld?

- Hello World: https://hello.deep.mg | https://github.com/MitocGroup/deep-microservices-helloworld
- Todo App: https://todo.deep.mg | https://github.com/MitocGroup/deep-microservices-todo-app
- Todo App: https://todo.deep.mg | https://github.com/MitocGroup/deep-microservices-todomvc
- Enterprise Software Marketplace: https://www.deep.mg


Expand Down
22 changes: 17 additions & 5 deletions bin/test/GitDiffWalker.es6
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export class GitDiffWalker {
* @constructor
*/
static get CMD() {
return `git diff --name-only ${GitDiffWalker.TARGET_BRANCH}`;
return (process.env['PR_MERGE'] === 'true') ?
'git diff --name-only @~..@' :
`git diff --name-only ${GitDiffWalker.TARGET_BRANCH}`;
}

/**
Expand Down Expand Up @@ -80,6 +82,14 @@ export class GitDiffWalker {
return 'BACKEND_MICROAPP_IDENTIFIERS';
}

/**
* @returns {string}
* @constructor
*/
static get CI_FULL() {
return 'CI_FULL';
}

/**
* @returns {string}
* @constructor
Expand Down Expand Up @@ -133,6 +143,7 @@ export class GitDiffWalker {
content.push(`${GitDiffWalker.FRONTEND_MICROAPP_PATHS}="{frontendMicroAppPaths}"`);
content.push(`${GitDiffWalker.BACKEND_MICROAPP_PATHS}="{backendMicroAppPaths}"`);
content.push(`${GitDiffWalker.BACKEND_MICROAPP_IDENTIFIERS}="{backendMicroAppIdentifiers}"`);
content.push(`${GitDiffWalker.CI_FULL}="{ciFull}"`);
content.push('');

return content.join(os.EOL);
Expand Down Expand Up @@ -544,8 +555,8 @@ export class GitDiffWalker {
backendMicroAppPaths = this.getBackendMicroAppNames();

frontendMicroAppPaths = (this.isBackendCodeChanged &&
typeof this._frontendMicroAppNames !== 'undefined' &&
this._frontendMicroAppNames.length > 0) ?
typeof this._frontendMicroAppNames !== 'undefined' &&
this._frontendMicroAppNames.length > 0) ?
GitDiffWalker.removeDuplicates(this.getFrontendMicroAppNames(), this.getBackendCodeMicroAppNames()) :
this.getBackendCodeMicroAppNames();

Expand All @@ -560,13 +571,14 @@ export class GitDiffWalker {
let varsContent = GitDiffWalker.TEST_PATHS_TPL
.replace(/\{frontendMicroAppPaths\}/g, frontendMicroAppPaths)
.replace(/\{backendMicroAppPaths\}/g, backendMicroAppPaths)
.replace(/\{backendMicroAppIdentifiers\}/g, backendMicroAppIdentifiers);
.replace(/\{backendMicroAppIdentifiers\}/g, backendMicroAppIdentifiers)
.replace(/\{ciFull\}/g, this.isFullCIRun);

fsExtra.writeFileSync(GitDiffWalker.VARS_SHELL_PATH, varsContent, 'utf8');

console.log("TRAVIS_COMMIT_MESSAGE: ", GitDiffWalker.commitMessage);
console.log(`isFullCIRun: ${this.isFullCIRun}`);
console.log(`isSkipTests: ${this.isSkipTests}`);
console.log(`isSkipTests: ${this.isSkipTests && !this.isFullCIRun}`);
console.log(`isFrontedCodeChanged: ${this.isFrontedCodeChanged}`);
console.log(`isFrontendTestsChanged: ${this.isFrontendTestsChanged}`);
console.log(`isBackendCodeChanged: ${this.isBackendCodeChanged}`);
Expand Down
11 changes: 6 additions & 5 deletions bin/test/_head.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ subpath_run_cmd () {
FRONTEND_CMD="${3}"
fi

##############################
### run tests for frontend ###
##############################
if [ "$__IS_CONCURRENT_SCRIPT" == "$__NONE" ] || [ "$__IS_CONCURRENT_SCRIPT" == "$__FRONTEND" ]; then
###############################################
### run tests for frontend or if [ci full] ###
###############################################
if [ "$__IS_CONCURRENT_SCRIPT" == "$__NONE" ] || [ "$__IS_CONCURRENT_SCRIPT" == "$__FRONTEND" ] || \
([ "${CI_FULL}" == "true" ] && [ "$__IS_CONCURRENT_SCRIPT" == "$__BACKEND" ]); then

for subpath in "${__FRONTEND_MODULES[@]}"
do
Expand All @@ -127,7 +128,7 @@ subpath_run_cmd () {
### replace ./frontend to absolute file path to fix karma issue after combining coverage reports ###
####################################################################################################
if [ "${FRONTEND_CMD}" == "npm run test" ]; then
SEARCH_VALUE='.\/frontend\/'
SEARCH_VALUE='\.\/frontend\/'
subpath=${subpath/tests\/frontend/frontend}

#######################################################
Expand Down
14 changes: 8 additions & 6 deletions bin/test/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ source $(dirname $0)/_head.sh
##############################
### Merge Coverage Results ###
##############################
istanbul-combine -d ${__COVERAGE_PATH} -r lcov -p both \
istanbul-combine -d ${__COVERAGE_PATH} -r lcovonly -p both \
${__SRC_PATH}*/tests/frontend/coverage/report.json \
${__SRC_PATH}*/tests/backend/coverage/*.json
${__SRC_PATH}*/tests/backend/coverage/coverage.json

################################################################
### Update paths to have src/* file in coverage report ###
Expand All @@ -22,10 +22,12 @@ REPLACE_VALUE=""
sed -e "s@${SEARCH_VALUE}@${REPLACE_VALUE}@g" ${__COVERAGE_PATH}"/lcov.info" > ${__COVERAGE_PATH}"/coverage.info"


######################################
### Upload Coverage info to Codacy ###
######################################
cat ${__COVERAGE_PATH}"/coverage.info" | codacy-coverage --debug
#######################################################
### Upload Coverage info to Codacy only for full CI ###
#######################################################
if [ "${CI_FULL}" == "true" ]; then
cat ${__COVERAGE_PATH}"/coverage.info" | codacy-coverage --debug
fi

#####################################################################
### Log top 20 file paths to be able see paths format from travis ###
Expand Down
41 changes: 28 additions & 13 deletions bin/test/preinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ source $(dirname $0)/_head.sh
####################################################
### Install dependencies globally if don't exist ###
####################################################
(npm list -g babel-cli --depth=0 || npm install -g babel-cli) &&\
(npm list -g babel-polyfill --depth=0 || npm install -g babel-polyfill) &&\
(npm list -g babel-preset-es2015 --depth=0 || npm install -g babel-preset-es2015) &&\
(npm list -g deepify@$(npm show deepify version) --depth=0 || npm install -g deepify) &&\
(npm list -g jspm --depth=0 || npm install -g [email protected]) &&\
(npm list -g browserify --depth=0 || npm install -g [email protected]) &&\
(npm list -g jscs --depth=0 || npm install -g [email protected]) &&\
(npm list -g mocha --depth=0 || npm install -g mocha@2.3.x) &&\
(npm list -g mocha --depth=0 || npm install -g mocha@2.4.x) &&\
(npm list -g codacy-coverage --depth=0 || npm install -g [email protected]) &&\
(npm list -g chai --depth=0 || npm install -g [email protected]) &&\
(npm list -g jasmine-core --depth=0 || npm install -g [email protected]) &&\
(npm list -g istanbul --depth=0 || npm install -g istanbul@0.3.x) &&\
(npm list -g istanbul@^1.0.0-alpha --depth=0 || npm install -g istanbul@^1.0.0-alpha) &&\
(npm list -g istanbul-combine --depth=0 || npm install -g [email protected]) &&\
(npm list -g karma --depth=0 || npm install -g [email protected]) &&\
(npm list -g karma-jspm --depth=0 || npm install -g [email protected]) &&\
(npm list -g karma-jasmine --depth=0 || npm install -g [email protected]) &&\
(npm list -g karma-babel-preprocessor --depth=0 || npm install -g [email protected]) &&\
(npm list -g karma-coverage@douglasduteil/karma-coverage#next --depth=0 || npm install -g karma-coverage@douglasduteil/karma-coverage#next) &&\
(npm list -g karma-coverage@1.0.x --depth=0 || npm install -g karma-coverage@1.0.x) &&\
(npm list -g karma-verbose-reporter --depth=0 || npm install -g [email protected]) &&\
(npm list -g karma-phantomjs-launcher --depth=0 || npm install -g [email protected]) &&\
(npm list -g karma-ng-html2js-preprocessor --depth=0 || npm install -g [email protected]) &&\
Expand Down Expand Up @@ -57,8 +60,9 @@ if [ "${__E2E_WITH_PUBLIC_REPO}" = "${E2E_TESTING}" ] || [ "${__E2E_WITH_PRIVATE
###############################################################
### Install locally, protractor doesn't find babel globally ###
###############################################################
(if [ ! -d "node_modules/babel-cli" ]; then npm install babel-cli; fi) &&\
(if [ ! -d "node_modules/babel-preset-es2015" ]; then npm install babel-preset-es2015; fi) &&\
(npm list -g babel-register --depth=0 || npm install -g babel-register) &&\
(if [ ! -d "node_modules/babel-cli" ]; then npm link babel-cli; fi) &&\
(if [ ! -d "node_modules/babel-preset-es2015" ]; then npm link babel-preset-es2015; fi) &&\
(if [ ! -d "node_modules/babel-plugin-add-module-exports" ]; then npm install babel-plugin-add-module-exports; fi) &&\
(if [ ! -d "node_modules/jasmine2-custom-message" ]; then npm install [email protected]; fi) &&\
(if [ ! -d "node_modules/jasmine-utils" ]; then npm install [email protected]; fi)
Expand All @@ -85,14 +89,25 @@ if [ "$TRAVIS" == "true" ]; then

export TRAVIS_COMMIT_MESSAGE=${TRAVIS_COMMIT_MESSAGES[1]}

TRAVIS_FROM_BRANCH="travis_from_branch"
git branch $TRAVIS_FROM_BRANCH
git checkout $TRAVIS_FROM_BRANCH
git fetch origin $TRAVIS_BRANCH
git checkout -qf FETCH_HEAD
git branch $TRAVIS_BRANCH
git checkout $TRAVIS_BRANCH
git checkout $TRAVIS_FROM_BRANCH
###########################
### Case for merging PR ###
###########################
if [ -n "$(git show-ref refs/heads/${TRAVIS_BRANCH})" ]; then
export PR_MERGE=true
echo "branch ${TRAVIS_BRANCH} exists!"
else
TRAVIS_FROM_BRANCH="travis_from_branch"
git branch $TRAVIS_FROM_BRANCH
git checkout $TRAVIS_FROM_BRANCH
git fetch origin $TRAVIS_BRANCH
git checkout -qf FETCH_HEAD
git branch $TRAVIS_BRANCH
git checkout $TRAVIS_BRANCH
git checkout $TRAVIS_FROM_BRANCH
fi

else
export TRAVIS_COMMIT_MESSAGE=$(git log -1 --pretty=%s)
fi

############################################################################################
Expand Down
2 changes: 1 addition & 1 deletion bin/test/protractor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Created by vcernomschi on 10/06/2015
#

source $(dirname $0)/../_head.sh
source $(dirname $0)/_head.sh

############################################################
### Initial protractor && support backward compatibility ###
Expand Down
7 changes: 0 additions & 7 deletions src/deep-hello-world/tests/backend/node-bin/install.sh

This file was deleted.

24 changes: 0 additions & 24 deletions src/deep-hello-world/tests/backend/node-bin/postinstall.sh

This file was deleted.

13 changes: 0 additions & 13 deletions src/deep-hello-world/tests/backend/node-bin/test.sh

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"identifier": "deep-hello-world",
"name": "deep-hello-world",
"identifier": "deep-helloworld",
"name": "deep-helloworld",
"description": "Example microservice that does hello world",
"version": "0.0.1",
"frontendEngine": ["vanilla"],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
xhttp.send();
}

loadAsset('@deep-hello-world:view/hello.html', function(plainHtml) {
loadAsset('@deep-helloworld:view/hello.html', function(plainHtml) {
var body = document.body;
body.innerHTML = plainHtml;

Expand All @@ -32,7 +32,7 @@

var payload = {Name: nameInput.value};
var checkedResource = body.querySelector('input[name="resource"]:checked');
var resourceIdentifier = '@deep-hello-world:say-hello:create-' + checkedResource.value;
var resourceIdentifier = '@deep-helloworld:say-hello:create-' + checkedResource.value;

security.anonymousLogin(function() {
resource.get(resourceIdentifier).request(payload).send(function(response) {
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/deep-helloworld/tests/backend/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"es2015"
]
}
4 changes: 4 additions & 0 deletions src/deep-helloworld/tests/backend/.istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
instrumentation:
root: ./../../backend/src
extensions:
- .js
13 changes: 13 additions & 0 deletions src/deep-helloworld/tests/backend/node-bin/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

npm link chai &&\
npm link aws-sdk &&\
npm link node-dir &&\
npm link deepify &&\
npm link babel-preset-es2015 &&\

############################################
#TODO: TEMPORARY FIX FOR NODE MORE THAN v5 #
############################################
(npm list -g deep-framework --depth=0 || npm install deep-framework -g babel-cli) &&\
npm link deep-framework
Loading

0 comments on commit c31b43b

Please sign in to comment.