Merge pull request #8 from aasaru/artifactory
FINCN-148 build with travis-ci.com and upload artifacts to JFrog Artifactory
diff --git a/.travis.yml b/.travis.yml
index 5cc5893..84f8ab4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,7 +16,15 @@
# specific language governing permissions and limitations
# under the License.
#
-
language: java
+sudo: false
jdk:
- - oraclejdk8
\ No newline at end of file
+- openjdk8
+install: true
+script: "./travis.sh"
+env:
+ global:
+ - BUILD_SNAPSHOTS_BRANCH=develop
+ - ARTIFACTORY_URL=https://mifos.jfrog.io/mifos
+ - ARTIFACTORY_USER=travis-ci
+ - secure: "VIf6ZOTsrQQnbWgXLK0bdsWkGxTeAcpUgZZ7vsCZYMVbSh2oK03UgLjGkuokP6KODoOubQhFSjRMr0ncypzFr2d/O00oXamJQ587BzCcHRIjI1YgQUpVkj4ZRsvP7d0YEr+fKift/H46Bk7lQl1L+gswtyR/mB2FcZqhjOUs9+6raM4EpBS+E3ImQ20UotsBldqqoYMafgbhqmT+8qqlv+GcRSeMIw0+5uFSCdEhMYOVqb/dbQubLXVAFVGmVNyswNKu//j0nRUE291xLru9hG6iNoqCvlKfgvO4R9Lq1sc0zrV/ZoTznVxUdUg+4/EYMnb2Xq9pDYqxtVPgvf3o8qqGpFwerlQKKjU+I6BSc6BM2+t1IorooXCp2753bU48eeHVzDtygq+GVClsTvUnQud1L2gWkbefQjxWrOtO4qHtX9O06HgL6o0ZDRXDkpJD7ToUpTC/wN1c/HyyLdVUOp1dMV06D2tvch99zXz5FqzItKXPdWRlYgGuKEsjZXV8LIlfG0WAwbZu5P9s9liVXoyUOxL87+HZv6hsMPHI1i5o2rk4KqFLPeHN+7Bjz0oVv/MR924+JkysQjs3JayfcjIfnVth+UtRbc1FLztnKeiJGimGGMhN+GIW1aEFNBy9tobE55PZ7kjZFR+fgvuFUDo2KLAVhMYkwsWgSE5aGao="
diff --git a/README.md b/README.md
index 0f06399..0d097d2 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Apache Fineract CN Lang
+# Apache Fineract CN Lang [![Build Status](https://api.travis-ci.com/apache/fineract-cn-lang.svg?branch=develop)](https://travis-ci.com/apache/fineract-cn-lang)
## Abstract
Apache Fineract CN is an application framework for digital financial services, a system to support nationwide and cross-national financial transactions and help to level and speed the creation of an inclusive, interconnected digital economy for every nation in the world.
diff --git a/build.gradle b/build.gradle
index 3863232..b47a886 100644
--- a/build.gradle
+++ b/build.gradle
@@ -28,8 +28,8 @@
plugins {
id 'com.github.hierynomus.license' version '0.13.1'
- id "com.jfrog.bintray" version "1.7.3"
id("org.nosphere.apache.rat") version "0.3.1"
+ id "com.jfrog.artifactory" version "4.9.5"
}
apply plugin: 'java'
@@ -37,7 +37,6 @@
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven-publish'
apply plugin: 'license'
-apply plugin: 'com.jfrog.bintray'
apply plugin: "org.ajoberstar.grgit"
ext {
@@ -91,11 +90,27 @@
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 ('langPublication')
+ }
+ }
+}
+artifactoryPublish.dependsOn('clean','publishToMavenLocal')
+
license {
header rootProject.file('HEADER')
strictCheck true
@@ -108,4 +123,4 @@
// List of exclude directives, defaults to ['**/.gradle/**']
excludes = [ ".idea/**", ".gradle/**", "gradle/**", "build/**", "gradlew", "gradlew.bat", "README.md" ]
-}
\ No newline at end of file
+}
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}