This is an automated email from the ASF dual-hosted git repository. ikamga pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/fineract-cn-notifications.git
commit f3deeaab97b23be491a4cf012397a369d5aa1ce6 Author: Ebenezer Graham <[email protected]> AuthorDate: Thu May 9 17:24:06 2019 +0400 Added travis configurations --- .dockerignore | 17 +++++++++++ .gitignore | 8 +++-- .travis.yml | 30 +++++++++++++++++++ Dockerfile | 31 ++++++++++++++++++++ NOTICE.txt | 4 +-- README.md | 2 +- api/build.gradle | 4 +-- build.gradle | 8 +++++ component-test/build.gradle | 4 ++- local.properties | 9 ------ service/build.gradle | 6 ++-- shared.gradle | 22 +++++++++++++- travis.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 196 insertions(+), 20 deletions(-) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8d88495 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +api/ +component-test/ +gradle/ +gradlew.bat +LICENSE +README.md +settings.gradle +build.gradle +docs/ +gradlew +HEADER +NOTICE.txt +service/ +.git/ +.gradle/ +.gitignore +shared.gradle \ No newline at end of file diff --git a/.gitignore b/.gitignore index f295929..f74c5e4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,12 @@ .idea build/ target/ -**/out/ -**/build/ +logs +**/out +**/build +**/logs +**/target +local.properties # Ignore Gradle GUI config gradle-app.setting diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..06d4b4d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +language: java +sudo: false +jdk: +- openjdk8 +install: true +script: "./travis.sh" +env: + global: + - BUILD_SNAPSHOTS_BRANCH=develop + - ARTIFACTORY_URL=https://mifos.jfrog.io/mifos + - ARTIFACTORY_USER=travis-ci + - secure: "E5IyImya7x5cHLB1vGLGIJUC1M+7RxKZivb5iUM+RR/xW39/7b4Qd3JeX4yBUeiPjf9lNMMxcGVyqI/4htT95++WCNc0u6OoxwGgxQEB9JHE8OWecaYgK4uLO7+651XF4DNbSiH3NVmc2b8Q0c0jBlu3MHAeEUIQ6BOiTXSsqnewtWAW0XETBooNmo2nTqZyKvzez0698oJuuYfZeFbqm8wJ9rIwtptyJluRzqcTlzw1cH/CvcIskLDmITVqbuZxAW59j1BqUnZNQpuOFZ692iqntdxq78CxliCG1MEYy4zWY8xcIWNVp28OKkMULXdi+V80oZXY4TyTwZfH6e2oZFz6/X9GpNNR6EwaHV0tT3wZi2NrkoBokD8bEBxQubIgxDCaDAFG9VMByC+++nwm0GJzerKBV4CpNSy/93XLrFAQ8+lOVauVtkVHuzFBWleLLQYcBGAXRz/C/UF4/m0m014jvD7vT [...] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ef2e091 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +FROM openjdk:8-jdk-alpine + +ARG notification_port=2033 + +ENV server.max-http-header-size=16384 \ + cassandra.clusterName="Test Cluster" \ + server.port=$notification_port \ + system.initialclientid=service-runner + +WORKDIR /tmp +COPY notification-service-boot-0.1.0-BUILD-SNAPSHOT.jar . + +CMD ["java", "-jar", "customer-service-boot-0.1.0-BUILD-SNAPSHOT.jar"] diff --git a/NOTICE.txt b/NOTICE.txt index 41f69b8..6406f7f 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Fineract CN Notification -Copyright [2017-2018] The Apache Software Foundation +Copyright [2017-2019] The Apache Software Foundation This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file +The Apache Software Foundation (http://www.apache.org/). diff --git a/README.md b/README.md index e94a392..7528145 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Apache Fineract CN Notification +# Apache Fineract CN Notification [](https://travis-ci.com/apache/fineract-cn-notification) This mircroservice contains all the functionalities for SMS and Email Notification diff --git a/api/build.gradle b/api/build.gradle index 5b9924a..f109634 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -28,6 +28,7 @@ buildscript { plugins { id "com.github.hierynomus.license" version "0.13.1" id("org.nosphere.apache.rat") version "0.3.1" + id "com.jfrog.artifactory" version "4.9.5" } apply from: '../shared.gradle' @@ -51,7 +52,6 @@ publishing { from components.java groupId project.group artifactId project.name - version project.version - } + version project.findProperty('externalVersion') ?: project.version } } } diff --git a/build.gradle b/build.gradle index ca2370a..aa35679 100644 --- a/build.gradle +++ b/build.gradle @@ -39,6 +39,14 @@ task publishToMavenLocal { dependsOn publishComponentTestToMavenLocal } +task artifactoryPublish { + group 'all' + dependsOn publishToMavenLocal + dependsOn gradle.includedBuild('api').task(':artifactoryPublish') + dependsOn gradle.includedBuild('service').task(':artifactoryPublish') + dependsOn gradle.includedBuild('component-test').task(':artifactoryPublish') +} + task prepareForTest { group 'all' dependsOn publishToMavenLocal diff --git a/component-test/build.gradle b/component-test/build.gradle index 3998d6c..c0aaace 100644 --- a/component-test/build.gradle +++ b/component-test/build.gradle @@ -34,6 +34,7 @@ buildscript { plugins { id "com.github.hierynomus.license" version "0.13.1" id("org.nosphere.apache.rat") version "0.3.1" + id "com.jfrog.artifactory" version "4.9.5" } apply from: '../shared.gradle' apply plugin: 'org.asciidoctor.convert' @@ -68,8 +69,9 @@ asciidoctor { publishing { publications { - mavenJava(MavenPublication) { + componentTest(MavenPublication) { from components.java + version project.findProperty('externalVersion') ?: project.version } } } diff --git a/local.properties b/local.properties deleted file mode 100644 index 3fea7c3..0000000 --- a/local.properties +++ /dev/null @@ -1,9 +0,0 @@ -## This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# Location of the SDK. This is only used by Gradle. -# For customization when using a Version Control System, please read the -# header note. -#Sat Dec 01 15:14:19 MUT 2018 -ndk.dir=/home/ebenezergraham/Android/Sdk/ndk-bundle -sdk.dir=/home/ebenezergraham/Android/Sdk diff --git a/service/build.gradle b/service/build.gradle index 3bf06c1..6b8513e 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -32,6 +32,8 @@ buildscript { plugins { id "com.github.hierynomus.license" version "0.13.1" id("org.nosphere.apache.rat") version "0.3.1" + id "com.jfrog.artifactory" version "4.9.5" + } apply from: '../shared.gradle' @@ -77,14 +79,14 @@ publishing { from components.java groupId project.group artifactId project.name - version project.version + version project.findProperty('externalVersion') ?: project.version } bootService(MavenPublication) { // "boot" jar artifact ("$buildDir/libs/$project.name-$version-boot.jar") groupId project.group artifactId ("$project.name-boot") - version project.version + version project.findProperty('externalVersion') ?: project.version } } } diff --git a/shared.gradle b/shared.gradle index 426ccf2..c270323 100644 --- a/shared.gradle +++ b/shared.gradle @@ -55,6 +55,8 @@ tasks.withType(JavaCompile) { repositories { jcenter() mavenLocal() + maven { url 'https://mifos.jfrog.io/mifos/libs-snapshot/' } + } dependencyManagement { @@ -85,6 +87,22 @@ jar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } +artifactory { + contextUrl = System.getenv("ARTIFACTORY_URL") + publish { + repository { + repoKey = project.findProperty('artifactoryRepoKey') + username = System.getenv("ARTIFACTORY_USER") + password = System.getenv("ARTIFACTORY_PASSWORD") + } + + defaults { + publications ('api', 'componentTest', 'service', 'bootService') + } + } +} +artifactoryPublish.dependsOn('clean','publishToMavenLocal') + license { header rootProject.file('../HEADER') strictCheck true @@ -105,7 +123,9 @@ rat { "**/build/**", "gradlew", "gradlew.bat", - "README.md" + "README.md", + "**/.dockerignore/**" + ] } diff --git a/travis.sh b/travis.sh new file mode 100755 index 0000000..03a75ee --- /dev/null +++ b/travis.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Documentation: https://cwiki.apache.org/confluence/display/FINERACT/Fineract-CN+Artifactory + +#Exit immediately if a command exits with a non-zero status. +set -e +EXIT_STATUS=0 + +# Builds and Publishes a SNAPSHOT +function build_snapshot() { + echo -e "Building and publishing a snapshot out of branch [$TRAVIS_BRANCH]" + ./gradlew -PartifactoryRepoKey=libs-snapshot-local -DbuildInfo.build.number=${TRAVIS_COMMIT::7} artifactoryPublish --stacktrace || EXIT_STATUS=$? +} + +# Builds a Pull Request +function build_pullrequest() { + echo -e "Building pull request #$TRAVIS_PULL_REQUEST of branch [$TRAVIS_BRANCH]. Won't publish anything to Artifactory." + ./gradlew publishToMavenLocal rat || EXIT_STATUS=$? +} + +# For other branches we need to add branch name as prefix +function build_otherbranch() { + echo -e "Building a snapshot out of branch [$TRAVIS_BRANCH] and publishing it with prefix '${TRAVIS_BRANCH}-SNAPSHOT'" + ./gradlew -PartifactoryRepoKey=libs-snapshot-local -DbuildInfo.build.number=${TRAVIS_COMMIT::7} -PexternalVersion=${TRAVIS_BRANCH}-SNAPSHOT artifactoryPublish --stacktrace || EXIT_STATUS=$? +} + +# Builds and Publishes a Tag +function build_tag() { + echo -e "Building tag [$TRAVIS_TAG] and publishing it as a release" + ./gradlew -PartifactoryRepoKey=libs-release-local -PexternalVersion=$TRAVIS_TAG artifactoryPublish --stacktrace || EXIT_STATUS=$? + +} + +echo -e "TRAVIS_BRANCH=$TRAVIS_BRANCH" +echo -e "TRAVIS_TAG=$TRAVIS_TAG" +echo -e "TRAVIS_COMMIT=${TRAVIS_COMMIT::7}" +echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" + +# Build Logic +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + build_pullrequest +elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ] ; then + build_otherbranch +elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "$BUILD_SNAPSHOTS_BRANCH" ] && [ "$TRAVIS_TAG" == "" ] ; then + build_snapshot +elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then + build_tag +else + echo -e "WARN: Unexpected env variable values => Branch [$TRAVIS_BRANCH], Tag [$TRAVIS_TAG], Pull Request [#$TRAVIS_PULL_REQUEST]" + ./gradlew clean build +fi + +exit ${EXIT_STATUS}
