mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Bumps the github-actions group with 11 updates: | Package | From | To | | --- | --- | --- | | [lukka/get-cmake](https://github.com/lukka/get-cmake) | `4.4.1` | `4.4.2` | | [actions/setup-java](https://github.com/actions/setup-java) | `5.6.0` | `6.0.0` | | [fortran-lang/setup-fortran](https://github.com/fortran-lang/setup-fortran) | `1.9.2` | `1.10.0` | | [EndBug/add-and-commit](https://github.com/endbug/add-and-commit) | `10.0.0` | `11.1.1` | | [dorny/paths-filter](https://github.com/dorny/paths-filter) | `4.0.2` | `4.0.3` | | [github/codeql-action/init](https://github.com/github/codeql-action) | `4.37.3` | `4.37.9` | | [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.37.3` | `4.37.9` | | [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.37.3` | `4.37.9` | | [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) | `1.5.2` | `1.5.5` | | [vmactions/openbsd-vm](https://github.com/vmactions/openbsd-vm) | `1.4.5` | `1.4.7` | | [softprops/action-gh-release](https://github.com/softprops/action-gh-release) | `3.0.2` | `3.0.3` | Updates `lukka/get-cmake` from 4.4.1 to 4.4.2 - [Release notes](https://github.com/lukka/get-cmake/releases) - [Changelog](https://github.com/lukka/get-cmake/blob/main/RELEASE_PROCESS.md) - [Commits](https://github.com/lukka/get-cmake/compare/4a7d025fc60f00db0c7b44ebf783d19b52444830...fffaaafeea488556c2c12dad60690008bc1caacb) Updates `actions/setup-java` from 5.6.0 to 6.0.0 - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/03ad4de0992f5dab5e18fcb136590ce7c4a0ac95...dd06d9cba3e5552c54d9f8ea23572deb30010f7c) Updates `fortran-lang/setup-fortran` from 1.9.2 to 1.10.0 - [Release notes](https://github.com/fortran-lang/setup-fortran/releases) - [Commits](https://github.com/fortran-lang/setup-fortran/compare/195bac823dc6e05bb7c706311ad4540ffc34d5b9...be037f0a45b1160f139d4ccd0b96f9e9bfd6a682) Updates `EndBug/add-and-commit` from 10.0.0 to 11.1.1 - [Release notes](https://github.com/endbug/add-and-commit/releases) - [Commits](https://github.com/endbug/add-and-commit/compare/290ea2c423ad77ca9c62ae0f5b224379612c0321...cc9c08ba6c8df3b93a8f2db63e89b98368ae2ae8) Updates `dorny/paths-filter` from 4.0.2 to 4.0.3 - [Release notes](https://github.com/dorny/paths-filter/releases) - [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md) - [Commits](https://github.com/dorny/paths-filter/compare/7b450fff21473bca461d4b92ce414b9d0420d706...ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d) Updates `github/codeql-action/init` from 4.37.3 to 4.37.9 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...cdf488f595d80d6e07e03d4674febd5ab45fa938) Updates `github/codeql-action/analyze` from 4.37.3 to 4.37.9 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...cdf488f595d80d6e07e03d4674febd5ab45fa938) Updates `github/codeql-action/upload-sarif` from 4.37.3 to 4.37.9 - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v4.37.3...v4.37.9) Updates `vmactions/freebsd-vm` from 1.5.2 to 1.5.5 - [Release notes](https://github.com/vmactions/freebsd-vm/releases) - [Commits](https://github.com/vmactions/freebsd-vm/compare/77ed28d336d03fe19a3f4f7266c1d2c4714dd79d...f0552d3b69211736abd97f02ff3d4674c56b73b1) Updates `vmactions/openbsd-vm` from 1.4.5 to 1.4.7 - [Release notes](https://github.com/vmactions/openbsd-vm/releases) - [Commits](https://github.com/vmactions/openbsd-vm/compare/c941015845c0f0c429676840963dc63b226d4f69...86cdc08415d9d0865267e686561e276c52d62530) Updates `softprops/action-gh-release` from 3.0.2 to 3.0.3 - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/3d0d9888cb7fd7b750713d6e236d1fcb99157228...efb35369e0ad2afab669f228072c1b0d510eae64) --- updated-dependencies: - dependency-name: lukka/get-cmake dependency-version: 4.4.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: actions/setup-java dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: fortran-lang/setup-fortran dependency-version: 1.10.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: EndBug/add-and-commit dependency-version: 11.1.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: dorny/paths-filter dependency-version: 4.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: github/codeql-action/init dependency-version: 4.37.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: github/codeql-action/analyze dependency-version: 4.37.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: github/codeql-action/upload-sarif dependency-version: 4.37.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: vmactions/freebsd-vm dependency-version: 1.5.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: vmactions/openbsd-vm dependency-version: 1.4.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: softprops/action-gh-release dependency-version: 3.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
474 lines
19 KiB
YAML
474 lines
19 KiB
YAML
name: Java Examples Maven Testing
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
build_mode:
|
|
description: "release vs. debug build"
|
|
required: true
|
|
type: string
|
|
maven_artifacts_version:
|
|
description: "HDF5 Maven artifacts version to test against"
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
# Parallel testing by platform and example category
|
|
test-examples-linux:
|
|
name: "Test Examples Linux (${{ matrix.category }})"
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true # Non-blocking failures
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
category: [H5D, H5T, H5G, TUTR]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Download Maven artifacts (Linux)
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: maven-staging-artifacts-linux-x86_64
|
|
path: ./maven-artifacts
|
|
continue-on-error: true
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v5
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
|
|
- name: Cache Maven dependencies
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-maven-examples-${{ hashFiles('**/pom-examples.xml*') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-maven-examples-
|
|
${{ runner.os }}-maven-
|
|
|
|
- name: Identify HDF5 JAR files
|
|
run: |
|
|
echo "=== Identifying HDF5 JAR files ==="
|
|
|
|
# Find HDF5 JAR files (not dependencies)
|
|
HDF5_JARS=$(find ./maven-artifacts -name "*hdf5*.jar" -o -name "jarhdf5*.jar")
|
|
DEP_JARS=$(find ./maven-artifacts -name "*.jar" ! -name "*hdf5*" ! -name "jarhdf5*")
|
|
|
|
echo "HDF5 JARs found:"
|
|
echo "$HDF5_JARS"
|
|
echo ""
|
|
echo "Dependency JARs found:"
|
|
echo "$DEP_JARS"
|
|
|
|
if [ -z "$HDF5_JARS" ]; then
|
|
echo "❌ No HDF5 JAR files found!"
|
|
echo "All available JARs:"
|
|
find ./maven-artifacts -name "*.jar"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Test Examples Category ${{ matrix.category }}
|
|
id: test-examples
|
|
run: |
|
|
cd HDF5Examples/JAVA/${{ matrix.category }}
|
|
|
|
echo "=== Testing ${{ matrix.category }} Examples ==="
|
|
|
|
# Create test results directory
|
|
mkdir -p ../../../test-results/${{ matrix.category }}
|
|
|
|
FAILED_EXAMPLES=""
|
|
TOTAL_EXAMPLES=0
|
|
PASSED_EXAMPLES=0
|
|
|
|
# Test each Java example in the category
|
|
for java_file in *.java; do
|
|
if [ -f "$java_file" ]; then
|
|
TOTAL_EXAMPLES=$((TOTAL_EXAMPLES + 1))
|
|
example_name=$(basename "$java_file" .java)
|
|
echo "--- Testing $example_name ---"
|
|
|
|
# Build classpath (use platform-specific artifacts)
|
|
MAVEN_ARTIFACTS_DIR="../../../maven-artifacts"
|
|
HDF5_JAR=$(find "$MAVEN_ARTIFACTS_DIR" -name "*hdf5*.jar" -o -name "jarhdf5*.jar" | head -1)
|
|
DEP_JARS=$(find "$MAVEN_ARTIFACTS_DIR" -name "slf4j-api*.jar" -o -name "slf4j-simple*.jar")
|
|
|
|
if [ -z "$HDF5_JAR" ]; then
|
|
echo "❌ No HDF5 JAR found"
|
|
find "$MAVEN_ARTIFACTS_DIR" -name "*.jar" | head -10
|
|
continue
|
|
fi
|
|
|
|
CLASSPATH="$HDF5_JAR"
|
|
for dep_jar in $DEP_JARS; do
|
|
CLASSPATH="$CLASSPATH:$dep_jar"
|
|
done
|
|
|
|
# Compile the example
|
|
if javac -cp "$CLASSPATH" "$java_file"; then
|
|
echo "✓ Compilation successful for $example_name"
|
|
|
|
# Run the example and capture output
|
|
if timeout 30s java -cp ".:$CLASSPATH" "$example_name" > "../../../test-results/${{ matrix.category }}/${example_name}.output" 2>&1; then
|
|
# Validate output using pattern matching
|
|
output_file="../../../test-results/${{ matrix.category }}/${example_name}.output"
|
|
|
|
# Check for common success patterns
|
|
if grep -q -i -E "(dataset|datatype|group|success|created|written|read)" "$output_file" && \
|
|
! grep -q -i -E "(error|exception|failed|cannot)" "$output_file"; then
|
|
echo "✓ Execution and validation successful for $example_name"
|
|
PASSED_EXAMPLES=$((PASSED_EXAMPLES + 1))
|
|
else
|
|
echo "✗ Output validation failed for $example_name"
|
|
FAILED_EXAMPLES="$FAILED_EXAMPLES $example_name"
|
|
echo "Output:"
|
|
cat "$output_file"
|
|
fi
|
|
else
|
|
# Check if failure is due to expected native library issue (acceptable for Maven-only testing)
|
|
output_file="../../../test-results/${{ matrix.category }}/${example_name}.output"
|
|
if grep -q "UnsatisfiedLinkError.*hdf5_java.*java.library.path" "$output_file"; then
|
|
echo "✓ Expected native library error for Maven-only testing: $example_name"
|
|
echo " (This confirms JAR structure is correct)"
|
|
PASSED_EXAMPLES=$((PASSED_EXAMPLES + 1))
|
|
else
|
|
echo "✗ Unexpected execution failure for $example_name"
|
|
FAILED_EXAMPLES="$FAILED_EXAMPLES $example_name"
|
|
echo "Output:"
|
|
cat "$output_file"
|
|
fi
|
|
fi
|
|
else
|
|
echo "✗ Compilation failed for $example_name"
|
|
FAILED_EXAMPLES="$FAILED_EXAMPLES $example_name"
|
|
fi
|
|
echo ""
|
|
fi
|
|
done
|
|
|
|
# Summary
|
|
echo "=== ${{ matrix.category }} Summary ==="
|
|
echo "Total examples: $TOTAL_EXAMPLES"
|
|
echo "Passed: $PASSED_EXAMPLES"
|
|
echo "Failed: $((TOTAL_EXAMPLES - PASSED_EXAMPLES))"
|
|
|
|
if [ -n "$FAILED_EXAMPLES" ]; then
|
|
echo "Failed examples:$FAILED_EXAMPLES"
|
|
echo "failed-examples=$FAILED_EXAMPLES" >> $GITHUB_OUTPUT
|
|
echo "test-status=FAILED" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "All examples passed!"
|
|
echo "test-status=PASSED" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
echo "total-examples=$TOTAL_EXAMPLES" >> $GITHUB_OUTPUT
|
|
echo "passed-examples=$PASSED_EXAMPLES" >> $GITHUB_OUTPUT
|
|
|
|
- name: Upload failure artifacts (Linux ${{ matrix.category }})
|
|
if: steps.test-examples.outputs.test-status == 'FAILED'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v5
|
|
with:
|
|
name: java-examples-failure-linux-${{ matrix.category }}-${{ github.run_id }}
|
|
path: |
|
|
test-results/${{ matrix.category }}/
|
|
HDF5Examples/JAVA/${{ matrix.category }}/*.class
|
|
HDF5Examples/JAVA/${{ matrix.category }}/*.h5
|
|
retention-days: 7
|
|
|
|
test-examples-windows:
|
|
name: "Test Examples Windows (${{ matrix.category }})"
|
|
runs-on: windows-latest
|
|
continue-on-error: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
category: [H5D, H5T, H5G, TUTR]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Download Maven artifacts (Windows)
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: maven-staging-artifacts-windows-x86_64
|
|
path: ./maven-artifacts
|
|
continue-on-error: true
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v5
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
|
|
- name: Cache Maven dependencies
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-maven-examples-${{ hashFiles('**/pom-examples.xml*') }}
|
|
|
|
- name: Test Examples Category ${{ matrix.category }}
|
|
id: test-examples
|
|
shell: pwsh
|
|
run: |
|
|
cd HDF5Examples/JAVA/${{ matrix.category }}
|
|
|
|
Write-Host "=== Testing ${{ matrix.category }} Examples ==="
|
|
|
|
# Create test results directory
|
|
New-Item -ItemType Directory -Force -Path "../../../test-results/${{ matrix.category }}"
|
|
|
|
$FAILED_EXAMPLES = @()
|
|
$TOTAL_EXAMPLES = 0
|
|
$PASSED_EXAMPLES = 0
|
|
|
|
# Test each Java example in the category
|
|
Get-ChildItem -Filter "*.java" | ForEach-Object {
|
|
$TOTAL_EXAMPLES++
|
|
$example_name = $_.BaseName
|
|
Write-Host "--- Testing $example_name ---"
|
|
|
|
# Compile the example
|
|
$compile_result = javac -cp "../../../maven-artifacts/*.jar" $_.Name
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "✓ Compilation successful for $example_name"
|
|
|
|
# Run the example and capture output
|
|
$timeout_cmd = "timeout 30s java -cp '.;../../../maven-artifacts/*' $example_name"
|
|
$output_file = "../../../test-results/${{ matrix.category }}/${example_name}.output"
|
|
|
|
try {
|
|
& cmd /c "$timeout_cmd > `"$output_file`" 2>&1"
|
|
if ($LASTEXITCODE -eq 0) {
|
|
# Validate output using pattern matching
|
|
$content = Get-Content $output_file -Raw
|
|
if (($content -match "(?i)(dataset|datatype|group|success|created|written|read)") -and
|
|
($content -notmatch "(?i)(error|exception|failed|cannot)")) {
|
|
Write-Host "✓ Execution and validation successful for $example_name"
|
|
$PASSED_EXAMPLES++
|
|
} else {
|
|
Write-Host "✗ Output validation failed for $example_name"
|
|
$FAILED_EXAMPLES += $example_name
|
|
Write-Host "Output:"
|
|
Get-Content $output_file
|
|
}
|
|
} else {
|
|
Write-Host "✗ Execution failed for $example_name"
|
|
$FAILED_EXAMPLES += $example_name
|
|
}
|
|
} catch {
|
|
Write-Host "✗ Execution failed for $example_name"
|
|
$FAILED_EXAMPLES += $example_name
|
|
}
|
|
} else {
|
|
Write-Host "✗ Compilation failed for $example_name"
|
|
$FAILED_EXAMPLES += $example_name
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
# Summary
|
|
Write-Host "=== ${{ matrix.category }} Summary ==="
|
|
Write-Host "Total examples: $TOTAL_EXAMPLES"
|
|
Write-Host "Passed: $PASSED_EXAMPLES"
|
|
Write-Host "Failed: $($TOTAL_EXAMPLES - $PASSED_EXAMPLES)"
|
|
|
|
if ($FAILED_EXAMPLES.Count -gt 0) {
|
|
Write-Host "Failed examples: $($FAILED_EXAMPLES -join ' ')"
|
|
echo "failed-examples=$($FAILED_EXAMPLES -join ' ')" >> $env:GITHUB_OUTPUT
|
|
echo "test-status=FAILED" >> $env:GITHUB_OUTPUT
|
|
} else {
|
|
Write-Host "All examples passed!"
|
|
echo "test-status=PASSED" >> $env:GITHUB_OUTPUT
|
|
}
|
|
|
|
echo "total-examples=$TOTAL_EXAMPLES" >> $env:GITHUB_OUTPUT
|
|
echo "passed-examples=$PASSED_EXAMPLES" >> $env:GITHUB_OUTPUT
|
|
|
|
- name: Upload failure artifacts (Windows ${{ matrix.category }})
|
|
if: steps.test-examples.outputs.test-status == 'FAILED'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v5
|
|
with:
|
|
name: java-examples-failure-windows-${{ matrix.category }}-${{ github.run_id }}
|
|
path: |
|
|
test-results/${{ matrix.category }}/
|
|
HDF5Examples/JAVA/${{ matrix.category }}/*.class
|
|
HDF5Examples/JAVA/${{ matrix.category }}/*.h5
|
|
|
|
test-examples-macos:
|
|
name: "Test Examples macOS (${{ matrix.category }})"
|
|
runs-on: macos-latest
|
|
continue-on-error: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
category: [H5D, H5T, H5G, TUTR]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Download Maven artifacts (macOS aarch64)
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: maven-staging-artifacts-macos-aarch64
|
|
path: ./maven-artifacts
|
|
continue-on-error: true
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v5
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
|
|
- name: Cache Maven dependencies
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-maven-examples-${{ hashFiles('**/pom-examples.xml*') }}
|
|
|
|
- name: Test Examples Category ${{ matrix.category }}
|
|
id: test-examples
|
|
run: |
|
|
cd HDF5Examples/JAVA/${{ matrix.category }}
|
|
|
|
echo "=== Testing ${{ matrix.category }} Examples ==="
|
|
|
|
# Create test results directory
|
|
mkdir -p ../../../test-results/${{ matrix.category }}
|
|
|
|
FAILED_EXAMPLES=""
|
|
TOTAL_EXAMPLES=0
|
|
PASSED_EXAMPLES=0
|
|
|
|
# Test each Java example in the category
|
|
for java_file in *.java; do
|
|
if [ -f "$java_file" ]; then
|
|
TOTAL_EXAMPLES=$((TOTAL_EXAMPLES + 1))
|
|
example_name=$(basename "$java_file" .java)
|
|
echo "--- Testing $example_name ---"
|
|
|
|
# Build classpath (use platform-specific artifacts)
|
|
MAVEN_ARTIFACTS_DIR="../../../maven-artifacts"
|
|
HDF5_JAR=$(find "$MAVEN_ARTIFACTS_DIR" -name "*hdf5*.jar" -o -name "jarhdf5*.jar" | head -1)
|
|
DEP_JARS=$(find "$MAVEN_ARTIFACTS_DIR" -name "slf4j-api*.jar" -o -name "slf4j-simple*.jar")
|
|
|
|
if [ -z "$HDF5_JAR" ]; then
|
|
echo "❌ No HDF5 JAR found"
|
|
find "$MAVEN_ARTIFACTS_DIR" -name "*.jar" | head -10
|
|
continue
|
|
fi
|
|
|
|
CLASSPATH="$HDF5_JAR"
|
|
for dep_jar in $DEP_JARS; do
|
|
CLASSPATH="$CLASSPATH:$dep_jar"
|
|
done
|
|
|
|
# Compile the example
|
|
if javac -cp "$CLASSPATH" "$java_file"; then
|
|
echo "✓ Compilation successful for $example_name"
|
|
|
|
# Run the example and capture output
|
|
if timeout 30s java -cp ".:$CLASSPATH" "$example_name" > "../../../test-results/${{ matrix.category }}/${example_name}.output" 2>&1; then
|
|
# Validate output using pattern matching
|
|
output_file="../../../test-results/${{ matrix.category }}/${example_name}.output"
|
|
|
|
# Check for common success patterns
|
|
if grep -q -i -E "(dataset|datatype|group|success|created|written|read)" "$output_file" && \
|
|
! grep -q -i -E "(error|exception|failed|cannot)" "$output_file"; then
|
|
echo "✓ Execution and validation successful for $example_name"
|
|
PASSED_EXAMPLES=$((PASSED_EXAMPLES + 1))
|
|
else
|
|
echo "✗ Output validation failed for $example_name"
|
|
FAILED_EXAMPLES="$FAILED_EXAMPLES $example_name"
|
|
fi
|
|
else
|
|
echo "✗ Execution failed for $example_name"
|
|
FAILED_EXAMPLES="$FAILED_EXAMPLES $example_name"
|
|
fi
|
|
else
|
|
echo "✗ Compilation failed for $example_name"
|
|
FAILED_EXAMPLES="$FAILED_EXAMPLES $example_name"
|
|
fi
|
|
echo ""
|
|
fi
|
|
done
|
|
|
|
# Summary
|
|
echo "=== ${{ matrix.category }} Summary ==="
|
|
echo "Total examples: $TOTAL_EXAMPLES"
|
|
echo "Passed: $PASSED_EXAMPLES"
|
|
echo "Failed: $((TOTAL_EXAMPLES - PASSED_EXAMPLES))"
|
|
|
|
if [ -n "$FAILED_EXAMPLES" ]; then
|
|
echo "Failed examples:$FAILED_EXAMPLES"
|
|
echo "failed-examples=$FAILED_EXAMPLES" >> $GITHUB_OUTPUT
|
|
echo "test-status=FAILED" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "All examples passed!"
|
|
echo "test-status=PASSED" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
echo "total-examples=$TOTAL_EXAMPLES" >> $GITHUB_OUTPUT
|
|
echo "passed-examples=$PASSED_EXAMPLES" >> $GITHUB_OUTPUT
|
|
|
|
- name: Upload failure artifacts (macOS ${{ matrix.category }})
|
|
if: steps.test-examples.outputs.test-status == 'FAILED'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v5
|
|
with:
|
|
name: java-examples-failure-macos-${{ matrix.category }}-${{ github.run_id }}
|
|
path: |
|
|
test-results/${{ matrix.category }}/
|
|
HDF5Examples/JAVA/${{ matrix.category }}/*.class
|
|
HDF5Examples/JAVA/${{ matrix.category }}/*.h5
|
|
|
|
analyze-cross-platform-failures:
|
|
name: "Analyze Cross-Platform Failures"
|
|
runs-on: ubuntu-latest
|
|
needs: [test-examples-linux, test-examples-windows, test-examples-macos]
|
|
if: always()
|
|
steps:
|
|
- name: Collect Test Results
|
|
run: |
|
|
echo "=== Java Examples Testing Summary ==="
|
|
|
|
# Collect results from matrix outputs (this would need to be enhanced
|
|
# to actually collect the outputs from the matrix jobs)
|
|
|
|
echo "Cross-platform failure analysis:"
|
|
echo "- Examples failing on multiple platforms require attention"
|
|
echo "- Single-platform failures may be platform-specific issues"
|
|
|
|
# This step would analyze patterns in failures across platforms
|
|
# and generate appropriate alerts/issues for multi-platform failures
|
|
|
|
- name: Generate Test Summary Report
|
|
run: |
|
|
cat > java-examples-test-summary.md << 'EOF'
|
|
# Java Examples Maven Testing Summary
|
|
|
|
**Build Mode**: ${{ inputs.build_mode }}
|
|
**Maven Version**: ${{ inputs.maven_artifacts_version }}
|
|
**Date**: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
|
|
|
## Platform Results
|
|
- **Linux**: See individual category results
|
|
- **Windows**: See individual category results
|
|
- **macOS**: See individual category results
|
|
|
|
## Cross-Platform Analysis
|
|
Examples failing on multiple platforms require investigation.
|
|
|
|
EOF
|
|
|
|
echo "Test summary report generated"
|
|
|
|
- name: Upload Test Summary
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v5
|
|
with:
|
|
name: java-examples-test-summary-${{ github.run_id }}
|
|
path: java-examples-test-summary.md
|
|
retention-days: 30 |