-
Notifications
You must be signed in to change notification settings - Fork 56
98 lines (80 loc) · 3.91 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: PostGIS Java CI
on: [push, pull_request]
defaults:
run:
shell: bash
jobs:
build-codebase:
strategy:
matrix:
os: [ubuntu-24.04]
jdk_version: [8.0.422-zulu, 11.0.24-zulu, 17.0.12-zulu, 21.0.4-zulu]
maven_version: [3.9.8]
include:
- os: ubuntu-24.04
jdk_version: 8.0.422-zulu
zulu_version: 8.80.0.17
maven_version: 3.9.8
maven_deploy: true
docker_build: true
maven_docker_container_image_repo: luminositylabs
maven_docker_container_image_name: maven
maven_docker_container_image_tag: 3.9.8_openjdk-8u422_zulu-alpine-8.80.0.17
name: Build on OS ${{ matrix.os }} with Maven ${{ matrix.maven_version }} using JDK ${{ matrix.jdk_version }}
runs-on: ${{ matrix.os }}
env:
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@v4
- name: Install GPG and generate test key
run: .github/install-gpg.sh
- name: Install SDKMAN and java environment
run: |
.github/install-sdkman.sh ${{ matrix.jdk_version }} ${{ matrix.maven_version }}
echo "SDKMAN_DIR=${HOME}/.sdkman" >> $GITHUB_ENV
- name: Add SDKMAN candidate environment variables
run: |
echo "JAVA_HOME=${SDKMAN_DIR}/candidates/java/current" >> $GITHUB_ENV
echo "MAVEN_HOME=${SDKMAN_DIR}/candidates/maven/current" >> $GITHUB_ENV
- name: Add SDKMAN candidate paths to system path
run: |
echo "${JAVA_HOME}/bin" >> $GITHUB_PATH
echo "${MAVEN_HOME}/bin" >> $GITHUB_PATH
- name: Setup Maven repository cache
uses: actions/cache@v4
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: List Maven repositories
run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} dependency:list-repositories
- 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 generate site
run: mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} site site:stage
- 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
- name: Docker maven build
if: ${{ matrix.docker_build }}
env:
CBD: /usr/src/build
P: luminositylabs-oss
run: docker container run --rm -i -v "$(pwd)":"${CBD}" -v ${HOME}/.gnupg:/root/.gnupg -v ${P}-${{ matrix.maven_docker_container_image_tag }}-mvn-repo:/root/.m2 -w "${CBD}" ${{ matrix.maven_docker_container_image_repo }}/${{ matrix.maven_docker_container_image_name }}:${{ matrix.maven_docker_container_image_tag }} mvn -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} -Djavadoc.path=/usr/bin/javadoc -Dmaven.integration.test.skip=true dependency:list-repositories dependency:tree help:active-profiles clean install site site:stage