From 9bbebb789c1d9a46db9f3b48789aa3264bbb4fe6 Mon Sep 17 00:00:00 2001 From: Phillip Ross Date: Thu, 22 Jul 2021 14:24:56 -0400 Subject: [PATCH] GitHub Actions Setup (#95) (#107) - Disable Travis-CI - Update postgis/postgis test container from v12-3.0-alpine to v13-3.1-alpine - Added windows-javadoc maven profile - Move sonatype distro management bock to dedicated profile and replace with local staging distro spec - Initial Github Actions setup (cherry picked from commit a2b7329f5a5ef24766fe77e8403171f47a8b68c0) - Added sonatype snapshot deployment to main workflow for main branch commits (#98) (cherry picked from commit 36ac3923fa7356e9039e84caab1ba0be488730ac) - exec-maven-plugin updated from v1.6.0 to v3.0.0 - jacoco-maven-plugin updated from v0.8.5 to v0.8.7 - maven-checkstyle-plugin updated from v3.1.1 to v3.1.2 - maven-ear-plugin updated from v3.0.2 to v3.2.0 - maven-gpg-plugin updated from v1.6 to v3.0.1 - maven-jxr-plugin updated from v3.0.0 to v3.1.1 - maven-war-plugin updated from v3.2.3 to v3.3.1 - Re-arrange maven plugin declarations to move version specification to plugin management section and execution/config info to plugins section (cherry picked from commit 0dfc7e6997f686045abeeaf64b1ae6253da4f03b) - git-commit-id-plugin updated from v4.0.2 to v4.0.5 - maven-dependency-plugin updated from v3.1.2 to v3.2.0 - maven-javadoc-plugin updated from v3.2.0 to v3.3.0 (cherry picked from commit 046f9e46abd5144e2539d60e55a709a716860806) - download-maven-plugin updated from v1.6.0 to v1.6.6 - checkstyle updated from v8.36 to v8.44 - logback updated from v1.2.3 to v1.2.4 - postgresql-jdbc updated from v42.2.16 to v42.2.23 - slf4j updated from v1.7.30 to v1.7.32 - testcontainers updated from v1.14.3 to v1.16.0 (cherry picked from commit a1bda73d5b5d4a48c571696f8e22e2a0f76907e6) - jts updated from v1.17.1 to v1.18.1 (cherry picked from commit 95fe87a3f6b83411ec1c95a12aec91767e11e464) - spatial4j updated from v0.7 to v0.8 (cherry picked from commit f280b5467719fa5d7cf76c790291f31a28db73dd) - add rule to maven-version-rules.xml to pin git-commit-id plugin version (#105) (cherry picked from commit 211264305a506183b43d9190288b0e7367c81558) --- .github/install-gpg.sh | 38 ++++ .github/install-maven.sh | 20 ++ .github/install-zulu11.sh | 23 ++ .github/install-zulu8.sh | 23 ++ .github/settings.xml | 59 +++++ .github/workflows/main.yml | 73 +++++++ .travis.yml => .travis.yml.disabled | 0 .travis/install-maven.sh | 6 +- .travis/install-zulu.sh | 6 +- maven-version-rules.xml | 8 +- pom.xml | 325 ++++++++++++++++------------ 11 files changed, 440 insertions(+), 141 deletions(-) create mode 100755 .github/install-gpg.sh create mode 100755 .github/install-maven.sh create mode 100755 .github/install-zulu11.sh create mode 100755 .github/install-zulu8.sh create mode 100644 .github/settings.xml create mode 100644 .github/workflows/main.yml rename .travis.yml => .travis.yml.disabled (100%) diff --git a/.github/install-gpg.sh b/.github/install-gpg.sh new file mode 100755 index 0000000..b08a3d9 --- /dev/null +++ b/.github/install-gpg.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -euf + +sudo apt-get update +sudo apt-get install -y gnupg haveged + +rm -rf ~/.gnupg +gpg --list-keys + +cat >key-info < + + + ossrh + ${env.OSSRHU} + ${env.OSSRHT} + + + + + gpg + + test-key@postgis.net + + + + sonatype-snapshots + + + sonatype-snapshots + + true + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + + + sonatype-staging + + + sonatype-staging + + true + + sonatype-staging + https://oss.sonatype.org/content/groups/staging/ + + + + + sonatype-releases + + + sonatype-releases + + true + + sonatype-releases + https://oss.sonatype.org/content/groups/public/ + + + + + + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..29e11e3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,73 @@ +name: PostGIS Java CI + +on: [push, pull_request] + +defaults: + run: + shell: bash + +jobs: + build-codebase: + strategy: + matrix: + os: [ubuntu-20.04] + java_version: [8] + maven_version: [3.8.1] + include: + - os: ubuntu-20.04 + java_version: 8 + maven_version: 3.8.1 + maven_deploy: true + name: Build on OS ${{ matrix.os }} with Maven ${{ matrix.maven_version }} using Zulu ${{ matrix.java_version }} + runs-on: ${{ matrix.os }} + env: + JAVA_HOME: /usr/lib/jvm/zulu${{ matrix.java_version }}-ca-amd64 + MAVEN_HOME: /usr/share/maven + MAVEN_PROPS: -Djavadoc.path=`which javadoc` + PROFILES: gpg,release-sign-artifacts,sonatype-deployment,sonatype-snapshots,sonatype-staging,sonatype-releases + SETTINGS: .github/settings.xml + + steps: + - name: Checkout Source + uses: actions/checkout@v2 + + - name: Install GPG and generate test key + run: .github/install-gpg.sh + + - name: Install Zulu OpenJDK + run: .github/install-zulu${{ matrix.java_version }}.sh + + - name: Install Maven + run: .github/install-maven.sh + + - name: Setup Maven repository cache + uses: actions/cache@v2 + env: + cache-name: m2repo + with: + path: ~/.m2/repository + key: ${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ env.cache-name }}- + + - name: Log github.ref + run: echo "${{ github.ref }}" + + - name: Show Maven dependency tree + run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} dependency:tree + + - name: Show Maven active profiles + run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} help:active-profiles + + - name: Show Maven effective POM + run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} help:effective-pom + + - name: Maven build/test + run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} clean install + + - name: Maven deploy + if: ${{ matrix.maven_deploy && (github.ref == 'refs/heads/main') && (github.event_name != 'pull_request') }} + env: + OSSRHU: ${{ secrets.OSSRHU }} + OSSRHT: ${{ secrets.OSSRHT }} + run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} deploy \ No newline at end of file diff --git a/.travis.yml b/.travis.yml.disabled similarity index 100% rename from .travis.yml rename to .travis.yml.disabled diff --git a/.travis/install-maven.sh b/.travis/install-maven.sh index bf05cba..a3e5571 100755 --- a/.travis/install-maven.sh +++ b/.travis/install-maven.sh @@ -3,8 +3,8 @@ set -euf MAVEN_BASE_URL=https://archive.apache.org/dist/maven/maven-3/ -MAVEN_VERSION=3.6.3 -MAVEN_SHA=26ad91d751b3a9a53087aefa743f4e16a17741d3915b219cf74112bf87a438c5 +MAVEN_VERSION=3.8.1 +MAVEN_SHA=b98a1905eb554d07427b2e5509ff09bd53e2f1dd7a0afa38384968b113abef02 sudo apt-get update sudo apt-get install -y curl @@ -13,7 +13,7 @@ sudo curl -fsSL -o /tmp/apache-maven.tar.gz ${MAVEN_BASE_URL}/${MAVEN_VERSION}/b echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha256sum -c - sudo tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 sudo rm -f /tmp/apache-maven.tar.gz -sudo ln -s /usr/share/maven/bin/mvn /usr/bin/mvn +sudo ln -fs /usr/share/maven/bin/mvn /usr/bin/mvn mvn -version set +euf \ No newline at end of file diff --git a/.travis/install-zulu.sh b/.travis/install-zulu.sh index 359cb67..3d9a02a 100755 --- a/.travis/install-zulu.sh +++ b/.travis/install-zulu.sh @@ -4,7 +4,7 @@ set -euf AZUL_GPG_KEY=0xB1998361219BD9C9 ZULU_VERSION=8 -ZULU_RELEASE=8.0.265-5 +ZULU_RELEASE=8.0.302-1 JAVA_HOME=/usr/lib/jvm/zulu-8-amd64 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${AZUL_GPG_KEY} @@ -13,8 +13,8 @@ sudo apt-get update sudo apt-get install -y zulu-repo sudo apt-get update sudo apt-get install -y zulu${ZULU_VERSION}=${ZULU_RELEASE} -sudo sed -i.orig -e "s/^hl /jre /g" -e "s/^jdkhl /jdk /g" /usr/lib/jvm/.zulu8-ca-amd64.jinfo -sudo update-java-alternatives --set zulu8-ca-amd64 +sudo sed -i.orig -e "s/^hl /jre /g" -e "s/^jdkhl /jdk /g" /usr/lib/jvm/.zulu${ZULU_VERSION}-ca-amd64.jinfo +sudo update-java-alternatives --set zulu${ZULU_VERSION}-ca-amd64 export ALTERNATIVES_JAVAC=$(realpath /etc/alternatives/javac) export JAVA_HOME=${ALTERNATIVES_JAVAC%/bin/javac} export PATH=$JAVA_HOME/bin:$PATH diff --git a/maven-version-rules.xml b/maven-version-rules.xml index b0ff4d0..dbd860d 100644 --- a/maven-version-rules.xml +++ b/maven-version-rules.xml @@ -9,8 +9,14 @@ .*\.jre[6-7] + + + + 4\.9\.9 + + - + 7\..* diff --git a/pom.xml b/pom.xml index 6dcd88c..59d962a 100644 --- a/pom.xml +++ b/pom.xml @@ -86,21 +86,17 @@ https://github.com/postgis/postgis-java/issues - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - + + local-staging-site + http://local-staging/ + true UTF-8 UTF-8 - 1.8 + 8 3.6 false 1 @@ -108,7 +104,7 @@ false 1 true - postgis/postgis:12-3.0-alpine + postgis/postgis:13-3.1-alpine postgis1 postgis1 postgis1 @@ -116,42 +112,42 @@ 3.2.0 0.3.1 - 1.6.0 + 1.6.6 3.0.0 - 4.0.2 - 0.8.5 + 4.0.5 + 0.8.7 3.2.0 - 3.1.1 + 3.1.2 3.1.0 3.8.1 - 3.1.2 + 3.2.0 2.8.2 - 3.0.2 + 3.2.0 3.0.1 1.4.1 2.22.2 - 1.6 + 3.0.1 2.5.2 3.2.0 3.0.0 - 3.2.0 - 3.0.0 + 3.3.0 + 3.1.1 2.5.3 3.2.0 - 3.9.1 3.2.4 + 3.9.1 3.2.1 2.22.2 3.3.1 2.8.1 - 8.36 - 1.17.1 - 1.2.3 - 42.2.16 - 1.7.30 - 0.7 - 1.14.3 + 8.44 + 1.18.1 + 1.2.4 + 42.2.23 + 1.7.32 + 0.8 + 1.16.0 6.14.3 @@ -190,6 +186,138 @@ + + com.googlecode.maven-download-plugin + download-maven-plugin + ${download-maven-plugin.version} + + + org.apache.maven.plugins + maven-archetype-plugin + ${maven-archetype-plugin.version} + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + + com.puppycrawl.tools + checkstyle + ${dependency.checkstyle.version} + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven-clean-plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.apache.maven.plugins + maven-dependency-plugin + ${maven-dependency-plugin.version} + + + org.apache.maven.plugins + maven-deploy-plugin + ${maven-deploy-plugin.version} + + + org.apache.maven.plugins + maven-ear-plugin + ${maven-ear-plugin.version} + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + + org.apache.maven.plugins + maven-install-plugin + ${maven-install-plugin.version} + + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + org.apache.maven.plugins + maven-jarsigner-plugin + ${maven-jarsigner-plugin.version} + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + + org.apache.maven.plugins + maven-jxr-plugin + ${maven-jxr-plugin.version} + + + org.apache.maven.plugins + maven-release-plugin + ${maven-release-plugin.version} + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + org.apache.maven.plugins + maven-site-plugin + ${maven-site-plugin.version} + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin.version} + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + org.codehaus.mojo versions-maven-plugin @@ -203,30 +331,22 @@ directory-maven-plugin ${directory-maven-plugin.version} + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + - - com.googlecode.maven-download-plugin - download-maven-plugin - ${download-maven-plugin.version} - - - org.apache.maven.plugins - maven-archetype-plugin - ${maven-archetype-plugin.version} - org.apache.maven.plugins maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - - com.puppycrawl.tools - checkstyle - ${dependency.checkstyle.version} - - checkstyle.xml true @@ -235,39 +355,17 @@ warning - - org.apache.maven.plugins - maven-clean-plugin - ${maven-clean-plugin.version} - org.apache.maven.plugins maven-compiler-plugin - ${maven-compiler-plugin.version} ${java.min.version} ${java.min.version} - - org.apache.maven.plugins - maven-dependency-plugin - ${maven-dependency-plugin.version} - - - org.apache.maven.plugins - maven-deploy-plugin - ${maven-deploy-plugin.version} - - - org.apache.maven.plugins - maven-ear-plugin - ${maven-ear-plugin.version} - org.apache.maven.plugins maven-enforcer-plugin - ${maven-enforcer-plugin.version} enforce-maven @@ -287,7 +385,6 @@ org.apache.maven.plugins maven-failsafe-plugin - ${maven-failsafe-plugin.version} ${failsafe.forkCount} ${maven.integration.test.skip} @@ -299,43 +396,16 @@ ${failsafe.useSystemClassLoader} - - org.apache.maven.plugins - maven-gpg-plugin - ${maven-gpg-plugin.version} - - - org.apache.maven.plugins - maven-install-plugin - ${maven-install-plugin.version} - - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - org.apache.maven.plugins - maven-jarsigner-plugin - ${maven-jarsigner-plugin.version} - org.apache.maven.plugins maven-javadoc-plugin - ${maven-javadoc-plugin.version} ${java.min.version} - - org.apache.maven.plugins - maven-jxr-plugin - ${maven-jxr-plugin.version} - org.apache.maven.plugins maven-release-plugin - ${maven-release-plugin.version} true true @@ -343,30 +413,9 @@ release-sign-artifacts - - org.apache.maven.plugins - maven-resources-plugin - ${maven-resources-plugin.version} - - - org.apache.maven.plugins - maven-site-plugin - ${maven-site-plugin.version} - - - org.apache.maven.plugins - maven-shade-plugin - ${maven-shade-plugin.version} - - - org.apache.maven.plugins - maven-source-plugin - ${maven-source-plugin.version} - org.apache.maven.plugins maven-surefire-plugin - ${maven-surefire-plugin.version} ${surefire.forkCount} ${maven.test.skip} @@ -378,25 +427,9 @@ ${surefire.useSystemClassLoader} - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - - org.codehaus.mojo - build-helper-maven-plugin - ${build-helper-maven-plugin.version} - - - org.codehaus.mojo - exec-maven-plugin - ${exec-maven-plugin.version} - org.jacoco jacoco-maven-plugin - ${jacoco-maven-plugin.version} pre-unit-test @@ -436,7 +469,6 @@ pl.project13.maven git-commit-id-plugin - ${git-commit-id-plugin.version} git-describe @@ -472,6 +504,18 @@ + + + windows-javadoc + + + windows + + + + ${java.home}/bin/javadoc.exe + + check-versions @@ -569,7 +613,20 @@ - + + sonatype-deployment + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + SkipUnitTests