Skip to content

Commit a2b7329

Browse files
authored
GitHub Actions Setup (#95)
* - 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
1 parent 95fe87a commit a2b7329

File tree

8 files changed

+257
-12
lines changed

8 files changed

+257
-12
lines changed

.github/install-gpg.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
set -euf
4+
5+
sudo apt-get update
6+
sudo apt-get install -y gnupg haveged
7+
8+
rm -rf ~/.gnupg
9+
gpg --list-keys
10+
11+
cat >key-info <<EOF
12+
%echo Generating a key
13+
Key-Type: RSA
14+
Key-Length: 4096
15+
Subkey-Type: RSA
16+
Subkey-Length: 4096
17+
Name-Real: PostGIS Development Team
18+
Name-Comment: PostGIS Development Team
19+
Name-Email: [email protected]
20+
Expire-Date: 0
21+
%no-ask-passphrase
22+
%no-protection
23+
%commit
24+
%echo done
25+
EOF
26+
27+
gpg --verbose --batch --gen-key key-info
28+
29+
echo -e "5\ny\n" | gpg --no-tty --command-fd 0 --expert --edit-key [email protected] trust;
30+
31+
# test
32+
gpg --list-keys
33+
gpg -e -a -r [email protected] key-info
34+
rm key-info
35+
gpg -d key-info.asc
36+
rm key-info.asc
37+
38+
set +euf

.github/install-maven.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -euf
4+
5+
MAVEN_BASE_URL=https://archive.apache.org/dist/maven/maven-3/
6+
MAVEN_VERSION=3.8.1
7+
MAVEN_SHA=b98a1905eb554d07427b2e5509ff09bd53e2f1dd7a0afa38384968b113abef02
8+
9+
sudo apt-get update
10+
sudo apt-get install -y curl
11+
sudo mkdir -p /usr/share/maven /usr/share/maven/ref
12+
sudo curl -fsSL -o /tmp/apache-maven.tar.gz ${MAVEN_BASE_URL}/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
13+
echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha256sum -c -
14+
sudo tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1
15+
sudo rm -f /tmp/apache-maven.tar.gz
16+
sudo ln -fs /usr/share/maven/bin/mvn /usr/bin/mvn
17+
mvn -version
18+
19+
set +euf
20+

.github/install-zulu11.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -euf
4+
5+
AZUL_GPG_KEY=0xB1998361219BD9C9
6+
ZULU_VERSION=11
7+
ZULU_RELEASE=11.0.11-1
8+
9+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${AZUL_GPG_KEY}
10+
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
11+
sudo apt-get update
12+
sudo apt-get install -y zulu-repo
13+
sudo apt-get update
14+
sudo apt-get install -y zulu${ZULU_VERSION}=${ZULU_RELEASE}
15+
sudo sed -i.orig -e "s/^hl /jre /g" -e "s/^jdkhl /jdk /g" /usr/lib/jvm/.zulu${ZULU_VERSION}-ca-amd64.jinfo
16+
sudo update-java-alternatives --set zulu${ZULU_VERSION}-ca-amd64
17+
export ALTERNATIVES_JAVAC=$(realpath /etc/alternatives/javac)
18+
export JAVA_HOME=${ALTERNATIVES_JAVAC%/bin/javac}
19+
export PATH=$JAVA_HOME/bin:$PATH
20+
java -version
21+
22+
set +euf
23+

.github/install-zulu8.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -euf
4+
5+
AZUL_GPG_KEY=0xB1998361219BD9C9
6+
ZULU_VERSION=8
7+
ZULU_RELEASE=8.0.292-1
8+
9+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${AZUL_GPG_KEY}
10+
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
11+
sudo apt-get update
12+
sudo apt-get install -y zulu-repo
13+
sudo apt-get update
14+
sudo apt-get install -y zulu${ZULU_VERSION}=${ZULU_RELEASE}
15+
sudo sed -i.orig -e "s/^hl /jre /g" -e "s/^jdkhl /jdk /g" /usr/lib/jvm/.zulu${ZULU_VERSION}-ca-amd64.jinfo
16+
sudo update-java-alternatives --set zulu${ZULU_VERSION}-ca-amd64
17+
export ALTERNATIVES_JAVAC=$(realpath /etc/alternatives/javac)
18+
export JAVA_HOME=${ALTERNATIVES_JAVAC%/bin/javac}
19+
export PATH=$JAVA_HOME/bin:$PATH
20+
java -version
21+
22+
set +euf
23+

.github/settings.xml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
4+
<servers>
5+
<server>
6+
<id>ossrh</id>
7+
<username>${env.OSSRHU}</username>
8+
<password>${env.OSSRHT}</password>
9+
</server>
10+
</servers>
11+
<profiles>
12+
<profile>
13+
<id>gpg</id>
14+
<properties>
15+
<gpg.keyname>[email protected]</gpg.keyname>
16+
</properties>
17+
</profile>
18+
<profile>
19+
<id>sonatype-snapshots</id>
20+
<repositories>
21+
<repository>
22+
<id>sonatype-snapshots</id>
23+
<snapshots>
24+
<enabled>true</enabled>
25+
</snapshots>
26+
<name>sonatype-snapshots</name>
27+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
28+
</repository>
29+
</repositories>
30+
</profile>
31+
<profile>
32+
<id>sonatype-staging</id>
33+
<repositories>
34+
<repository>
35+
<id>sonatype-staging</id>
36+
<snapshots>
37+
<enabled>true</enabled>
38+
</snapshots>
39+
<name>sonatype-staging</name>
40+
<url>https://oss.sonatype.org/content/groups/staging/</url>
41+
</repository>
42+
</repositories>
43+
</profile>
44+
<profile>
45+
<id>sonatype-releases</id>
46+
<repositories>
47+
<repository>
48+
<id>sonatype-releases</id>
49+
<snapshots>
50+
<enabled>true</enabled>
51+
</snapshots>
52+
<name>sonatype-releases</name>
53+
<url>https://oss.sonatype.org/content/groups/public/</url>
54+
</repository>
55+
</repositories>
56+
</profile>
57+
</profiles>
58+
59+
</settings>

.github/workflows/main.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: PostGIS Java CI
2+
3+
on: [push, pull_request]
4+
5+
defaults:
6+
run:
7+
shell: bash
8+
9+
jobs:
10+
build-codebase:
11+
strategy:
12+
matrix:
13+
os: [ubuntu-20.04]
14+
java_version: [8]
15+
maven_version: [3.8.1]
16+
name: Build on OS ${{ matrix.os }} with Maven ${{ matrix.maven_version }} using Zulu ${{ matrix.java_version }}
17+
runs-on: ${{ matrix.os }}
18+
env:
19+
JAVA_HOME: /usr/lib/jvm/zulu${{ matrix.java_version }}-ca-amd64
20+
MAVEN_HOME: /usr/share/maven
21+
MAVEN_PROPS: -Djavadoc.path=`which javadoc`
22+
PROFILES: gpg,release-sign-artifacts,sonatype-deployment,sonatype-snapshots,sonatype-staging,sonatype-releases
23+
SETTINGS: .github/settings.xml
24+
25+
steps:
26+
- name: Checkout Source
27+
uses: actions/checkout@v2
28+
29+
- name: Install GPG and generate test key
30+
run: .github/install-gpg.sh
31+
32+
- name: Install Zulu OpenJDK
33+
run: .github/install-zulu${{ matrix.java_version }}.sh
34+
35+
- name: Install Maven
36+
run: .github/install-maven.sh
37+
38+
- name: Setup Maven repository cache
39+
uses: actions/cache@v2
40+
env:
41+
cache-name: m2repo
42+
with:
43+
path: ~/.m2/repository
44+
key: ${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
45+
restore-keys: |
46+
${{ env.cache-name }}-
47+
48+
- name: Log github.ref
49+
run: echo "${{ github.ref }}"
50+
51+
- name: Show Maven dependency tree
52+
run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} dependency:tree
53+
54+
- name: Show Maven active profiles
55+
run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} help:active-profiles
56+
57+
- name: Show Maven effective POM
58+
run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} help:effective-pom
59+
60+
- name: Maven build/test
61+
run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} clean install
File renamed without changes.

