Skip to content

Commit 1eda997

Browse files
committed
Merge branch 'staging' into release
2 parents 6ff37eb + d8e2fd6 commit 1eda997

36 files changed

Lines changed: 3927 additions & 895 deletions

.github/workflows/ci.yml

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI
33
env:
44
HDF5_VERSION: 1.12.2
55
HDF5_CACHE_VERSION: v3
6+
CDASH_SUBMIT: ${{ (github.event_name == 'push' && github.ref_name == 'release') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'cdash')) }}
67

78
on:
89
push:
@@ -328,7 +329,17 @@ jobs:
328329
run: cmake --build build --parallel --config Release
329330

330331
- name: Test
331-
run: ctest --test-dir build -C Release --output-on-failure
332+
shell: bash
333+
run: |
334+
set -euxo pipefail
335+
if [ "$CDASH_SUBMIT" = "true" ]; then
336+
ctest -D Experimental --test-dir build -C Release --output-on-failure
337+
else
338+
ctest --test-dir build -C Release --output-on-failure
339+
fi
340+
env:
341+
CTEST_SITE: "github-actions"
342+
CTEST_BUILD_NAME: "${{ matrix.os }}-${{ matrix.compiler }}"
332343

333344
- name: Record Badge Status
334345
if: always()
@@ -402,7 +413,14 @@ jobs:
402413
shell: bash
403414
env:
404415
ASAN_OPTIONS: "detect_leaks=1:halt_on_error=1:abort_on_error=1:strict_string_checks=1"
405-
run: ctest --test-dir build --output-on-failure
416+
CTEST_SITE: "github-actions"
417+
CTEST_BUILD_NAME: "asan-ubuntu-24.04-clang-20"
418+
run: |
419+
if [ "$CDASH_SUBMIT" = "true" ]; then
420+
ctest -D Experimental --test-dir build --output-on-failure
421+
else
422+
ctest --test-dir build --output-on-failure
423+
fi
406424
407425
- name: Record Badge Status
408426
if: always()
@@ -475,7 +493,14 @@ jobs:
475493
shell: bash
476494
env:
477495
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
478-
run: ctest --test-dir build --output-on-failure
496+
CTEST_SITE: "github-actions"
497+
CTEST_BUILD_NAME: "ubsan-ubuntu-24.04-clang-20"
498+
run: |
499+
if [ "$CDASH_SUBMIT" = "true" ]; then
500+
ctest -D Experimental --test-dir build --output-on-failure
501+
else
502+
ctest --test-dir build --output-on-failure
503+
fi
479504
480505
- name: Record Badge Status
481506
if: always()
@@ -499,10 +524,93 @@ jobs:
499524
name: status-ubsan
500525
path: badge-status/status-ubsan.json
501526

527+
tsan:
528+
name: tsan / ubuntu-24.04 / clang-20
529+
runs-on: ubuntu-24.04
530+
timeout-minutes: 45
531+
532+
concurrency:
533+
group: tsan-${{ github.ref }}
534+
cancel-in-progress: true
535+
536+
steps:
537+
- name: Checkout
538+
uses: actions/checkout@v6
539+
with:
540+
fetch-depth: 0
541+
542+
- name: Install dependencies
543+
shell: bash
544+
run: |
545+
set -euxo pipefail
546+
sudo apt-get update
547+
sudo apt-get install -y cmake ninja-build wget gnupg lsb-release software-properties-common libhdf5-dev
548+
wget https://apt.llvm.org/llvm.sh
549+
chmod +x llvm.sh
550+
sudo ./llvm.sh 20 all
551+
echo "CC=$(command -v clang-20)" >> "$GITHUB_ENV"
552+
echo "CXX=$(command -v clang++-20)" >> "$GITHUB_ENV"
553+
554+
- name: Configure
555+
shell: bash
556+
run: |
557+
set -euxo pipefail
558+
cmake -S . -B build -G Ninja \
559+
-DCMAKE_C_COMPILER="$CC" \
560+
-DCMAKE_CXX_COMPILER="$CXX" \
561+
-DCMAKE_CXX_STANDARD=17 \
562+
-DCMAKE_BUILD_TYPE=Debug \
563+
-DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer -O1 -g" \
564+
-DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer -O1 -g" \
565+
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" \
566+
-DH5CPP_BUILD_TESTS=ON
567+
568+
- name: Build
569+
shell: bash
570+
run: cmake --build build --parallel
571+
572+
- name: Test
573+
shell: bash
574+
env:
575+
# halt_on_error=1: TSAN exits on the first data race so CI fails loud.
576+
# second_deadlock_stack=1: print full stack of the lock that completed
577+
# the cycle (default prints only one stack for the offending pair).
578+
TSAN_OPTIONS: "halt_on_error=1:second_deadlock_stack=1"
579+
CTEST_SITE: "github-actions"
580+
CTEST_BUILD_NAME: "tsan-ubuntu-24.04-clang-20"
581+
run: |
582+
if [ "$CDASH_SUBMIT" = "true" ]; then
583+
ctest -D Experimental --test-dir build --output-on-failure
584+
else
585+
ctest --test-dir build --output-on-failure
586+
fi
587+
588+
- name: Record Badge Status
589+
if: always()
590+
shell: bash
591+
run: |
592+
set -euxo pipefail
593+
mkdir -p badge-status
594+
cat <<EOF > badge-status/status-tsan.json
595+
{
596+
"os": "ubuntu-24.04",
597+
"compiler": "clang-20",
598+
"label": "TSan",
599+
"status": "${{ job.status }}"
600+
}
601+
EOF
602+
603+
- name: Upload Status Artifact
604+
if: always()
605+
uses: actions/upload-artifact@v7
606+
with:
607+
name: status-tsan
608+
path: badge-status/status-tsan.json
609+
502610
badge:
503611
name: Generate SVG Badges
504612
if: always()
505-
needs: [build, asan, ubsan]
613+
needs: [build, asan, ubsan, tsan]
506614
runs-on: ubuntu-24.04
507615

508616
steps:
@@ -648,8 +756,8 @@ jobs:
648756
-DCMAKE_CXX_STANDARD=20 \
649757
-DCMAKE_C_COMPILER=gcc-14 \
650758
-DCMAKE_CXX_COMPILER=g++-14 \
651-
-DCMAKE_C_FLAGS="--coverage -O0 -g" \
652-
-DCMAKE_CXX_FLAGS="--coverage -O0 -g" \
759+
-DCMAKE_C_FLAGS="--coverage -fprofile-update=atomic -O0 -g" \
760+
-DCMAKE_CXX_FLAGS="--coverage -fprofile-update=atomic -O0 -g" \
653761
-DH5CPP_BUILD_TESTS=ON \
654762
-DH5CPP_BUILD_EXAMPLES=ON
655763
@@ -661,9 +769,16 @@ jobs:
661769
662770
- name: Test
663771
shell: bash
772+
env:
773+
CTEST_SITE: "github-actions"
774+
CTEST_BUILD_NAME: "coverage-ubuntu-24.04-gcc-14"
664775
run: |
665776
set -euxo pipefail
666-
ctest --test-dir build --output-on-failure --parallel
777+
if [ "$CDASH_SUBMIT" = "true" ]; then
778+
ctest -D Experimental --test-dir build --output-on-failure --parallel
779+
else
780+
ctest --test-dir build --output-on-failure --parallel
781+
fi
667782
668783
- name: Capture coverage
669784
shell: bash

.github/workflows/package.yml

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ jobs:
8686

8787
- name: Configure
8888
run: |
89+
HDF5_PREFIX="$(brew --prefix hdf5)"
8990
cmake -B build \
9091
-DCMAKE_BUILD_TYPE=Release \
9192
-DCMAKE_INSTALL_PREFIX=/usr/local \
92-
-DHDF5_ROOT=$(brew --prefix hdf5) \
93+
-DHDF5_ROOT="$HDF5_PREFIX" \
94+
-DCMAKE_PREFIX_PATH="$HDF5_PREFIX" \
9395
-DH5CPP_BUILD_EXAMPLES=OFF \
9496
-DH5CPP_BUILD_TESTS=OFF \
9597
-DH5CPP_BUILD_BENCH=OFF
@@ -107,21 +109,100 @@ jobs:
107109
if-no-files-found: error
108110

109111
# ── Windows (NSIS .exe) ───────────────────────────────────────────────────────
112+
# No Chocolatey 'hdf5' package exists; mirror the build-from-source approach
113+
# from ci.yml. zlib is built fresh each run (~30s); HDF5 install prefix is
114+
# cached between runs.
110115
package-windows:
111116
name: windows / x64 / NSIS
112117
runs-on: windows-latest
118+
env:
119+
HDF5_VERSION: 1.12.2
120+
HDF5_CACHE_VERSION: v3
113121

114122
steps:
115123
- uses: actions/checkout@v4
116124

