This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from aasaru/jfrog
FINCN-148 build with travis-ci.com and upload artifacts to Artifactory
- Loading branch information
Showing
4 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: "g9WOu7V6C3mB18m8RQ78RYtQug1Neghtd1NuQ51CjUBAmBFVvOZ9U4ZHaY2OuluAwSisqSzi4Uh2/zw984dQ0LZThTKvmdTAT3SYI2Geb0ERsu2dExZyfznuF+OQ5JR4zjibr4PKzTW3UIJh5GC0M9LWh4Hm3Ut9HnDW8JxdzIeJpQj7MRCX7BCDq2OkP/1WLoVFxBFjIaRk9TpvvEv+BLmQ6s1YS4z5tTckdgvgu98lP6h5PKL/Bk8a+/ZUllMoACvuaRV/Hanhq4K0K2j0o6CFLcopkWTyEFjP3l9BHS0ctEUJeW1iZC+4cSeQSIEtVt5fqiTk+dDTINw+5J1gsN+2V+V1TNsmR/B0JC/cvWK6q4R5cDgAyZDg8rraovDP6XnM4mD3KotRVTdP6622Gr9kIQD0OOMNhkGJvtRIwHvniVUkNGDVEANrzGn107hvKBikGgptDJC8q/ILYv+Wc64d8wBThZY0d8kVgbMgq4jQuaBkuINnaqlcMH4dBrdtOJ23Km+ce61K/lnQkEaNRt28PvF5W1g7baccDXSkHIz+xS11JdRVuVwr42VMIqvtXnLVFWvuHSnkwB/7JwFc0dtn5uYEOiCZR7yS5qOr8Pfcv+LPitmwEhfe6Na4ePxzGi+03e/Tp0iI1bWSbmSLqqchvwq7qVgK3r9DxZOVnhQ=" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |