-
-
Notifications
You must be signed in to change notification settings - Fork 25
419 lines (354 loc) · 15 KB
/
ci-linux.yml
File metadata and controls
419 lines (354 loc) · 15 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
name: CI - Linux
on:
workflow_call:
inputs:
hdf4_version:
description: 'HDF4 version to use'
type: string
required: false
default: '4.3.1'
hdf5_version:
description: 'HDF5 version to use'
type: string
required: false
default: '2.0.0'
workflow_dispatch:
inputs:
hdf4_version:
description: 'HDF4 version to use'
type: string
required: false
default: '4.3.1'
hdf5_version:
description: 'HDF5 version to use'
type: string
required: false
default: '2.0.0'
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: 15
strategy:
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better analysis
- 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="${{ inputs.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="${{ inputs.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="${{ inputs.hdf4_version }}"
HDF5_VERSION="${{ inputs.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="${{ inputs.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="${{ inputs.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
platform.hdf.lib=${{ env.HDF5LIB_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 and GTK dependencies for headless SWT testing..."
sudo apt-get update
sudo apt-get install -y xvfb libgtk-3-0 libgtk-3-dev x11-xserver-utils
echo "Xvfb and GTK 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
# Run object tests only (all 149 tests passing)
# HDFView UI tests disabled in CI - require real display, not Xvfb
# UI tests should be run locally before merging
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: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
continue-on-error: true
with:
name: Maven Test Results (Linux)
path: '**/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