pom.xml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,10 @@
8686
<url>https://github.com/postgis/postgis-java/issues</url>
8787
</issueManagement>
8888
<distributionManagement>
89-
<snapshotRepository>
90-
<id>ossrh</id>
91-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
92-
</snapshotRepository>
93-
<repository>
94-
<id>ossrh</id>
95-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
96-
</repository>
89+
<site>
90+
<id>local-staging-site</id>
91+
<url>http://local-staging/</url>
92+
</site>
9793
</distributionManagement>
9894

9995
<properties>
@@ -108,7 +104,7 @@
108104
<maven.integration.test.skip>false</maven.integration.test.skip>
109105
<failsafe.forkCount>1</failsafe.forkCount>
110106
<failsafe.useSystemClassLoader>true</failsafe.useSystemClassLoader>
111-
<test.container.image>postgis/postgis:12-3.0-alpine</test.container.image>
107+
<test.container.image>postgis/postgis:13-3.1-alpine</test.container.image>
112108
<test.db.username>postgis1</test.db.username>
113109
<test.db.password>postgis1</test.db.password>
114110
<test.db.name>postgis1</test.db.name>
@@ -145,13 +141,13 @@
145141
<maven-war-plugin.version>3.2.3</maven-war-plugin.version>
146142
<versions-maven-plugin.version>2.7</versions-maven-plugin.version>
147143
<!-- Dependency versions -->
148-
<dependency.checkstyle.version>8.31</dependency.checkstyle.version>
144+
<dependency.checkstyle.version>8.42</dependency.checkstyle.version>
149145
<dependency.jts-version.version>1.18.1</dependency.jts-version.version>
150146
<dependency.logback.version>1.2.3</dependency.logback.version>
151147
<dependency.postgresql-jdbc.version>42.2.11</dependency.postgresql-jdbc.version>
152148
<dependency.slfj.version>1.7.30</dependency.slfj.version>
153149
<dependency.spatial4j.version>0.7</dependency.spatial4j.version>
154-
<dependency.testcontainers.version>1.13.0</dependency.testcontainers.version>
150+
<dependency.testcontainers.version>1.15.3</dependency.testcontainers.version>
155151
<dependency.testng.version>6.14.3</dependency.testng.version>
156152
</properties>
157153

@@ -472,6 +468,18 @@
472468
</build>
473469

474470
<profiles>
471+
<!-- This profile isn't tested on windows, the path may not be specified correctly. -->
472+
<profile>
473+
<id>windows-javadoc</id>
474+
<activation>
475+
<os>
476+
<family>windows</family>
477+
</os>
478+
</activation>
479+
<properties>
480+
<javadoc.path>${java.home}/bin/javadoc.exe</javadoc.path>
481+
</properties>
482+
</profile>
475483
<profile>
476484
<id>check-versions</id>
477485
<build>
@@ -569,7 +577,20 @@
569577
</plugins>
570578
</build>
571579
</profile>
572-
580+
<profile>
581+
<id>sonatype-deployment</id>
582+
<distributionManagement>
583+
<snapshotRepository>
584+
<id>ossrh</id>
585+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
586+
</snapshotRepository>
587+
<repository>
588+
<id>ossrh</id>
589+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
590+
</repository>
591+
</distributionManagement>
592+
</profile>
593+
573594
<profile>
574595
<id>SkipUnitTests</id>
575596
<properties>

0 commit comments

Comments
 (0)