Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic builds publishing to http://ngb.opensource.epam.com/distr #10

Merged
merged 19 commits into from Jul 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion .travis.yml
Expand Up @@ -6,4 +6,15 @@ dist: trusty
install:
- pip install mkdocs
- pip install mkdocs-material
script: ./gradlew buildJar buildWar buildCli buildDoc && ./e2e/integration_tests.sh
script: ./gradlew buildJar buildWar buildCli buildDoc -PbuildNumber=${TRAVIS_JOB_NUMBER} && ./e2e/integration_tests.sh
deploy:
- provider: script
skip_cleanup: true
script: DEMO_PATH=${DEMO_PATH}/dev && ./publish.sh
on:
branch: develop
- provider: script
skip_cleanup: true
script: ./publish.sh
on:
branch: master
8 changes: 4 additions & 4 deletions build.gradle
Expand Up @@ -12,7 +12,7 @@ def buildNumber = hasProperty("buildNumber") ? buildNumber : ""
def profile = hasProperty("profile") ? profile : "release"

allprojects {
version = new Version(major: 2, minor: 5, patch: 0, build: buildNumber)
version = new Version(major: 2, minor: 5, patch: 0, build: buildNumber)
task printVersion {
doFirst {
println "Project version is $version"
Expand Down Expand Up @@ -97,7 +97,7 @@ task buildCli(type: GradleBuild) {
dir = "$rootDir/ngb-cli/catgenome"
doLast {
copy {
from "$cliBuilds/ngb-cli.tar"
from "$cliBuilds/ngb-cli.tar.gz"
into distDir
}
}
Expand All @@ -121,9 +121,9 @@ task buildDoc(type: Tar) {
dependsOn runMkdocs
from("$rootDir/docs/site") {
}
archiveName = "ngb-docs.tgz"
archiveName = "ngb-docs.tar.gz"
destinationDir file(distDir)
extension = 'tgz'
extension = 'tar.gz'
compression = Compression.GZIP
}

Expand Down
Binary file removed e2e/.gradle/3.3/taskArtifacts/taskArtifacts.lock
Binary file not shown.
12 changes: 6 additions & 6 deletions e2e/integration_tests.sh
Expand Up @@ -6,7 +6,7 @@ TEST_DATA_PATH="$(pwd)/e2e/cli/test_data"
TEST_DATA_RELATIVE_PATH="e2e/cli/test_data"
DIST_PATH="$(pwd)/dist"
JAR_PATH="${DIST_PATH}/catgenome.jar"
CLI_PATH="${DIST_PATH}/ngb-cli.tar"
CLI_PATH="${DIST_PATH}/ngb-cli.tar.gz"
CLI_BIN_PATH="${DIST_PATH}/ngb-cli/bin/ngb"
TEST_CASES_PATH="$(pwd)/e2e/cli/testcases.csv"

Expand All @@ -16,10 +16,10 @@ wget -r -nH -nd -np -R index.html* -P $TEST_DATA_PATH $TEST_DATA_URL
cp "$TEST_DATA_PATH/CantonS.09-28.trim.dm606.realign_X_2L.bam" "$TEST_DATA_PATH/CantonS.09-28.trim.dm606.realign_X_2L_2.bam"

# Unpack CLI distribution
tar -xf $CLI_PATH -C $DIST_PATH
tar -zxf $CLI_PATH -C $DIST_PATH

# Run NGB server
nohup java -jar ${JAR_PATH} &
nohup java -jar ${JAR_PATH} 1>nohup.log 2>nohup.stderr.log &
printf 'Waiting for NGB to start'
until $(wget http://localhost:8080/catgenome); do
sleep 3
Expand All @@ -28,6 +28,6 @@ done
# Run tests
./gradlew integrationCliTest -PcliPath=${CLI_BIN_PATH} -PresourcePath=${TEST_DATA_PATH} -PresourceRelativePath=${TEST_DATA_RELATIVE_PATH} -PtestCases=${TEST_CASES_PATH}

rm -r $TEST_DATA_PATH
rm catgenome
rm nohup.out
rm -rf $TEST_DATA_PATH
rm -f catgenome
rm -f nohup.out
58 changes: 58 additions & 0 deletions publish.sh
@@ -0,0 +1,58 @@
#!/bin/bash
# Script deploys built binaries to a server repository
# The following env vars shall be set
# DEMO_USER
# DEMO_SRV
# DEMO_PATH
# DEMO_KEY

echo "Starting deployment"

# Get current version
NGB_VERSION=$(./gradlew :printVersion -PbuildNumber=$TRAVIS_JOB_NUMBER | grep "Project version is " | sed 's/^.*is //')
echo "Current version is ${NGB_VERSION}"

# Store ssh key
echo -e ${DEMO_KEY} > demo.pem
sudo chmod 600 demo.pem

# Demo server - binaries
DIST="dist"
cd ${DIST}

VERSIONS=(latest $NGB_VERSION)
for VERSION in ${VERSIONS[*]}
do
DOCS_VERSION=''
echo "Creating ${VERSION} distribution"
test -d ${VERSION} || mkdir ${VERSION}
for file in *
do
if [[ -d $file ]]; then
continue
fi
ext="${file#*.}"
filename="${file%%.*}"
versioned_file=${filename}-${VERSION}.${ext}
cp -rf "$file" "${VERSION}/${versioned_file}"

if [[ $versioned_file == *"ngb-docs"* ]]; then
DOCS_VERSION=$versioned_file
fi
done

echo "Publishing ${VERSION} distribution"

sudo ssh ${DEMO_USER}@${DEMO_SRV} -o StrictHostKeyChecking=no -i ../demo.pem \
"test -d ${DEMO_PATH}/${VERSION} || mkdir -p ${DEMO_PATH}/${VERSION}"

sudo rsync -rave "ssh -o StrictHostKeyChecking=no -i ../demo.pem" ${VERSION}/* ${DEMO_USER}@${DEMO_SRV}:${DEMO_PATH}/${VERSION}

sudo ssh ${DEMO_USER}@${DEMO_SRV} -o StrictHostKeyChecking=no -i ../demo.pem \
"cd ${DEMO_PATH} &&" \
"rm -rf ${VERSION}/docs &&" \
"mkdir -p ${VERSION}/docs &&" \
"tar -zxf ${VERSION}/${DOCS_VERSION} -C ${VERSION}/docs"

echo "${VERSION} published"
done
3 changes: 2 additions & 1 deletion server/ngb-cli/build.gradle
Expand Up @@ -84,11 +84,12 @@ distZip {
}

distTar {
compression = Compression.GZIP
doFirst{
setVersion('')
}
doLast {
file("$destinationDir/$archiveName").renameTo("$destinationDir/" + baseName+'.tar')
file("$destinationDir/$archiveName").renameTo("$destinationDir/" + baseName+'.tar.gz')
}
}

Expand Down