Skip to content

Commit

Permalink
Merge pull request #2596 from pascalgrimaud/travis-add-from-scratch-a…
Browse files Browse the repository at this point in the history
…nd-cucumber

Travis improvements : add from scratch and cucumber tests
  • Loading branch information
jdubois committed Jan 10, 2016
2 parents bedfcc5 + da4e945 commit 5495ad1
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 75 deletions.
51 changes: 26 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,44 @@ services:
- docker
language: node_js
node_js:
- "4.2.1"
- "4.2.4"
jdk:
- oraclejdk8
env:
global:
- JHIPSTER_MVN_DEP=1
- RUNTASK=1
- GRUNT=1
- PROTRACTOR=0
- JHIPSTER_TRAVIS=$TRAVIS_BUILD_DIR/travis
- JHIPSTER_INSTALL=$JHIPSTER_TRAVIS/install
- JHIPSTER_SAMPLES=$JHIPSTER_TRAVIS/samples
- JHIPSTER_SCRIPTS=$JHIPSTER_TRAVIS/scripts
- JHIPSTER_NODE_CACHE=1
- PROFILE=dev
- RUN_APP=1
- GRUNT=1
- PROTRACTOR=0
- JHIPSTER_TRAVIS=$TRAVIS_BUILD_DIR/travis
- JHIPSTER_INSTALL=$JHIPSTER_TRAVIS/install
- JHIPSTER_SAMPLES=$JHIPSTER_TRAVIS/samples
- JHIPSTER_SCRIPTS=$JHIPSTER_TRAVIS/scripts
matrix:
- PROFILE=dev JHIPSTER=app-gradle RUNTASK=0
- PROFILE=dev JHIPSTER=app-gulp GRUNT=0
- PROFILE=dev JHIPSTER=app-cassandra
- PROFILE=dev JHIPSTER=app-default
- PROFILE=dev JHIPSTER=app-hazelcast
- PROFILE=dev JHIPSTER=app-mongodb
- PROFILE=dev JHIPSTER=app-websocket PROTRACTOR=1
- PROFILE=dev JHIPSTER=app-noi18n
- PROFILE=dev JHIPSTER=app-oauth2
- PROFILE=dev JHIPSTER=app-xauth
- PROFILE=prod JHIPSTER=app-mysql
- PROFILE=prod JHIPSTER=app-psql-es
- PROFILE=dev JHIPSTER=app-social
- JHIPSTER=app-from-scratch JHIPSTER_NODE_CACHE=0 RUN_APP=0
- JHIPSTER=app-gradle RUN_APP=0
- JHIPSTER=app-gulp GRUNT=0
- JHIPSTER=app-cassandra
- JHIPSTER=app-default
- JHIPSTER=app-hazelcast-cucumber
- JHIPSTER=app-mongodb
- JHIPSTER=app-websocket PROTRACTOR=1
- JHIPSTER=app-noi18n
- JHIPSTER=app-oauth2
- JHIPSTER=app-xauth
- JHIPSTER=app-mysql PROFILE=prod
- JHIPSTER=app-psql-es PROFILE=prod
- JHIPSTER=app-social
before_install:
- sudo service docker restart
- sudo /etc/init.d/postgresql stop
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
install:
- $JHIPSTER_INSTALL/01-install-docker-compose.sh
- $JHIPSTER_INSTALL/02-install-jhipster-stack.sh
- $JHIPSTER_INSTALL/03-downloadDep.sh
# - $JHIPSTER_INSTALL/04-checkVersion.sh
# - $JHIPSTER_INSTALL/03-checkVersion.sh
- $JHIPSTER_INSTALL/04-cache.sh
script:
- $JHIPSTER_SCRIPTS/01-generate-project.sh
- $JHIPSTER_SCRIPTS/02-generate-entities.sh
Expand Down
File renamed without changes.
28 changes: 0 additions & 28 deletions travis/install/03-downloadDep.sh

This file was deleted.