117-
- name: Install HDF5
118-
run: choco install hdf5 -y --no-progress
125+
- name: Build zlib from source
126+
shell: powershell
127+
run: |
128+
$ErrorActionPreference = "Stop"
129+
$zlib_version = "1.3.1"
130+
$zlib_archive = "$env:RUNNER_TEMP\zlib-$zlib_version.tar.gz"
131+
$zlib_source = "$env:RUNNER_TEMP\zlib-$zlib_version"
132+
$zlib_build = "$env:RUNNER_TEMP\zlib-build"
133+
$zlib_prefix = "$env:RUNNER_TEMP\zlib-install"
134+
135+
Invoke-WebRequest `
136+
-Uri "https://github.com/madler/zlib/archive/refs/tags/v$zlib_version.tar.gz" `
137+
-OutFile $zlib_archive
138+
tar -xzf $zlib_archive -C $env:RUNNER_TEMP
139+
140+
cmake -S $zlib_source -B $zlib_build `
141+
-G "Visual Studio 17 2022" -A x64 `
142+
-DCMAKE_INSTALL_PREFIX="$zlib_prefix"
143+
cmake --build $zlib_build --parallel --config Release
144+
cmake --install $zlib_build --config Release
145+
146+
- name: Restore HDF5 cache
147+
id: cache-hdf5
148+
uses: actions/cache/restore@v5
149+
with:
150+
path: ${{ runner.temp }}\hdf5-${{ env.HDF5_VERSION }}-install
151+
key: hdf5-windows-vs2022-${{ env.HDF5_VERSION }}-pkg-${{ env.HDF5_CACHE_VERSION }}
152+
153+
- name: Build HDF5 from source
154+
if: steps.cache-hdf5.outputs.cache-hit != 'true'
155+
shell: powershell
156+
run: |
157+
$ErrorActionPreference = "Stop"
158+
$hdf5_version = "${{ env.HDF5_VERSION }}"
159+
$hdf5_archive = "$env:RUNNER_TEMP\hdf5-$hdf5_version.tar.gz"
160+
$hdf5_source = "$env:RUNNER_TEMP\hdf5-$hdf5_version"
161+
$hdf5_build = "$env:RUNNER_TEMP\hdf5-$hdf5_version-build"
162+
$hdf5_prefix = "$env:RUNNER_TEMP\hdf5-$hdf5_version-install"
163+
164+
Invoke-WebRequest `
165+
-Uri "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-$hdf5_version/src/hdf5-$hdf5_version.tar.gz" `
166+
-OutFile $hdf5_archive
167+
tar -xzf $hdf5_archive -C $env:RUNNER_TEMP
168+
169+
cmake -S $hdf5_source -B $hdf5_build `
170+
-G "Visual Studio 17 2022" -A x64 `
171+
-DCMAKE_INSTALL_PREFIX="$hdf5_prefix" `
172+
-DHDF_CFG_NAME=Release `
173+
-DBUILD_SHARED_LIBS=ON `
174+
-DBUILD_TESTING=OFF `
175+
-DHDF5_BUILD_TOOLS=OFF `
176+
-DHDF5_BUILD_UTILS=OFF `
177+
-DHDF5_BUILD_EXAMPLES=OFF `
178+
-DHDF5_BUILD_CPP_LIB=OFF `
179+
-DHDF5_BUILD_HL_LIB=OFF `
180+
-DHDF5_BUILD_FORTRAN=OFF `
181+
-DHDF5_ENABLE_Z_LIB_SUPPORT=ON `
182+
-DHDF5_ENABLE_SZIP_SUPPORT=OFF `
183+
-DZLIB_USE_EXTERNAL=OFF `
184+
-DZLIB_INCLUDE_DIR="$env:RUNNER_TEMP/zlib-install/include" `
185+
-DZLIB_LIBRARY="$env:RUNNER_TEMP/zlib-install/lib/zlib.lib"
186+
187+
cmake --build $hdf5_build --parallel --config Release
188+
cmake --install $hdf5_build --config Release
189+
190+
- name: Save HDF5 cache
191+
if: steps.cache-hdf5.outputs.cache-hit != 'true'
192+
uses: actions/cache/save@v5
193+
with:
194+
path: ${{ runner.temp }}\hdf5-${{ env.HDF5_VERSION }}-install
195+
key: ${{ steps.cache-hdf5.outputs.cache-primary-key }}
119196

