-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (114 loc) · 3.87 KB
/
ubuntu-maven.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: 'Maven build'
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release' ) && format('ci-master-{0}', github.sha) || format('ci-master-{0}', github.ref) }}
cancel-in-progress: true
env:
PGPASSWORD: postgres
PGUSER: postgres
PGDATABASE: postgres
jobs:
build:
name: "Java ${{ matrix.java }} / ${{ matrix.profile }} / PostGIS ${{ matrix.postgis }} build"
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11 ]
java_dist: [ 'temurin' ]
profile: [ hsqldb, postgresql ]
postgis: [ 16-3.4-alpine ]
include:
- java: 17
java_dist: 'temurin'
postgis: 16-3.4-alpine
profile: 'postgresql'
- java: 21
java_dist: 'zulu'
postgis: 16-3.4-alpine
profile: 'postgresql'
services:
postgis:
image: postgis/postgis:${{ matrix.postgis }}
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 15s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
- name: 'Set up JDK'
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: ${{ matrix.java_dist }}
cache: 'maven'
- name: 'QA build with Maven'
run: mvn -B -V -fae -DskipQA=false -Dfmt.action=check -Dpom.fmt.action=verify -Ddocker.skip=true -Dtest.onlyITs= -Dmaven.test.skip=true clean package
- name: 'Set up PostGIS database'
if: ${{ matrix.profile == 'postgresql' }}
run: |
psql --version
psql -U postgres -h localhost -c 'SELECT version();'
.build/ci/pgsql-setup.sh
- name: 'Priming build'
run: mvn install -Dmaven.test.skip=true -B -V -e -fae -q -P${{ matrix.profile }}
- name: 'Test'
run: mvn -e test -B -P${{ matrix.profile }}
- name: 'Verify'
run: mvn -e verify -B -P${{ matrix.profile }} -T1 -Dtest.onlyITs=true
- name: 'Javadoc'
run: |
mvn javadoc:javadoc
mvn javadoc:test-javadoc
- name: 'Upload codecoverage'
uses: codecov/codecov-action@v4
deploy:
name: Deploy artifacts
runs-on: ubuntu-latest
needs: build
permissions:
packages: write
contents: read
if: ${{ ( github.ref == 'refs/heads/master' ) && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) }}
steps:
- uses: actions/checkout@v4
- name: 'Set up JDK'
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: 'Build and Push'
# no need to run any QC or tests
env:
B3P_DEPLOY_ACTOR: ${{ secrets.B3P_DEPLOY_ACTOR }}
B3P_DEPLOY_TOKEN: ${{ secrets.B3P_DEPLOY_TOKEN }}
run: |
mvn -B -V -fae -Dmaven.test.skip=true clean deploy --settings .github/maven-settings.xml
- name: 'Deploy SBOM'
uses: DependencyTrack/gh-upload-sbom@v3
with:
serverhostname: ${{ secrets.DEPENDENCY_TRACK_HOSTNAME }}
apikey: ${{ secrets.DEPENDENCY_TRACK_APIKEY }}
project: 'f22983c2-33f3-4303-9682-f31f7492501b'
bomfilename: 'target/bom.xml'
cleanup:
name: 'Maven cache cleanup'
if: ${{ always() }}
needs: [ build, deploy ]
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- name: 'Cleanup snapshot cache'
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}