Skip to content

Commit

Permalink
GitHub Actions Setup (#95)
Browse files Browse the repository at this point in the history
* - Disable Travis-CI

* - Update testcontainers from v1.13.0 to v1.15.3

* - Update checkstyle from v8.31 to v8.42

* - 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
  • Loading branch information
phillipross authored May 26, 2021
1 parent 95fe87a commit a2b7329
Show file tree
Hide file tree
Showing 8 changed files with 257 additions and 12 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.11-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.292-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>
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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]
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
File renamed without changes.
45 changes: 33 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,10 @@
<url>https://github.com/postgis/postgis-java/issues</url>
</issueManagement>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<site>
<id>local-staging-site</id>
<url>http://local-staging/</url>
</site>
</distributionManagement>

<properties>
Expand All @@ -108,7 +104,7 @@
<maven.integration.test.skip>false</maven.integration.test.skip>
<failsafe.forkCount>1</failsafe.forkCount>
<failsafe.useSystemClassLoader>true</failsafe.useSystemClassLoader>
<test.container.image>postgis/postgis:12-3.0-alpine</test.container.image>
<test.container.image>postgis/postgis:13-3.1-alpine</test.container.image>
<test.db.username>postgis1</test.db.username>
<test.db.password>postgis1</test.db.password>
<test.db.name>postgis1</test.db.name>
Expand Down Expand Up @@ -145,13 +141,13 @@
<maven-war-plugin.version>3.2.3</maven-war-plugin.version>
<versions-maven-plugin.version>2.7</versions-maven-plugin.version>
<!-- Dependency versions -->
<dependency.checkstyle.version>8.31</dependency.checkstyle.version>
<dependency.checkstyle.version>8.42</dependency.checkstyle.version>
<dependency.jts-version.version>1.18.1</dependency.jts-version.version>
<dependency.logback.version>1.2.3</dependency.logback.version>
<dependency.postgresql-jdbc.version>42.2.11</dependency.postgresql-jdbc.version>
<dependency.slfj.version>1.7.30</dependency.slfj.version>
<dependency.spatial4j.version>0.7</dependency.spatial4j.version>
<dependency.testcontainers.version>1.13.0</dependency.testcontainers.version>
<dependency.testcontainers.version>1.15.3</dependency.testcontainers.version>
<dependency.testng.version>6.14.3</dependency.testng.version>
</properties>

Expand Down Expand Up @@ -472,6 +468,18 @@
</build>

<profiles>
<!-- This profile isn't tested on windows, the path may not be specified correctly. -->
<profile>
<id>windows-javadoc</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<javadoc.path>${java.home}/bin/javadoc.exe</javadoc.path>
</properties>
</profile>
<profile>
<id>check-versions</id>
<build>
Expand Down Expand Up @@ -569,7 +577,20 @@
</plugins>
</build>
</profile>

<profile>
<id>sonatype-deployment</id>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>

<profile>
<id>SkipUnitTests</id>
<properties>
Expand Down

0 comments on commit a2b7329

Please sign in to comment.