17 changes: 17 additions & 0 deletions travis/install/04-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -ev
#-------------------------------------------------------------------------------
# Use jhipster-travis-build that contain .m2 and node_modules
#-------------------------------------------------------------------------------
cd $TRAVIS_BUILD_DIR/
git clone https://github.com/jhipster/jhipster-travis-build.git
if [ $JHIPSTER != 'app-gradle' ]; then
rm -Rf $HOME/.m2/repository/
mv $TRAVIS_BUILD_DIR/jhipster-travis-build/repository $HOME/.m2/
ls -al $HOME/.m2/
ls -al $HOME/.m2/repository/
fi
if [ $JHIPSTER_NODE_CACHE == 1 ]; then
mv $TRAVIS_BUILD_DIR/jhipster-travis-build/node_modules/ $JHIPSTER_SAMPLES/$JHIPSTER/
ls -al $JHIPSTER_SAMPLES/$JHIPSTER/
fi
93 changes: 93 additions & 0 deletions travis/samples/app-from-scratch/.jhipster/BankAccount.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"relationships": [
{
"relationshipId": 1,
"relationshipName": "user",
"otherEntityName": "user",
"relationshipType": "many-to-one",
"otherEntityField": "login"
},
{
"relationshipId": 2,
"relationshipName": "operation",
"otherEntityName": "operation",
"relationshipType": "one-to-many",
"otherEntityRelationshipName": "bankAccount"
}
],
"fields": [
{
"fieldId": 1,
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
},
{
"fieldId": 2,
"fieldName": "bankNumber",
"fieldType": "Integer"
},
{
"fieldId": 3,
"fieldName": "agencyNumber",
"fieldType": "Long"
},
{
"fieldId": 4,
"fieldName": "lastOperationDuration",
"fieldType": "Float"
},
{
"fieldId": 5,
"fieldName": "meanOperationDuration",
"fieldType": "Double"
},
{
"fieldId": 6,
"fieldName": "balance",
"fieldType": "BigDecimal",
"fieldValidateRules": [
"required"
]
},
{
"fieldId": 7,
"fieldName": "openingDay",
"fieldType": "LocalDate"
},
{
"fieldId": 8,
"fieldName": "lastOperationDate",
"fieldType": "ZonedDateTime"
},
{
"fieldId": 9,
"fieldName": "isActive",
"fieldType": "Boolean"
},
{
"fieldId": 10,
"fieldName": "accountType",
"fieldType": "BankAccountType",
"fieldValues": "CHECKING,SAVINGS,LOAN"
},
{
"fieldId": 11,
"fieldName": "attachment",
"fieldType": "byte[]",
"fieldTypeBlobContent": "any"
},
{
"fieldId": 12,
"fieldName": "description",
"fieldType": "byte[]",
"fieldTypeBlobContent": "text"
}
],
"changelogDate": "20150805124838",
"dto": "no",
"service": "no",
"pagination": "no"
}
46 changes: 46 additions & 0 deletions travis/samples/app-from-scratch/.jhipster/Operation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"relationships": [
{
"relationshipId": 1,
"relationshipName": "bankAccount",
"otherEntityName": "bankAccount",
"relationshipType": "many-to-one",
"otherEntityField": "name"
},
{
"relationshipId": 2,
"relationshipName": "label",
"otherEntityName": "label",
"relationshipType": "many-to-many",
"otherEntityField": "label",
"ownerSide": true
}
],
"fields": [
{
"fieldId": 1,
"fieldName": "date",
"fieldType": "ZonedDateTime",
"fieldValidateRules": [
"required"
]
},
{
"fieldId": 2,
"fieldName": "description",
"fieldType": "String"
},
{
"fieldId": 3,
"fieldName": "amount",
"fieldType": "BigDecimal",
"fieldValidateRules": [
"required"
]
}
],
"changelogDate": "20150805125054",
"dto": "no",
"service": "no",
"pagination": "no"
}
24 changes: 24 additions & 0 deletions travis/samples/app-from-scratch/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"generator-jhipster": {
"baseName": "sampleFromScratch",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"authenticationType": "session",
"hibernateCache": "ehcache",
"clusteredHttpSession": "no",
"websocket": "no",
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "no",
"useSass": false,
"buildTool": "maven",
"frontendBuilder": "grunt",
"enableTranslation": true,
"enableSocialSignIn": false,
"rememberMeKey": "f19f0827c622eb9b81f5227a869ccd44932d78eb",
"testFrameworks": [
"gatling"
]
}
}
28 changes: 28 additions & 0 deletions travis/samples/app-hazelcast-cucumber/.jhipster/Label.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"relationships": [
{
"relationshipId": 1,
"relationshipName": "operation",
"otherEntityName": "operation",
"relationshipType": "many-to-many",
"ownerSide": false,
"otherEntityRelationshipName": "label"
}
],
"fields": [
{
"fieldId": 1,
"fieldName": "label",
"fieldType": "String",
"fieldValidateRules": [
"required",
"minlength"
],
"fieldValidateRulesMinlength": "3"
}
],
"changelogDate": "20150805124936",
"dto": "no",
"service": "no",
"pagination": "no"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"generator-jhipster": {
"baseName": "sampleHazelcast",
"baseName": "sampleHazelcastCucumber",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"authenticationType": "session",
Expand All @@ -18,7 +18,8 @@
"enableSocialSignIn": false,
"rememberMeKey": "c6d1cbd204e019098d31fef0224d3462cb89f22d",
"testFrameworks": [
"gatling"
"gatling",
"cucumber"
]
}
}
3 changes: 3 additions & 0 deletions travis/scripts/01-generate-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ set -ev
mv -f $JHIPSTER_SAMPLES/$JHIPSTER $HOME/
cd $HOME/$JHIPSTER
if [ $GRUNT == 1 ]; then
rm -Rf $HOME/$JHIPSTER/node_modules/.bin/*gulp*
rm -Rf $HOME/$JHIPSTER/node_modules/*gulp*
else
rm -Rf $HOME/$JHIPSTER/node_modules/.bin/*grunt*
rm -Rf $HOME/$JHIPSTER/node_modules/*grunt*
fi
npm link generator-jhipster
yo jhipster --force --no-insight
ls -al $HOME/$JHIPSTER
ls -al $HOME/$JHIPSTER/node_modules/
ls -al $HOME/$JHIPSTER/node_modules/generator-jhipster/
ls -al $HOME/$JHIPSTER/node_modules/generator-jhipster/entity/
34 changes: 14 additions & 20 deletions travis/scripts/05-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,24 @@ set -ev
# Start the application
#-------------------------------------------------------------------------------
cd $HOME/$JHIPSTER
if [ $RUNTASK == 1 ]; then
if [ $RUN_APP == 1 ]; then
if [ $JHIPSTER != "app-gradle" ]; then
if [ $JHIPSTER == 'app-cassandra' ]; then
docker exec -it samplecassandra-dev-cassandra init
fi
mvn -P$PROFILE &
if [ $PROFILE == "dev" ]; then
sleep 60
else
sleep 120
fi
# curl --retry 10 --retry-delay 5 -I http://localhost:8080/ | grep "HTTP/1.1 200 OK"
# fuser -k 8080/tcp ; sleep 10
mvn package -DskipTests=true -P$PROFILE
mv target/*.war target/app.war
java -jar target/app.war --spring.profiles.active=$PROFILE &
else
./gradlew -P$PROFILE &
sleep 300
# curl --retry 10 --retry-delay 5 -I http://localhost:8080/ | grep "HTTP/1.1 200 OK"
# fuser -k 8080/tcp ; sleep 10
./gradlew bootRepackage -P$PROFILE -x test
mv build/libs/*.war build/libs/app.war
java -jar build/libs/app.war --spring.profiles.active=$PROFILE &
fi
sleep 40
#-------------------------------------------------------------------------------
# Launch protractor tests
#-------------------------------------------------------------------------------
if [ $PROTRACTOR == 1 ]; then
grunt itest
fi
fi

#-------------------------------------------------------------------------------
# Launch protractor tests
#-------------------------------------------------------------------------------
if [ $PROTRACTOR == 1 ]; then
grunt itest
fi

0 comments on commit 5495ad1

Please sign in to comment.