Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Add Continuum CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Flibio committed Jul 31, 2016
1 parent bab266b commit 59fdf02
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: java
jdk:
- oraclejdk8
notifications:
email: false
install:
- 'chmod +x ./gradlew'
script: gradle shadowJar
after_success:
- 'chmod +x ./continuum.sh'
- './continuum.sh'
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ targetCompatibility = '1.8'

group 'io.github.flibio'

defaultTasks 'licenseFormat', 'clean', 'build'
defaultTasks 'licenseFormat', 'shadowJar'

repositories {
mavenCentral()
Expand Down
42 changes: 42 additions & 0 deletions continuum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

# Configuration #
TARGET="http://continuum.flibio.net/api/"
PROJECT="EconomyLite"
BRANCH="develop"
UPLOAD="${TRAVIS_BUILD_DIR}/build/libs/*.jar"

# Make sure the branch is correct #

if [[ "${TRAVIS_BRANCH}" != "${BRANCH}" ]]; then
echo "Incorrect branch, stopping script!"
exit;
fi

# Install JQ #

wget http://stedolan.github.io/jq/download/linux64/jq
chmod +x ./jq
sudo cp /usr/bin

# Create a new Continuum build #
echo $(curl -v -X POST -d "project=${PROJECT}&commit=${TRAVIS_COMMIT}&job=${TRAVIS_BUILD_ID}" -u continuum:${CONTINUUM_TOKEN} "${TARGET}newbuild.php") >> response.json
BUILD=$(jq '.build' response.json | tr -d '"')
STATUS=$(jq '.status' response.json | tr -d '"')

echo "New build status: ${STATUS}"
echo "New build number: ${BUILD}"

# Check if the build was created successfully #
if [[ ${BUILD} -gt 0 ]]; then
echo "Created build ${BUILD}!"

# Upload the files #
for f in $UPLOAD
do
echo "Attempting to add artifact ${f}"
echo $(curl -v -X POST --form "file=@${f};filename=${f}" --form "project=${PROJECT}" --form "build=${BUILD}" -u continuum:${CONTINUUM_TOKEN} "${TARGET}upload.php")
done
else
echo "Failed to create a build!"
fi

0 comments on commit 59fdf02

Please sign in to comment.