From 2636dde4a86e3239a5e198841de6c0c55ab42216 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Fri, 20 Nov 2020 00:34:32 -0500 Subject: [PATCH] Abandon travis-ci for jenkins --- .ci/Jenkinsfile | 42 ++++++++++++++++++++++++++++++++++++++++++ .ci/build.sh | 36 ++++++++++++++++++++++++++++++++++++ .travis-settings.xml | 9 --------- .travis.yml | 32 -------------------------------- README.md | 2 +- 5 files changed, 79 insertions(+), 42 deletions(-) create mode 100644 .ci/Jenkinsfile create mode 100755 .ci/build.sh delete mode 100644 .travis-settings.xml delete mode 100644 .travis.yml diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile new file mode 100644 index 000000000..e283bab37 --- /dev/null +++ b/.ci/Jenkinsfile @@ -0,0 +1,42 @@ +properties( + [ + disableConcurrentBuilds() + ] +) + +node('linux && docker') { + try { + stage('Checkout') { + //branch name from Jenkins environment variables + echo "My branch is: ${env.BRANCH_NAME}" + + // this doesn't grab tags pointing to this branch + //checkout scm + // this hack does... https://issues.jenkins.io/browse/JENKINS-45164 + checkout([ + $class: 'GitSCM', + branches: [[name: 'refs/heads/'+env.BRANCH_NAME]], + extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']], + userRemoteConfigs: scm.userRemoteConfigs, + ]) + sh ''' + set -euxo pipefail + git checkout "$BRANCH_NAME" -- + git reset --hard "origin/$BRANCH_NAME" + ''' + } + + stage('Build + Deploy') { + sh 'curl --compressed -sL https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/build-ci.sh | bash' + } + + currentBuild.result = 'SUCCESS' + } catch (Exception err) { + currentBuild.result = 'FAILURE' + } finally { + stage('Email') { + step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'admin.jenkins@moparisthebest.com', sendToIndividuals: true]) + } + deleteDir() + } +} diff --git a/.ci/build.sh b/.ci/build.sh new file mode 100755 index 000000000..d71c08ba7 --- /dev/null +++ b/.ci/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -euxo pipefail + +# Java 14+ java.lang.Record is ambiguous with hssf.Record :'( +[ $JAVA_VERSION -lt 7 -o $JAVA_VERSION -gt 13 ] && echo "build does not support JAVA_VERSION: $JAVA_VERSION" && exit 0 + +echo "starting build for JAVA_VERSION: $JAVA_VERSION" + +# grab all deps with java 8 +[ $JAVA_VERSION -eq 7 ] && run-java 8 mvn dependency:go-offline + +# install deps +mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V + +if [ $JAVA_VERSION -lt 12 ] +then + # clean and test + mvn clean test -B +else + # clean and test + mvn clean test -B -Djava.version=7 # java12+ minimum target is 7, not 6 +fi + +# publish only from java 6 and master branch +if [ "$BRANCH_NAME" == "master" -a $JAVA_VERSION -eq 7 ] +then + echo 'deploying to maven' + # java 7 cannot do modern SSL, use java 8 to deploy + run-java 8 mvn deploy -Dmaven.test.skip=true -B + + mkdir -p release + find -type f -name '*.jar' -print0 | xargs -0n1 -I {} mv '{}' 'release/' +fi + +echo 'build success!' +exit 0 diff --git a/.travis-settings.xml b/.travis-settings.xml deleted file mode 100644 index a9a9c68ea..000000000 --- a/.travis-settings.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - sonatype-nexus-snapshots - ${env.SONATYPE_USERNAME} - ${env.SONATYPE_PASSWORD} - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 99dcc8e65..000000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: java -sudo: false - -matrix: - include: - - env: JDK='OpenJDK 7' - jdk: openjdk7 - - env: JDK='OpenJDK 8' - jdk: openjdk8 - - env: JDK='OpenJDK 9' - install: . ./install-jdk.sh -F 9 -L GPL - - env: JDK='OpenJDK 10' - install: . ./install-jdk.sh -F 10 -L GPL - - env: JDK='OpenJDK 11' - install: . ./install-jdk.sh -F 11 -L GPL - - env: JDK='OpenJDK 12' - install: . ./install-jdk.sh -F 12 -L GPL - script: mvn test -B -Djava.version=7 # java12 minimum target is 7, not 6 - - env: JDK='OpenJDK 13' - install: . ./install-jdk.sh -F 13 -L GPL - script: mvn test -B -Djava.version=7 # java13 minimum target is 7, not 6 - -before_install: wget https://raw.githubusercontent.com/sormuras/bach/master/install-jdk.sh - -after_success: - - if [[ "${JDK}" == 'OpenJDK 7' ]]; then - mvn deploy --settings .travis-settings.xml -Dmaven.test.skip=true -B || travis_terminate 1; - fi - -cache: - directories: - - $HOME/.m2 diff --git a/README.md b/README.md index 7ed51a096..c9e25af65 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ POI Fast Calc ====================== -[![Travis-CI Build Status](https://api.travis-ci.org/moparisthebest/poi.svg?branch=master)](https://travis-ci.org/moparisthebest/poi) +[![Build Status](https://ci.moparisthe.best/job/moparisthebest/job/poi/job/master/badge/icon%3Fstyle=plastic)](https://ci.moparisthe.best/job/moparisthebest/job/poi/job/master/) A Java library to calculate Excel formulas quickly.