Skip to content

Commit

Permalink
GitHub Actions Setup (#95) (#107)
Browse files Browse the repository at this point in the history
- 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 a2b7329)

- Added sonatype snapshot deployment to main workflow for main branch commits (#98)
(cherry picked from commit 36ac392)

- 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 0dfc7e6)

- 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 046f9e4)

- 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 a1bda73)

- jts updated from v1.17.1 to v1.18.1
(cherry picked from commit 95fe87a)

- spatial4j updated from v0.7 to v0.8
(cherry picked from commit f280b54)

- add rule to maven-version-rules.xml to pin git-commit-id plugin version (#105)
(cherry picked from commit 2112643)
  • Loading branch information
phillipross authored Jul 22, 2021
1 parent 6c70ca0 commit 9bbebb7
Show file tree
Hide file tree
Showing 11 changed files with 440 additions and 141 deletions.
38 changes: 38 additions & 0 deletions .github/install-gpg.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF
%echo Generating a key
Key-Type: RSA
Key-Length: 4096
Subkey-Type: RSA
Subkey-Length: 4096
Name-Real: PostGIS Development Team
Name-Comment: PostGIS Development Team
Name-Email: test-key@postgis.net
Expire-Date: 0
%no-ask-passphrase
%no-protection
%commit
%echo done
EOF

gpg --verbose --batch --gen-key key-info

echo -e "5\ny\n" | gpg --no-tty --command-fd 0 --expert --edit-key test-key@postgis.net trust;

# test
gpg --list-keys
gpg -e -a -r test-key@postgis.net key-info
rm key-info
gpg -d key-info.asc
rm key-info.asc

set +euf
20 changes: 20 additions & 0 deletions .github/install-maven.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -euf

MAVEN_BASE_URL=https://archive.apache.org/dist/maven/maven-3/
MAVEN_VERSION=3.8.1
MAVEN_SHA=b98a1905eb554d07427b2e5509ff09bd53e2f1dd7a0afa38384968b113abef02

sudo apt-get update
sudo apt-get install -y curl
sudo mkdir -p /usr/share/maven /usr/share/maven/ref
sudo curl -fsSL -o /tmp/apache-maven.tar.gz ${MAVEN_BASE_URL}/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
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 -fs /usr/share/maven/bin/mvn /usr/bin/mvn
mvn -version

set +euf

23 changes: 23 additions & 0 deletions .github/install-zulu11.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euf

AZUL_GPG_KEY=0xB1998361219BD9C9
ZULU_VERSION=11
ZULU_RELEASE=11.0.12-1

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${AZUL_GPG_KEY}
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
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/.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
java -version

set +euf

23 changes: 23 additions & 0 deletions .github/install-zulu8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euf

AZUL_GPG_KEY=0xB1998361219BD9C9
ZULU_VERSION=8
ZULU_RELEASE=8.0.302-1

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${AZUL_GPG_KEY}
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
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/.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
java -version

set +euf

59 changes: 59 additions & 0 deletions .github/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${env.OSSRHU}</username>
<password>${env.OSSRHT}</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.keyname>test-key@postgis.net</gpg.keyname>
</properties>
</profile>
<profile>
<id>sonatype-snapshots</id>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<name>sonatype-snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
</profile>
<profile>
<id>sonatype-staging</id>
<repositories>
<repository>
<id>sonatype-staging</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<name>sonatype-staging</name>
<url>https://oss.sonatype.org/content/groups/staging/</url>
</repository>
</repositories>
</profile>
<profile>
<id>sonatype-releases</id>
<repositories>
<repository>
<id>sonatype-releases</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<name>sonatype-releases</name>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
</profile>
</profiles>

</settings>
73 changes: 73 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
6 changes: 3 additions & 3 deletions .travis/install-maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions .travis/install-zulu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion maven-version-rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
<ignoreVersion type="regex">.*\.jre[6-7]</ignoreVersion>
</ignoreVersions>
<rules>
<!-- Pin git-commit-id-plugin version to final release version before V5 until codebase migrates to Java11 -->
<rule groupId="pl.project13.maven" artifactId="git-commit-id-plugin">
<ignoreVersions>
<ignoreVersion type="regex">4\.9\.9</ignoreVersion>
</ignoreVersions>
</rule>
<!-- Pin testng version to pre-V7 -->
<rule groupId="org.testng" artifactId="testng" comparisonMethod="maven">
<rule groupId="org.testng" artifactId="testng">
<ignoreVersions>
<ignoreVersion type="regex">7\..*</ignoreVersion>
</ignoreVersions>
Expand Down
Loading

0 comments on commit 9bbebb7

Please sign in to comment.