You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by aw...@apache.org on 2019/04/30 08:16:52 UTC

[fineract-cn-data-jpa] branch develop updated: FINCN-148 build with travis-ci.com and upload artifacts to Artifactory

This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-data-jpa.git


The following commit(s) were added to refs/heads/develop by this push:
     new a615162  FINCN-148 build with travis-ci.com and upload artifacts to Artifactory
     new c0a913a  Merge pull request #5 from aasaru/artifactory
a615162 is described below

commit a615162b1620e5b3498521813e45a0aae45a3114
Author: Juhan Aasaru <Ju...@nortal.com>
AuthorDate: Thu Apr 25 11:29:19 2019 +0300

    FINCN-148 build with travis-ci.com and upload artifacts to Artifactory
---
 .travis.yml  | 30 +++++++++++++++++++++++++
 README.md    |  4 ++--
 build.gradle | 20 ++++++++++++++++-
 travis.sh    | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 122 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2304eae
--- /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: "uIig/twxYGORS6BUbCRumLGwGhykeBygVI1BPqEOMd91tHt4GGkmkq2GufZoZnxb/d8+LO8TjzNoTcCwE2QWC74hapCOVEY7qylje1nfF2N1GJwNt5RLHIcUHvtnFCDn1F1uo8Af5wea5V8HN/w6e9vTTQRbB/5ORGKjCNFm74fsDABRRcFQQ0imhUd9sknFGVbHKzOhJA8wTzGz7TFvkJQaDw1is5p40i8g9gMDBNpJtMZ/9LGElDXqXdRQ3dH5KBcPp+oitFrl+cvR6Yx7alA8VIHwcHIIaPm0GZpJKzyUghhpYtIl1wznoXyg7rn0ynX8zE1w7YOtcEbPpDNYL8dHgNeblMGVmkfgpU34F8bENM5aUQoVVcw/x/lR45iKWJ2yuFF2gz34P4ko5vPb1CdUECqOR6paKSH3/v3uahDfNxl9xQqa7klRUcdasF55RLHv6wpFB2Zblop/BVomUMuBDX/Vs [...]
diff --git a/README.md b/README.md
index 50acb7d..bdf96da 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Apache Fineract CN data-jpa
+# Apache Fineract CN data-jpa [![Build Status](https://api.travis-ci.com/apache/fineract-cn-data-jpa.svg?branch=develop)](https://travis-ci.com/apache/fineract-cn-data-jpa)
 
 Data JPA provides easy access to tenant databases.
 
@@ -37,4 +37,4 @@ The versioning layout is {MAJOR}.{MINOR}.{PATCH}-{INDICATOR}[.{PATCH}]. Only mil
 1.3.5-RELEASE
 
 ## License
-See [LICENSE](LICENSE) file.
\ No newline at end of file
+See [LICENSE](LICENSE) file.
diff --git a/build.gradle b/build.gradle
index 7446e22..eb82ad0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -32,6 +32,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"
 }
 
 group 'org.apache.fineract.cn'
@@ -50,6 +51,7 @@ targetCompatibility = JavaVersion.VERSION_1_8
 repositories {
     jcenter()
     mavenLocal()
+    maven { url 'https://mifos.jfrog.io/mifos/libs-snapshot/' }
 }
 
 dependencyManagement {
@@ -79,11 +81,27 @@ publishing {
             from components.java
             groupId project.group
             artifactId project.name
-            version project.version
+            version project.findProperty('externalVersion') ?: project.version
         }
     }
 }
 
+artifactory {
+    contextUrl = System.getenv("ARTIFACTORY_URL")
+    publish {
+        repository {
+            repoKey = project.findProperty('artifactoryRepoKey')
+            username = System.getenv("ARTIFACTORY_USER")
+            password = System.getenv("ARTIFACTORY_PASSWORD")
+        }
+
+        defaults {
+            publications ('databaseConnector')
+        }
+    }
+}
+artifactoryPublish.dependsOn('clean','publishToMavenLocal')
+
 license {
     header rootProject.file('HEADER')
     strictCheck true
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}