120197
- name: Configure
121198
shell: pwsh
122199
run: |
200+
$hdf5_prefix = "$env:RUNNER_TEMP/hdf5-${{ env.HDF5_VERSION }}-install"
201+
$zlib_prefix = "$env:RUNNER_TEMP/zlib-install"
123202
cmake -B build `
124203
-DCMAKE_BUILD_TYPE=Release `
204+
-DHDF5_ROOT="$hdf5_prefix" `
205+
-DCMAKE_PREFIX_PATH="$hdf5_prefix;$zlib_prefix" `
125206
-DH5CPP_BUILD_EXAMPLES=OFF `
126207
-DH5CPP_BUILD_TESTS=OFF `
127208
-DH5CPP_BUILD_BENCH=OFF `

CMakeLists.txt

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,24 @@ if(APPLE)
1212
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.4" CACHE STRING "Minimum macOS deployment version")
1313
endif()
1414

15-
project(libh5cpp-dev VERSION 1.10.4.6 LANGUAGES CXX C)
15+
# Derive package version from the latest git tag before project(), so CPack
16+
# embeds it as PROJECT_VERSION rather than a stale hardcoded number. Falls
17+
# back to a placeholder when building from a tarball without git history.
18+
find_package(Git QUIET)
19+
set(H5CPP_PROJECT_VERSION "1.12.0")
20+
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
21+
execute_process(
22+
COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0 --match "v[0-9]*"
23+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
24+
OUTPUT_VARIABLE H5CPP_GIT_TAG
25+
OUTPUT_STRIP_TRAILING_WHITESPACE
26+
ERROR_QUIET)
27+
if(H5CPP_GIT_TAG MATCHES "^v([0-9]+(\\.[0-9]+)*)$")
28+
set(H5CPP_PROJECT_VERSION "${CMAKE_MATCH_1}")
29+
endif()
30+
endif()
31+
32+
project(libh5cpp-dev VERSION ${H5CPP_PROJECT_VERSION} LANGUAGES CXX C)
1633

1734
# ─── Standard Settings ────────────────────────────────────────────────────────────
1835
set(CMAKE_CXX_STANDARD 20)
@@ -90,9 +107,22 @@ find_package(Threads REQUIRED QUIET)
90107
# ─── HDF5 ─────────────────────────────────────────────────────────────────────────
91108
find_package(HDF5 REQUIRED COMPONENTS C)
92109

93-
if(HDF5_VERSION VERSION_LESS ${H5CPP_BASE_VERSION})
110+
# HDF5 floor is decoupled from h5cpp package version. Previously the check
111+
# compared HDF5_VERSION against PROJECT_VERSION, which coupled package
112+
# versioning to HDF5 minimums by coincidence. After #247 made
113+
# PROJECT_VERSION track the git tag, the comparison stopped being meaningful.
114+
# Pin the floor explicitly.
115+
#
116+
# 1.10.4 matches the prior implicit floor (the stale project(VERSION 1.10.4.6)
117+
# line that #247 removed). The CI matrix runs Ubuntu 22.04 with system
118+
# HDF5 1.10.7 (floor coverage restored by #235); raising the floor above
119+
# 1.10.4 would break that matrix entry. When dropping 1.10.x coverage in
120+
# a future cohort, bump this constant deliberately and remove the 22.04
121+
# matrix entry in the same commit.
122+
set(H5CPP_HDF5_FLOOR "1.10.4")
123+
if(HDF5_VERSION VERSION_LESS ${H5CPP_HDF5_FLOOR})
94124
message(FATAL_ERROR
95-
"-- !!! H5CPP examples require HDF5 v${H5CPP_BASE_VERSION} or greater !!!"
125+
"-- !!! H5CPP requires HDF5 v${H5CPP_HDF5_FLOOR} or greater (found ${HDF5_VERSION}) !!!"
96126
)
97127
else()
98128
message(STATUS
@@ -237,8 +267,8 @@ if(H5CPP_BUILD_EXAMPLES)
237267
add_subdirectory(examples)
238268
endif()
239269

240-
enable_testing()
241-
if(H5CPP_BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt)
270+
include(CTest)
271+
if(H5CPP_BUILD_TESTS AND BUILD_TESTING AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt)
242272
add_subdirectory(test)
243273
endif()
244274

@@ -382,6 +412,14 @@ set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
382412
# productbuild (macOS .pkg)
383413
set(CPACK_PRODUCTBUILD_IDENTIFIER "org.h5cpp.h5cpp")
384414

415+
# Override the default per-generator filename so that amd64 / arm64 / x86_64 /
416+
# aarch64 / darwin-arm64 / windows-amd64 produce distinct names when collected
417+
# into a single release upload directory. Without this, multi-arch CI matrix
418+
# builds emit identical filenames and overwrite each other on the Release page.
419+
set(CPACK_PACKAGE_FILE_NAME
420+
"${CPACK_PACKAGE_NAME}-v${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
421+
string(TOLOWER "${CPACK_PACKAGE_FILE_NAME}" CPACK_PACKAGE_FILE_NAME)
422+
385423
include(CPack)
386424

387425
# ─── Developer convenience targets ───────────────────────────────────────────

CTestConfig.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(CTEST_PROJECT_NAME "h5cpp")
2+
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
3+
4+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
5+
set(CTEST_SUBMIT_URL "https://my.cdash.org/submit.php?project=h5cpp")
6+
else()
7+
set(CTEST_DROP_METHOD "https")
8+
set(CTEST_DROP_SITE "my.cdash.org")
9+
set(CTEST_DROP_LOCATION "/submit.php?project=h5cpp")
10+
endif()
11+
12+
set(CTEST_DROP_SITE_CDASH TRUE)

CTestCustom.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1048576)
2+
set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1048576)
3+
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 100)
4+
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 100)

0 commit comments

Comments
 (0)