Skip to content

Commit

Permalink
Merge pull request #6 from Cytomine-ULiege/ci
Browse files Browse the repository at this point in the history
Continuous integration & Dockerfile
  • Loading branch information
urubens authored Jun 30, 2022
2 parents d8f0a99 + bfa825c commit 979b9e6
Show file tree
Hide file tree
Showing 11 changed files with 383 additions and 160 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!src
!build.gradle
!settings.gradle
!scripts/docker
9 changes: 0 additions & 9 deletions .idea/libraries/bioformats_package.xml

This file was deleted.

59 changes: 0 additions & 59 deletions .travis.yml

This file was deleted.

84 changes: 84 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
node {
stage ('Retrieve sources') {
checkout([
$class: 'GitSCM',
branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],
userRemoteConfigs: scm.userRemoteConfigs,
])
}

stage ('Clean') {
sh 'rm -rf output'
sh 'mkdir -p output'
}

stage ('Compute version number') {
env.VERSION_NUMBER = sh(
script: 'scripts/ci.sh version-number ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}',
returnStdout: true
)
echo("Version number: ${env.VERSION_NUMBER}")

stage ('Download and cache dependencies') {
sh 'scripts/ci.sh dependencies ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}'
}

stage ('Build jar') {
sh 'scripts/ci.sh build-jar ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}'
}

stage ('Publish jar') {
sh 'scripts/ci.sh publish-jar ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}'

stage ('Build Docker image') {
sh 'scripts/ci.sh build-docker ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}'
}
stage ('Publish Docker image') {
withCredentials(
[
usernamePassword(
credentialsId: 'DOCKERHUB_CREDENTIAL',
usernameVariable: 'DOCKERHUB_USER',
passwordVariable: 'DOCKERHUB_TOKEN'
)
]
) {
docker.withRegistry('https://index.docker.io/v1/', 'DOCKERHUB_CREDENTIAL') {
sh 'scripts/ci.sh publish-docker ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}'
}
}
}

stage ('Check official release status') {
env.OFFICIAL_RELEASE = sh(
script: 'scripts/ci.sh is-official-release ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}',
returnStdout: true
)
echo("Official Release to publish on Github ? ${env.OFFICIAL_RELEASE}")

if (env.OFFICIAL_RELEASE && env.OFFICIAL_RELEASE.toBoolean()) {
echo("official")
stage ('Publish official release on Github') {
env.GITHUB_REPO = scm.getUserRemoteConfigs()[0].getUrl().replaceFirst(/^.*?(?::\/\/.*?\/|:)(.*).git$/, '$1')
withCredentials(
[
usernamePassword(
credentialsId: 'GITHUB_RELEASE_CREDENTIAL',
usernameVariable: 'GITHUB_RELEASE_USER',
passwordVariable: 'GITHUB_RELEASE_TOKEN'
)
]
) {
sh 'scripts/ci.sh publish-github'
}
}
}
}
}

stage ('Clean Docker images') {
sh 'scripts/ci.sh clean-docker ${NAMESPACE} docker.io bioformat ${BRANCH_NAME}'
}
}
}
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group 'be.cytomine.bioformats'
version '3.1.0'
version '0.0.0'

sourceCompatibility = 1.8

Expand All @@ -29,9 +29,9 @@ dependencies {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.1'
compile('org.apache.logging.log4j:log4j-slf4j-impl:2.17.1')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.2'
compile('org.apache.logging.log4j:log4j-slf4j-impl:2.17.2')
testCompile group: 'junit', name: 'junit', version: '4.12'
}

Expand All @@ -58,6 +58,7 @@ run {
}

jar {
archiveName = 'cytomine-bioformats-wrapper.jar'
manifest {
attributes('Main-Class': 'be.cytomine.bioformats.BioFormatServerSocket')
}
Expand Down
40 changes: 0 additions & 40 deletions docker/Dockerfile

This file was deleted.

19 changes: 0 additions & 19 deletions docker/check-status.sh

This file was deleted.

29 changes: 0 additions & 29 deletions docker/deploy.sh

This file was deleted.

Loading

0 comments on commit 979b9e6

Please sign in to comment.