-
Notifications
You must be signed in to change notification settings - Fork 94
114 lines (104 loc) · 4.13 KB
/
Copy pathCI.yml
File metadata and controls
114 lines (104 loc) · 4.13 KB
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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_linux:
runs-on: ubuntu-latest
services:
postgres:
image: imresamu/postgis:17-3.5
env:
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
POSTGRES_USER: noisemodelling
POSTGRES_PASSWORD: noisemodelling
POSTGRES_DB: noisemodelling_db
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Cache
uses: actions/cache@v4
with:
path: |
$HOME/.m2/
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
# Checkout the source code of the project
- name: Checkout
uses: actions/checkout@v4
# Setup the jdk using version 11 of Adoptium Temurin
- name: Setup java 25 using Adoptium Temurin
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '25'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Building
run: mvn test install javadoc:jar package -B
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: noisemodelling_db
POSTGRES_USER: noisemodelling
POSTGRES_PASSWORD: noisemodelling
- name: Unzip production artifacts
run: |
# 1. Unzip into a temporary directory
unzip -q noisemodelling-scripts/target/*.zip -d tmp_extract
# 2. Create target directory
mkdir NoiseModelling
# 3. Move contents from the subfolder to the target
# The asterisk-slash-asterisk moves everything inside the first subfolder
mv tmp_extract/*/* NoiseModelling/
# 4. Cleanup
rm -rf tmp_extract
- name: Integration test, use ScriptRunner with H2GIS
run: |
bin/ScriptRunner -w /tmp/h2gis_ws -s get_started_tutorial_complex.groovy
working-directory: NoiseModelling
- name: Integration test, use ScriptRunner with PostGIS
run: |
bin/ScriptRunner -w /tmp/postgis_ws -s get_started_tutorial_complex.groovy --host localhost --user noisemodelling --password noisemodelling --port 5432 --database noisemodelling_db
working-directory: NoiseModelling
- name: Maven Deploy snapshot
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
if: ${{ (env.MAVEN_USERNAME != null) && (github.ref == 'refs/heads/main') }}
run: mvn clean -DskipTests deploy -B
- name: Generate Sanitized Artifact Name
id: sanitize
run: |
# Determine the raw value (Ref name if not default branch, otherwise SHA)
if [ "${{ github.ref_name }}" != "${{ github.event.repository.default_branch }}" ]; then
RAW_VAL="${{ github.ref_name }}"
else
RAW_VAL="${{ github.sha }}"
fi
# Use sed to perform replacements:
# 1. / and \ become _
# 2. : is removed
# 3. * becomes x
CLEAN_VAL=$(echo "$RAW_VAL" | sed 's/[\/\\]/_/g; s/://g; s/\*/x/g')
# Set it as an environment variable for the next step
echo "ARTIFACT_NAME=NoiseModelling-$CLEAN_VAL" >> $GITHUB_ENV
- name: Upload distribution file
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: NoiseModelling/
build_windows:
uses: ./.github/workflows/build_windows.yml
with:
git_ref: ${{ github.ref }}