-
-
Notifications
You must be signed in to change notification settings - Fork 26
466 lines (403 loc) · 17.9 KB
/
Copy pathci-windows.yml
File metadata and controls
466 lines (403 loc) · 17.9 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
name: CI - Windows
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 - tests are skipped but keeping consistent
MAVEN_OPTS: >-
-Xmx2g
-Xms1g
-XX:+UseParallelGC
-XX:+TieredCompilation
-XX:TieredStopAtLevel=1
jobs:
build-and-test-windows:
name: Build and Test (Windows)
runs-on: windows-latest
timeout-minutes: 35
strategy:
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- 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'
shell: pwsh
run: |
$HDF4_VERSION = "${{ inputs.hdf4_version }}"
Write-Host "Downloading HDF4 $HDF4_VERSION release..."
$PATTERN = "hdf$HDF4_VERSION-win-vs2022_cl.zip"
Write-Host "Using pattern: $PATTERN"
gh release download hdf$HDF4_VERSION `
--repo HDFGroup/hdf4 `
--pattern "$PATTERN" `
--clobber
Write-Host "Extracting HDF4..."
7z x -y *-win-vs2022_cl.zip
Set-Location hdf4
7z x -y HDF-*-win64.zip
# Windows structure: hdf4/HDF-<version>-win64/lib, hdf4/HDF-<version>-win64/bin
$HDF4DIR = Get-Item "HDF-$HDF4_VERSION-win64"
$HDF4LIB_PATH = $HDF4DIR.FullName
echo "HDF4LIB_PATH=$HDF4LIB_PATH" >> $env:GITHUB_ENV
Write-Host "HDF4 installed to: $HDF4LIB_PATH"
env:
GH_TOKEN: ${{ github.token }}
- name: Download and Install HDF5 from GitHub
if: steps.cache-hdf.outputs.cache-hit != 'true'
shell: pwsh
run: |
$HDF5_VERSION = "${{ inputs.hdf5_version }}"
Write-Host "Downloading HDF5 $HDF5_VERSION release..."
gh release download $HDF5_VERSION `
--repo HDFGroup/hdf5 `
--pattern "hdf5-$HDF5_VERSION-win-vs2022_cl.zip" `
--clobber
Write-Host "Extracting HDF5..."
7z x -y hdf5-*-win-vs2022_cl.zip
Set-Location hdf5
7z x -y HDF5-*-win64.zip
# Windows structure: hdf5/HDF5-x.y.z-win64/lib, hdf5/HDF5-x.y.z-win64/bin
# Find the extracted HDF5-*-win64 directory
$HDF5DIR = Get-ChildItem -Path . -Filter "HDF5-*-win64" -Directory | Select-Object -First 1
if (-not $HDF5DIR) {
Write-Error "HDF5-*-win64 directory not found!"
Get-ChildItem -Directory | ForEach-Object { Write-Host $_.Name }
exit 1
}
$HDF5LIB_PATH = $HDF5DIR.FullName
echo "HDF5LIB_PATH=$HDF5LIB_PATH" >> $env:GITHUB_ENV
Write-Host "HDF5 installed to: $HDF5LIB_PATH"
env:
GH_TOKEN: ${{ github.token }}
- name: Set Environment Variables from Cache
if: steps.cache-hdf.outputs.cache-hit == 'true'
shell: pwsh
run: |
Set-Location hdf4
$HDF4DIR = Get-ChildItem -Path . -Filter "HDF-*-win64" -Directory | Select-Object -First 1
$HDF4LIB_PATH = $HDF4DIR.FullName
echo "HDF4LIB_PATH=$HDF4LIB_PATH" >> $env:GITHUB_ENV
Set-Location ../hdf5
$HDF5DIR = Get-ChildItem -Path . -Filter "HDF5-*-win64" -Directory | Select-Object -First 1
$HDF5LIB_PATH = $HDF5DIR.FullName
echo "HDF5LIB_PATH=$HDF5LIB_PATH" >> $env:GITHUB_ENV
Write-Host "Using cached HDF libraries:"
Write-Host "HDF4: $HDF4LIB_PATH"
Write-Host "HDF5: $HDF5LIB_PATH"
- name: Install HDF JARs to Local Maven Repository
shell: pwsh
run: |
Write-Host "Installing HDF JARs to local Maven repository..."
# Copy HDF JARs from downloaded distributions
New-Item -Path "repository\lib" -ItemType Directory -Force | Out-Null
# Copy JARs (they're in lib/ directory on Windows too)
if (Test-Path "$env:HDF4LIB_PATH\lib\*.jar") {
Copy-Item "$env:HDF4LIB_PATH\lib\*.jar" -Destination "repository\lib\" -ErrorAction SilentlyContinue
} else {
Write-Host "No HDF4 JARs found"
}
if (Test-Path "$env:HDF5LIB_PATH\lib\*.jar") {
Copy-Item "$env:HDF5LIB_PATH\lib\*.jar" -Destination "repository\lib\" -ErrorAction SilentlyContinue
} else {
Write-Host "No HDF5 JARs found"
}
# List what we have
Write-Host "JARs in repository\lib:"
if (Test-Path "repository\lib\*.jar") {
Get-ChildItem "repository\lib\*.jar" | Format-Table Name, Length
} else {
Write-Host "No JARs found"
}
# Install jarhdf5
$HDF5_VERSION = "${{ inputs.hdf5_version }}"
$jarhdf5 = Get-ChildItem "repository\lib\jarhdf5-*.jar" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($jarhdf5) {
mvn install:install-file "-Dfile=$($jarhdf5.FullName)" `
"-DgroupId=jarhdf5" "-DartifactId=jarhdf5" "-Dversion=$HDF5_VERSION" `
"-Dpackaging=jar" "-DgeneratePom=true"
Write-Host "Installed: $($jarhdf5.Name)"
}
# Install jarhdf
$HDF4_VERSION = "${{ inputs.hdf4_version }}"
$jarhdf = Get-ChildItem "repository\lib\jarhdf-*.jar" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($jarhdf) {
mvn install:install-file "-Dfile=$($jarhdf.FullName)" `
"-DgroupId=jarhdf" "-DartifactId=jarhdf" "-Dversion=$HDF4_VERSION" `
"-Dpackaging=jar" "-DgeneratePom=true"
Write-Host "Installed: $($jarhdf.Name)"
}
# Install fits.jar
$jarfits = Get-ChildItem "repository\lib\fits.jar" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($jarfits) {
mvn install:install-file "-Dfile=$($jarfits.FullName)" `
"-DgroupId=fits" "-DartifactId=fits" "-Dversion=1.0.0" `
"-Dpackaging=jar" "-DgeneratePom=true"
Write-Host "Installed: $($jarfits.Name)"
}
# Install netcdf.jar
$jarnetcdf = Get-ChildItem "repository\lib\netcdf.jar" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($jarnetcdf) {
mvn install:install-file "-Dfile=$($jarnetcdf.FullName)" `
"-DgroupId=netcdf" "-DartifactId=netcdf" "-Dversion=1.0.0" `
"-Dpackaging=jar" "-DgeneratePom=true"
Write-Host "Installed: $($jarnetcdf.Name)"
}
# Install slf4j-api if present
$slf4j = Get-ChildItem "repository\lib\slf4j-api-*.jar" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($slf4j) {
$version = $slf4j.Name -replace 'slf4j-api-([0-9.]+)\.jar', '$1'
mvn install:install-file "-Dfile=$($slf4j.FullName)" `
"-DgroupId=org.slf4j" "-DartifactId=slf4j-api" "-Dversion=$version" `
"-Dpackaging=jar" "-DgeneratePom=true"
Write-Host "Installed: $($slf4j.Name)"
}
# Install SWTBot JARs for UI testing
$finderjar = Get-ChildItem "repository\lib\org.eclipse.swtbot.swt.finder.jar" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($finderjar) {
mvn install:install-file "-Dfile=$($finderjar.FullName)" `
"-DgroupId=org.eclipse.local" "-DartifactId=org.eclipse.swtbot.swt.finder" "-Dversion=4.2.1" `
"-Dpackaging=jar" "-DgeneratePom=true"
Write-Host "Installed: $($finderjar.Name)"
}
$nattablejar = Get-ChildItem "repository\lib\org.eclipse.swtbot.nebula.nattable.finder.jar" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($nattablejar) {
mvn install:install-file "-Dfile=$($nattablejar.FullName)" `
"-DgroupId=org.eclipse.local" "-DartifactId=org.eclipse.swtbot.nebula.nattable.finder" "-Dversion=4.2.1" `
"-Dpackaging=jar" "-DgeneratePom=true"
Write-Host "Installed: $($nattablejar.Name)"
}
- name: Set up build.properties
shell: pwsh
run: |
# Convert Windows paths to use forward slashes (Java/Maven compatible)
$HDF5_PATH = $env:HDF5LIB_PATH -replace '\\', '/'
$HDF4_PATH = $env:HDF4LIB_PATH -replace '\\', '/'
$buildProps = @"
# CI Build Properties for HDFView (Windows)
# Generated automatically for GitHub Actions
# Using HDF libraries from GitHub releases
# HDF5 Configuration
hdf5.lib.dir=$HDF5_PATH/lib
hdf5.plugin.dir=$HDF5_PATH/lib/plugin
# HDF4 Configuration
hdf.lib.dir=$HDF4_PATH/lib
# Platform Configuration (Windows DLLs are in bin, not lib)
platform.hdf.lib=$HDF5_PATH/bin;$HDF4_PATH/bin
# CI-specific settings
ci.build=true
skip.native.tests=false
"@
$buildProps | Out-File -FilePath "build.properties" -Encoding utf8
Write-Host "Generated build.properties for CI:"
Get-Content "build.properties"
# Set PATH for DLL loading (Windows uses PATH not LD_LIBRARY_PATH)
$newPath = "$env:HDF5LIB_PATH\bin;$env:HDF4LIB_PATH\bin;$env:PATH"
echo "PATH=$newPath" >> $env:GITHUB_ENV
# Also set for current session
$env:PATH = $newPath
- name: Validate Maven Configuration
shell: pwsh
run: |
mvn help:effective-pom -q > effective-pom.log
Write-Host "Maven configuration validated"
Write-Host "Active profiles:"
mvn help:active-profiles
- name: Maven Compile
shell: pwsh
run: |
Write-Host "::group::Maven Compile"
mvn clean compile -B `
"-Dmaven.compiler.showDeprecation=false" `
"-Dmaven.compiler.showWarnings=false"
Write-Host "::endgroup::"
- name: Run Tests
shell: pwsh
run: |
Write-Host "::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
# UI tests should be run locally before merging
mvn test -B -pl object "-Dmaven.test.failure.ignore=false"
Write-Host "::endgroup::"
- name: Package Application
shell: pwsh
run: |
Write-Host "::group::Package Application"
mvn package "-DskipTests" -B
Write-Host "::endgroup::"
- name: Verify Build Artifacts
shell: pwsh
run: |
Write-Host "Build artifacts created:"
Get-ChildItem -Recurse -Filter "*.jar" | Select-Object -First 10 | Format-Table FullName
Write-Host "Library artifacts:"
if (Test-Path "libs\") {
Get-ChildItem "libs\" | Format-Table Name, Length
} else {
Write-Host "No libs directory found"
}
Write-Host "Target artifacts:"
Get-ChildItem -Recurse -Path "target" -Filter "*.jar" -ErrorAction SilentlyContinue | Select-Object -First 5 | Format-Table FullName
- name: Create jpackage App Image
shell: pwsh
run: |
Write-Host "::group::Create jpackage App Image"
Write-Host "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
Write-Host "Verifying jpackage output..."
if (Test-Path "hdfview\target\dist\HDFView") {
Write-Host "✓ jpackage app-image created successfully"
$dirSize = (Get-ChildItem -Path "hdfview\target\dist\HDFView" -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB
Write-Host "Package size: $([math]::Round($dirSize, 2)) MB"
$dllCount = (Get-ChildItem -Path "hdfview\target\dist\HDFView\app" -Recurse -Filter "*.dll" -ErrorAction SilentlyContinue).Count
Write-Host "Native libraries: $dllCount .dll files"
$jarCount = (Get-ChildItem -Path "hdfview\target\dist\HDFView\app" -Recurse -Filter "*.jar" -ErrorAction SilentlyContinue).Count
Write-Host "JAR files: $jarCount JARs"
$pluginCount = (Get-ChildItem -Path "hdfview\target\dist\HDFView\app\plugin" -Filter "*.dll" -ErrorAction SilentlyContinue).Count
Write-Host "HDF5 plugins: $pluginCount plugins"
} else {
Write-Host "✗ jpackage app-image creation failed"
exit 1
}
Write-Host "::endgroup::"
- name: Upload jpackage App Image
uses: actions/upload-artifact@v4
if: success()
with:
name: hdfview-app-image-windows-${{ github.run_number }}
path: hdfview/target/dist/HDFView/
retention-days: 7
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
continue-on-error: true
with:
name: Maven Test Results (Windows)
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-windows-${{ 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-windows-${{ github.run_number }}
path: |
libs/*.jar
target/*.jar
hdfview/target/*.jar
object/target/*.jar
retention-days: 7
- name: Build Summary
if: always()
shell: pwsh
run: |
$summary = @"
## Build Summary (Windows)
- **Status**: ${{ job.status }}
- **Platform**: Windows $(Get-ComputerInfo | Select-Object -ExpandProperty OsVersion)
- **Architecture**: $env:PROCESSOR_ARCHITECTURE
- **Java Version**: $(java -version 2>&1 | Select-Object -First 1)
- **Maven Version**: $(mvn --version | Select-Object -First 1)
- **Build Time**: $(Get-Date)
"@
$summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
if (Test-Path "target\surefire-reports\TEST-*.xml") {
"- **Test Results**: Available in artifacts" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
}
"`n### Artifacts Generated" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
$jars = Get-ChildItem -Recurse -Filter "*.jar" | Where-Object { $_.LastWriteTime -gt (Get-Date).AddMinutes(-10) } | Select-Object -First 5
if ($jars) {
foreach ($jar in $jars) {
"- $($jar.FullName)" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
}
} else {
"- No JAR artifacts found" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
}
# Add jpackage summary
if (Test-Path "hdfview\target\dist\HDFView") {
"`n### jpackage App Image" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
$dirSize = (Get-ChildItem -Path "hdfview\target\dist\HDFView" -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1MB
"- **Size**: $([math]::Round($dirSize, 2)) MB" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
$dllCount = (Get-ChildItem -Path "hdfview\target\dist\HDFView\app" -Recurse -Filter "*.dll" -ErrorAction SilentlyContinue).Count
"- **Native Libraries**: $dllCount .dll files" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
$jarCount = (Get-ChildItem -Path "hdfview\target\dist\HDFView\app" -Recurse -Filter "*.jar" -ErrorAction SilentlyContinue).Count
"- **JAR Files**: $jarCount JARs" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
$pluginCount = (Get-ChildItem -Path "hdfview\target\dist\HDFView\app\plugin" -Filter "*.dll" -ErrorAction SilentlyContinue).Count
"- **HDF5 Plugins**: $pluginCount compression plugins" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
}