Repository navigation
511 lines (440 loc) · 19.6 KB
/
Copy pathci-linux.yml
File metadata and controls
511 lines (440 loc) · 19.6 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
name: CI - Linux
on:
workflow_call:
inputs:
hdf4_version:
description: 'HDF4 version to use (default: hdf.version in pom.xml)'
type: string
required: false
default: ''
hdf5_version:
description: 'HDF5 version to use (default: hdf5.version in pom.xml)'
type: string
required: false
default: ''
workflow_dispatch:
inputs:
hdf4_version:
description: 'HDF4 version to use (default: hdf.version in pom.xml)'
type: string
required: false
default: ''
hdf5_version:
description: 'HDF5 version to use (default: hdf5.version in pom.xml)'
type: string
required: false
default: ''
permissions:
contents: read
checks: write
pull-requests: write
env:
# JVM configuration for CI performance
# Note: java.awt.headless NOT set to true - SWT GUI tests need display (Xvfb)
MAVEN_OPTS: >-
-Xmx2g
-Xms1g
-XX:+UseParallelGC
-XX:+TieredCompilation
-XX:TieredStopAtLevel=1
jobs:
build-and-test:
name: Build and Test (Linux)
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better analysis
- name: Resolve HDF library versions
uses: ./.github/actions/resolve-hdf-versions
with:
hdf4_version: ${{ inputs.hdf4_version }}
hdf5_version: ${{ inputs.hdf5_version }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Maven Dependencies
uses: actions/cache@v4
with:
path: |
~/.m2/repository
!~/.m2/repository/org/hdfgroup
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'object/pom.xml', 'hdfview/pom.xml', 'repository/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache HDF Libraries
id: cache-hdf
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/hdf4
${{ github.workspace }}/hdf5
key: ${{ runner.os }}-hdf-github-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-hdf-github-
- name: Download and Install HDF4 from GitHub
if: steps.cache-hdf.outputs.cache-hit != 'true'
run: |
HDF4_VERSION="${{ env.HDF4_VERSION }}"
echo "Downloading HDF4 ${HDF4_VERSION} release..."
PATTERN="hdf${HDF4_VERSION}-ubuntu-2404_gcc.tar.gz"
echo "Using pattern $PATTERN"
gh release download hdf${HDF4_VERSION} \
--repo HDFGroup/hdf4 \
--pattern "$PATTERN" \
--clobber
echo "After gh download"
ls
# Extract outer tar.gz (creates hdf4/ directory)
tar -zxvf *-ubuntu-2404_gcc.tar.gz
[ -d hdf4 ] || mv hdf4-* hdf4
# Extract inner tar.gz into hdf4/ directory
cd "${{ github.workspace }}/hdf4"
echo "Before extracting inner tar.gz"
ls
tar -zxvf HDF-${HDF4_VERSION}-Linux.tar.gz --strip-components 1
# Set HDF4 library path
HDF4LIB_PATH=${{ github.workspace }}/hdf4/HDF_Group/HDF/${HDF4_VERSION}
echo "HDF4LIB_PATH=$HDF4LIB_PATH" >> $GITHUB_ENV
echo "HDF4 installed to: $HDF4LIB_PATH"
ls -la "$HDF4LIB_PATH"
env:
GH_TOKEN: ${{ github.token }}
- name: Download and Install HDF5 from GitHub
if: steps.cache-hdf.outputs.cache-hit != 'true'
run: |
HDF5_VERSION="${{ env.HDF5_VERSION }}"
echo "Downloading HDF5 ${HDF5_VERSION} release..."
PATTERN="hdf5-${HDF5_VERSION}-ubuntu-2404_gcc.tar.gz"
gh release download ${HDF5_VERSION} \
--repo HDFGroup/hdf5 \
--pattern "$PATTERN" \
--clobber
# Extract outer tar.gz (creates hdf5/ directory)
tar -zxvf $PATTERN
[ -d hdf5 ] || mv hdf5-* hdf5
# Extract inner tar.gz into hdf5/ directory
cd "${{ github.workspace }}/hdf5"
tar -zxvf HDF5-${HDF5_VERSION}-Linux.tar.gz --strip-components 1
# Set HDF5 library path
HDF5LIB_PATH=${{ github.workspace }}/hdf5/HDF_Group/HDF5/${HDF5_VERSION}
echo "HDF5LIB_PATH=$HDF5LIB_PATH" >> $GITHUB_ENV
echo "HDF5 installed to: $HDF5LIB_PATH"
ls -la "$HDF5LIB_PATH"
env:
GH_TOKEN: ${{ github.token }}
- name: Set Environment Variables from Cache
if: steps.cache-hdf.outputs.cache-hit == 'true'
run: |
HDF4_VERSION="${{ env.HDF4_VERSION }}"
HDF5_VERSION="${{ env.HDF5_VERSION }}"
HDF4LIB_PATH=${{ github.workspace }}/hdf4/HDF_Group/HDF/${HDF4_VERSION}
echo "HDF4LIB_PATH=$HDF4LIB_PATH" >> $GITHUB_ENV
HDF5LIB_PATH=${{ github.workspace }}/hdf5/HDF_Group/HDF5/${HDF5_VERSION}
echo "HDF5LIB_PATH=$HDF5LIB_PATH" >> $GITHUB_ENV
echo "Using cached HDF libraries:"
echo "HDF4: $HDF4LIB_PATH"
echo "HDF5: $HDF5LIB_PATH"
- name: Install HDF JARs to Local Maven Repository
run: |
echo "Installing HDF JARs to local Maven repository..."
# Copy HDF JARs from downloaded distributions
mkdir -p repository/lib
cp ${{ env.HDF4LIB_PATH }}/lib/*.jar repository/lib/ 2>/dev/null || echo "No HDF4 JARs found"
cp ${{ env.HDF5LIB_PATH }}/lib/*.jar repository/lib/ 2>/dev/null || echo "No HDF5 JARs found"
# List what we have
echo "JARs in repository/lib:"
ls -la repository/lib/*.jar 2>/dev/null || echo "No JARs found"
# Install jarhdf5
HDF5_VERSION="${{ env.HDF5_VERSION }}"
if [ -f repository/lib/jarhdf5-*.jar ]; then
JAR_FILE=$(ls repository/lib/jarhdf5-*.jar | head -1)
mvn install:install-file -Dfile="$JAR_FILE" \
-DgroupId=jarhdf5 -DartifactId=jarhdf5 -Dversion=${HDF5_VERSION} \
-Dpackaging=jar -DgeneratePom=true
echo "Installed: $JAR_FILE"
fi
# Install jarhdf (HDF4)
HDF4_VERSION="${{ env.HDF4_VERSION }}"
if [ -f repository/lib/jarhdf-*.jar ]; then
JAR_FILE=$(ls repository/lib/jarhdf-*.jar | head -1)
mvn install:install-file -Dfile="$JAR_FILE" \
-DgroupId=jarhdf -DartifactId=jarhdf -Dversion=${HDF4_VERSION} \
-Dpackaging=jar -DgeneratePom=true
echo "Installed: $JAR_FILE"
fi
# Install fits.jar
if [ -f repository/lib/fits.jar ]; then
mvn install:install-file -Dfile=repository/lib/fits.jar \
-DgroupId=fits -DartifactId=fits -Dversion=1.0.0 \
-Dpackaging=jar -DgeneratePom=true
echo "Installed: fits.jar"
fi
# Install netcdf.jar
if [ -f repository/lib/netcdf.jar ]; then
mvn install:install-file -Dfile=repository/lib/netcdf.jar \
-DgroupId=netcdf -DartifactId=netcdf -Dversion=1.0.0 \
-Dpackaging=jar -DgeneratePom=true
echo "Installed: netcdf.jar"
fi
# Install slf4j-api if present
if [ -f repository/lib/slf4j-api-*.jar ]; then
JAR_FILE=$(ls repository/lib/slf4j-api-*.jar | head -1)
VERSION=$(echo "$JAR_FILE" | grep -oP 'slf4j-api-\K[0-9.]+')
mvn install:install-file -Dfile="$JAR_FILE" \
-DgroupId=org.slf4j -DartifactId=slf4j-api -Dversion="$VERSION" \
-Dpackaging=jar -DgeneratePom=true
echo "Installed: $JAR_FILE"
fi
# Install SWTBot JARs for UI testing
if [ -f repository/lib/org.eclipse.swtbot.swt.finder.jar ]; then
mvn install:install-file -Dfile=repository/lib/org.eclipse.swtbot.swt.finder.jar \
-DgroupId=org.eclipse.local -DartifactId=org.eclipse.swtbot.swt.finder -Dversion=4.2.1 \
-Dpackaging=jar -DgeneratePom=true
echo "Installed: org.eclipse.swtbot.swt.finder.jar"
fi
if [ -f repository/lib/org.eclipse.swtbot.nebula.nattable.finder.jar ]; then
mvn install:install-file -Dfile=repository/lib/org.eclipse.swtbot.nebula.nattable.finder.jar \
-DgroupId=org.eclipse.local -DartifactId=org.eclipse.swtbot.nebula.nattable.finder -Dversion=4.2.1 \
-Dpackaging=jar -DgeneratePom=true
echo "Installed: org.eclipse.swtbot.nebula.nattable.finder.jar"
fi
- name: Set up build.properties
run: |
cat > build.properties << EOF
# CI Build Properties for HDFView
# Generated automatically for GitHub Actions
# Using HDF libraries from GitHub releases
# HDF5 Configuration
hdf5.lib.dir=${{ env.HDF5LIB_PATH }}/lib
hdf5.plugin.dir=${{ env.HDF5LIB_PATH }}/lib/plugin
# HDF4 Configuration
hdf.lib.dir=${{ env.HDF4LIB_PATH }}/lib
# Platform Configuration
# Both library directories. This value becomes -Djava.library.path for the test
# forks, which replaces the JVM's default.
platform.hdf.lib=${{ env.HDF5LIB_PATH }}/lib:${{ env.HDF4LIB_PATH }}/lib
# CI-specific settings
ci.build=true
skip.native.tests=false
EOF
echo "Generated build.properties for CI:"
cat build.properties
# Set LD_LIBRARY_PATH for test execution
echo "LD_LIBRARY_PATH=${{ env.HDF5LIB_PATH }}/lib:${{ env.HDF4LIB_PATH }}/lib" >> $GITHUB_ENV
- name: Validate Maven Configuration
run: |
mvn help:effective-pom -q > effective-pom.log
echo "Maven configuration validated"
echo "Active profiles:"
mvn help:active-profiles
- name: Maven Compile
run: |
echo "::group::Maven Compile"
mvn clean compile -B \
-Dmaven.compiler.showDeprecation=false \
-Dmaven.compiler.showWarnings=false
echo "::endgroup::"
- name: Set up Xvfb for Headless GUI Testing
run: |
echo "Installing Xvfb, GTK and a window manager for headless SWT testing..."
sudo apt-get update
# metacity: SWTBot resolves widgets against Display.getActiveShell(), and on a bare X
# server with no window manager nothing ever becomes active, so every lookup that waits
# on shell activation would time out. x11-utils supplies xdpyinfo and xprop for the
# readiness checks below.
sudo apt-get install -y xvfb libgtk-3-0 libgtk-3-dev x11-xserver-utils x11-utils metacity
echo "Xvfb, GTK and metacity installed successfully"
- name: Run Tests
run: |
echo "::group::Run All Tests"
# Install parent POM first (required for child module resolution)
mvn install -B -N -Ddependency-check.skip=true
# Compile repository module (sets up dependencies but don't install)
mvn compile -B -pl repository -Ddependency-check.skip=true
# Install object and hdfview modules (needed for testing)
# Skip repository install (tries to install files that don't exist in CI)
mvn install -B -pl object,hdfview -DskipTests -Ddependency-check.skip=true
# Object module tests. These are blocking - they have passed on all three
# OSes for a long time and a regression here is a real failure.
mvn test -B -pl object -Dmaven.test.failure.ignore=false
echo "::endgroup::"
- name: Package Application
run: |
echo "::group::Package Application"
mvn package -DskipTests -B
echo "::endgroup::"
- name: Verify Build Artifacts
run: |
echo "Build artifacts created:"
find . -name "*.jar" -type f | head -10
echo "Library artifacts:"
ls -la libs/ || echo "No libs directory found"
echo "Target artifacts:"
find target -name "*.jar" -type f 2>/dev/null | head -5 || echo "No target JARs found"
- name: Run UI Tests
# TBD: This step will not be able to fail the job until
# the underlying bugs that CI is detecting are fixed.
# Once that is done, remove continue-on-error.
continue-on-error: true
timeout-minutes: 30
run: |
echo "::group::Run UI Tests (SWTBot under Xvfb)"
# Started by hand rather than through xvfb-run because the window manager has to join
# the same display, which xvfb-run's single-command wrapper does not allow.
Xvfb :99 -screen 0 1280x1024x24 -nolisten tcp &
export DISPLAY=:99
for i in $(seq 1 30); do
xdpyinfo -display :99 >/dev/null 2>&1 && break
sleep 1
done
xdpyinfo -display :99 >/dev/null 2>&1 || { echo "Xvfb never accepted connections"; exit 1; }
echo "Xvfb is up on :99"
# Without a window manager no shell ever becomes active, and the waits on shell
# activation in closeFile() and openDataObject() time out and fail the test.
# Start metacity and wait for it to own the display before running the tests.
metacity --sm-disable --display=:99 &
for i in $(seq 1 20); do
xprop -display :99 -root _NET_SUPPORTING_WM_CHECK 2>/dev/null | grep -q "window id" && break
sleep 1
done
if xprop -display :99 -root _NET_SUPPORTING_WM_CHECK 2>/dev/null | grep -q "window id"; then
echo "metacity is managing :99"
else
echo "WARNING: no window manager on :99 - shell activation waits will time out"
fi
mvn test -B -pl hdfview
echo "::endgroup::"
- name: UI Test Summary
if: always()
continue-on-error: true
run: |
# Surface the counts in the job log even when the step above was cut short, so a
# run is never just a red X with no numbers attached.
python3 - <<'EOF' >> $GITHUB_STEP_SUMMARY
import glob, os, xml.etree.ElementTree as ET
files = glob.glob("hdfview/target/surefire-reports/*.xml")
print("## UI tests\n")
if not files:
print("No surefire XML was written - the suite did not get far enough to report.")
else:
tot = fail = err = skip = 0
rows = []
bad = []
for f in sorted(files):
# A fork killed by a timeout can leave a half-written XML behind. Report that
# file as unreadable rather than letting ParseError abort the whole summary
# halfway through the table, which looks like the suite simply stopped.
try:
r = ET.parse(f).getroot()
except Exception as exc:
bad.append((os.path.basename(f), type(exc).__name__))
continue
t = int(r.get("tests", 0)); fl = int(r.get("failures", 0))
e = int(r.get("errors", 0)); s = int(r.get("skipped", 0))
tot += t; fail += fl; err += e; skip += s
rows.append((r.get("name", f), t, fl, e, s))
print(f"**{tot} tests, {fail} failures, {err} errors, {skip} skipped** "
f"across {len(rows)} classes\n")
print("| Class | Tests | Failures | Errors | Skipped |")
print("| --- | --- | --- | --- | --- |")
for n, t, fl, e, s in rows:
print(f"| {n} | {t} | {fl} | {e} | {s} |")
for n, why in bad:
print(f"| {n} | unreadable ({why}) | | | |")
EOF
cat $GITHUB_STEP_SUMMARY
# Scoped to the object module on purpose. This action publishes a check run, and a check
# is not covered by the step's continue-on-error - so globbing '**' would put the
# UI failures into a failing check on every PR. The UI tier reports through the
# summary step above and the uploaded surefire artifacts below.
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
continue-on-error: true
with:
name: Maven Test Results (Linux)
path: 'object/target/surefire-reports/*.xml'
reporter: java-junit
fail-on-error: false
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-linux-${{ github.run_number }}
path: |
**/target/surefire-reports/
**/target/failsafe-reports/
retention-days: 30
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: build-artifacts-linux-${{ github.run_number }}
path: |
libs/*.jar
target/*.jar
hdfview/target/*.jar
object/target/*.jar
retention-days: 7
- name: Create jpackage App Image
run: |
echo "::group::Create jpackage App Image"
echo "Creating distributable application package with jpackage..."
# Create app-image
# -pl object,hdfview: Build object and hdfview modules (skip repository - causes install-file errors)
# -Dmaven.test.skip=true: Skip test compilation and execution
# -Djacoco.skip=true: Skip JaCoCo (code coverage already done in test step)
# -Dpmd.skip=true: Skip PMD (static analysis already done in maven-quality.yml workflow)
# Skip dependency-check (already runs in maven-security.yml workflow)
mvn verify -Pjpackage-app-image -pl object,hdfview -Dmaven.test.skip=true -Djacoco.skip=true -Dpmd.skip=true -Ddependency-check.skip=true -B
echo "Verifying jpackage output..."
if [ -d hdfview/target/dist/HDFView ]; then
echo "✓ jpackage app-image created successfully"
echo "Package size: $(du -sh hdfview/target/dist/HDFView | cut -f1)"
echo "Native libraries: $(find hdfview/target/dist/HDFView/lib/app -name "*.so" | wc -l) .so files"
echo "JAR files: $(find hdfview/target/dist/HDFView/lib/app -name "*.jar" | wc -l) JARs"
echo "HDF5 plugins: $(ls -1 hdfview/target/dist/HDFView/lib/app/plugin/*.so 2>/dev/null | wc -l) plugins"
else
echo "✗ jpackage app-image creation failed"
exit 1
fi
echo "::endgroup::"
- name: Upload jpackage App Image
uses: actions/upload-artifact@v4
if: success()
with:
name: hdfview-app-image-linux-${{ github.run_number }}
path: hdfview/target/dist/HDFView/
retention-days: 7
- name: Build Summary
if: always()
run: |
echo "## Build Summary (Linux)" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
echo "- **Java Version**: $(java -version 2>&1 | head -n1)" >> $GITHUB_STEP_SUMMARY
echo "- **Maven Version**: $(mvn --version | head -n1)" >> $GITHUB_STEP_SUMMARY
echo "- **Build Time**: $(date)" >> $GITHUB_STEP_SUMMARY
if [ -f target/surefire-reports/TEST-*.xml ]; then
echo "- **Test Results**: Available in artifacts" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Artifacts Generated" >> $GITHUB_STEP_SUMMARY
find . -name "*.jar" -newer build.properties 2>/dev/null | \
head -5 | sed 's/^/- /' >> $GITHUB_STEP_SUMMARY || \
echo "- No JAR artifacts found" >> $GITHUB_STEP_SUMMARY
# Add jpackage summary
if [ -d hdfview/target/dist/HDFView ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "### jpackage App Image" >> $GITHUB_STEP_SUMMARY
echo "- **Size**: $(du -sh hdfview/target/dist/HDFView 2>/dev/null | cut -f1)" >> $GITHUB_STEP_SUMMARY
echo "- **Native Libraries**: $(find hdfview/target/dist/HDFView/lib/app -name "*.so" 2>/dev/null | wc -l) .so files" >> $GITHUB_STEP_SUMMARY
echo "- **JAR Files**: $(find hdfview/target/dist/HDFView/lib/app -name "*.jar" 2>/dev/null | wc -l) JARs" >> $GITHUB_STEP_SUMMARY
echo "- **HDF5 Plugins**: $(ls -1 hdfview/target/dist/HDFView/lib/app/plugin/*.so 2>/dev/null | wc -l) compression plugins" >> $GITHUB_STEP_SUMMARY
fi