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:27:17 UTC
[fineract-cn-teller] 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-teller.git
The following commit(s) were added to refs/heads/develop by this push:
new cd2ff66 FINCN-148 build with travis-ci.com and upload artifacts to Artifactory
new fdf8263 Merge pull request #11 from aasaru/artifactory
cd2ff66 is described below
commit cd2ff6654dcc16e02808f775dfd9515cd5591bed
Author: Juhan Aasaru <Ju...@nortal.com>
AuthorDate: Thu Apr 25 14:21:03 2019 +0300
FINCN-148 build with travis-ci.com and upload artifacts to Artifactory
---
.travis.yml | 30 +++++++++++++++++++
Dockerfile | 18 ++++++++++++
README.md | 2 +-
api/build.gradle | 3 +-
build.gradle | 8 +++++
component-test/build.gradle | 4 ++-
service/build.gradle | 5 ++--
shared.gradle | 18 ++++++++++++
travis.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 154 insertions(+), 5 deletions(-)
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1e3e808
--- /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: "aLY7gBftNrxCcWa2Zj+zUwpWxVH190qgxTP8bXgGxBwYAoUqa6soOVNb/VB5Q29kHoU+Cn0b2L32VzJkMXS9jFBYjivYDNyavWIOVOMP9q6+hcOyUjoP+9wnIzD7Y5uQwMdcKtTAoZOER20JQTuhBjVjNRU4oS6hXRg+dH4bX+XhzuhJBZhc6kScVHjUGX5NapYp9EEsECDGd8XUnV4Xf5OChzdR0uTVXGRKaBVN6zkqRSuZVhTuk/AwJ6NC2+Wspz9WLR9pNu+j7mGltgselVpA8T2rAD7GzzcNH43M20jF+pngkvq7OEobAwskj1nwZQ8SODvV0KOjj5cES6vyBEkrQ1q8BDi0aiwN+xqGW3cS8NhiI2EAzpU65Ia/gJEDOtxxshi2Td98MpU4ZTScwhtTyTDpSRhREEYdyWlsP6RHU5zfKu+1iGEtSo74ppsTQVQt3n/ElA09el5NDAC7+gfm/SZcY [...]
diff --git a/Dockerfile b/Dockerfile
index 9b7c253..b9f8933 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,3 +1,21 @@
+#
+# 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 teller_port=2028
diff --git a/README.md b/README.md
index 134376d..a05aca2 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Apache Fineract CN Teller
+# Apache Fineract CN Teller [![Build Status](https://api.travis-ci.com/apache/fineract-cn-teller.svg?branch=develop)](https://travis-ci.com/apache/fineract-cn-teller)
This project provides management and operational functionality for teller operation.
diff --git a/api/build.gradle b/api/build.gradle
index 5b9924a..a11f487 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,7 @@ 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 848847a..eeb68fb 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 543c2b4..c83d5dd 100644
--- a/component-test/build.gradle
+++ b/component-test/build.gradle
@@ -33,6 +33,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'
@@ -61,8 +62,9 @@ asciidoctor {
publishing {
publications {
- mavenJava(MavenPublication) {
+ componentTest(MavenPublication) {
from components.java
+ version project.findProperty('externalVersion') ?: project.version
}
}
}
diff --git a/service/build.gradle b/service/build.gradle
index 9a8f00c..58e9048 100644
--- a/service/build.gradle
+++ b/service/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"
}
apply from: '../shared.gradle'
@@ -74,14 +75,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 a287e8e..2f2d4ef 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -49,6 +49,7 @@ tasks.withType(JavaCompile) {
repositories {
jcenter()
mavenLocal()
+ maven { url 'https://mifos.jfrog.io/mifos/libs-snapshot/' }
}
dependencyManagement {
@@ -79,6 +80,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', 'service', 'bootService', 'componentTest')
+ }
+ }
+}
+artifactoryPublish.dependsOn('clean','publishToMavenLocal')
+
license {
header rootProject.file('../HEADER')
strictCheck true
@@ -93,6 +110,7 @@ license {
rat {
// List of exclude directives, defaults to ['**/.gradle/**']
excludes = [
+ "**/.dockerignore/**",
"**/.idea/**",
"**/.gradle/**",
"**/gradle/**",
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}