Skip to content

Commit 1db8630

Browse files
committed
Merge branch '5-ci-add-github-actions-ci-with-compileros-matrix' into release
2 parents bba0fcf + 47102c1 commit 1db8630

File tree

2 files changed

+274
-64
lines changed

2 files changed

+274
-64
lines changed

.github/workflows/ci.yml

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ release, staging ]
6+
pull_request:
7+
branches: [ release, staging ]
8+
9+
jobs:
10+
build:
11+
name: ${{ matrix.os }} / ${{ matrix.compiler }}
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
# , macos-13, macos-14, windows-latest
18+
os: [ubuntu-22.04, ubuntu-24.04, macos-latest, windows-latest]
19+
compiler: [gcc-13, gcc-14, gcc-15, clang-14, clang-15, clang-17]
20+
include:
21+
- compiler: gcc-13
22+
compiler-version: 13
23+
- compiler: gcc-14
24+
compiler-version: 14
25+
- compiler: gcc-15
26+
compiler-version: 15
27+
- compiler: clang-14
28+
compiler-version: 14
29+
- compiler: clang-15
30+
compiler-version: 15
31+
- compiler: clang-17
32+
compiler-version: 17
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Set badge output directory
38+
id: path
39+
shell: bash
40+
run: |
41+
if [[ "${GITHUB_REF##*/}" == "staging" ]]; then
42+
echo "dir=status-staging" >> $GITHUB_OUTPUT
43+
else
44+
echo "dir=status" >> $GITHUB_OUTPUT
45+
fi
46+
47+
- name: Check skip list
48+
id: skip_check
49+
shell: bash
50+
run: |
51+
skip_list=(
52+
"ubuntu-22.04:gcc-13" "ubuntu-22.04:gcc-14" "ubuntu-22.04:gcc-15"
53+
"ubuntu-22.04:clang-14" "ubuntu-22.04:clang-15" "ubuntu-22.04:clang-17"
54+
"ubuntu-24.04:gcc-13" "ubuntu-24.04:gcc-14" "ubuntu-24.04:gcc-15"
55+
"ubuntu-24.04:clang-14" "ubuntu-24.04:clang-15"
56+
"macos-latest:gcc-13" "macos-latest:gcc-14" "macos-latest:gcc-15"
57+
"macos-latest:clang-14" "macos-latest:clang-15" "macos-latest:clang-17"
58+
"windows-latest:gcc-13" "windows-latest:gcc-14" "windows-latest:gcc-15"
59+
"windows-latest:clang-14" "windows-latest:clang-15" "windows-latest:clang-17"
60+
)
61+
62+
combo="${{ matrix.os }}:${{ matrix.compiler }}"
63+
echo "Checking combination: $combo"
64+
for skip in "${skip_list[@]}"; do
65+
if [[ "$combo" == "$skip" ]]; then
66+
echo "SKIP_COMPILE=true" >> "$GITHUB_ENV"
67+
exit 0
68+
fi
69+
done
70+
echo "SKIP_COMPILE=false" >> "$GITHUB_ENV"
71+
72+
# Linux compiler setup
73+
- name: Setup compiler on Linux
74+
if: ${{ env.SKIP_COMPILE == 'false' && runner.os == 'Linux' }}
75+
run: |
76+
compiler="${{ matrix.compiler }}"
77+
version="${{ matrix.compiler-version }}"
78+
79+
if [[ "$compiler" == clang-* ]]; then
80+
sudo apt-get update
81+
sudo apt-get install -y wget gnupg lsb-release software-properties-common
82+
wget https://apt.llvm.org/llvm.sh
83+
chmod +x llvm.sh
84+
sudo DISTRIB_CODENAME=jammy ./llvm.sh "$version" all
85+
CXX="clang++-$version"
86+
elif [[ "$compiler" == gcc-* ]]; then
87+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
88+
sudo apt-get update
89+
sudo apt-get install -y g++-"$version"
90+
CXX="g++-$version"
91+
else
92+
CXX="g++"
93+
fi
94+
95+
which "$CXX" || { echo "$CXX not found in PATH"; exit 1; }
96+
echo "CXX=$(which $CXX)" >> "$GITHUB_ENV"
97+
98+
# macOS compiler setup
99+
- name: Setup compiler on macOS
100+
if: ${{ env.SKIP_COMPILE == 'false' && runner.os == 'macOS' }}
101+
run: |
102+
brew install llvm@${{ matrix.compiler-version }}
103+
echo "CC=$(brew --prefix llvm@${{ matrix.compiler-version }})/bin/clang" >> $GITHUB_ENV
104+
echo "CXX=$(brew --prefix llvm@${{ matrix.compiler-version }})/bin/clang++" >> $GITHUB_ENV
105+
106+
# Windows compiler setup
107+
- name: Setup compiler on Windows
108+
if: ${{ env.SKIP_COMPILE == 'false' && runner.os == 'Windows' }}
109+
shell: pwsh
110+
run: |
111+
$version = "${{ matrix.compiler-version }}"
112+
choco install llvm --version=$version -y
113+
echo "CXX=clang++" | Out-File -FilePath $env:GITHUB_ENV -Append
114+
115+
- name: Checkout
116+
uses: actions/checkout@v4
117+
with:
118+
fetch-depth: 0
119+
120+
# --- Install HDF5 on all OSes ---
121+
- name: Install HDF5 on Linux
122+
if: ${{ env.SKIP_COMPILE == 'false' && runner.os == 'Linux' }}
123+
run: |
124+
sudo apt-get update
125+
sudo apt-get install -y libhdf5-dev
126+
127+
- name: Install HDF5 on macOS
128+
if: ${{ env.SKIP_COMPILE == 'false' && runner.os == 'macOS' }}
129+
run: |
130+
brew install hdf5
131+
132+
- name: Install HDF5 on Windows
133+
if: ${{ env.SKIP_COMPILE == 'false' && runner.os == 'Windows' }}
134+
shell: pwsh
135+
run: |
136+
choco install hdf5 -y
137+
138+
# --- Build/Test ---
139+
- name: Configure
140+
if: env.SKIP_COMPILE == 'false'
141+
run: cmake -B build -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release
142+
143+
- name: Build
144+
if: env.SKIP_COMPILE == 'false'
145+
run: cmake --build build --parallel
146+
147+
- name: Test
148+
if: env.SKIP_COMPILE == 'false'
149+
run: ctest --test-dir build --output-on-failure
150+
151+
- name: Record Badge Status
152+
if: always()
153+
shell: bash
154+
run: |
155+
mkdir -p badge-status
156+
status="skipped"
157+
if [[ "$SKIP_COMPILE" == "false" ]]; then
158+
status="${{ job.status }}"
159+
fi
160+
161+
cat <<EOF > badge-status/status-${{ matrix.os }}-${{ matrix.compiler }}.json
162+
{
163+
"os": "${{ matrix.os }}",
164+
"compiler": "${{ matrix.compiler }}",
165+
"status": "$status"
166+
}
167+
EOF
168+
- name: Upload Status Artifact
169+
if: always()
170+
uses: actions/upload-artifact@v4
171+
with:
172+
name: status-${{ matrix.os }}-${{ matrix.compiler }}
173+
path: badge-status/status-${{ matrix.os }}-${{ matrix.compiler }}.json
174+
175+
generate-badges:
176+
name: Generate SVG Badges
177+
runs-on: ubuntu-latest
178+
needs: build
179+
if: always()
180+
181+
steps:
182+
- uses: actions/checkout@v4
183+
184+
- name: Determine badge target directory
185+
id: badge_dir
186+
run: |
187+
if [[ "${GITHUB_REF##*/}" == "staging" ]]; then
188+
echo "dir=badges-staging" >> $GITHUB_OUTPUT
189+
else
190+
echo "dir=badges" >> $GITHUB_OUTPUT
191+
fi
192+
193+
- name: Download all badge status artifacts
194+
uses: actions/download-artifact@v4
195+
with:
196+
path: badge-status
197+
pattern: status-*
198+
merge-multiple: true
199+
200+
- name: Generate SVG Badges
201+
run: |
202+
mkdir -p ${{ steps.badge_dir.outputs.dir }}
203+
for f in badge-status/*.json; do
204+
echo "file name: $f"
205+
[[ ! -f "$f" ]] && continue
206+
os=$(jq -r .os "$f")
207+
compiler=$(jq -r .compiler "$f")
208+
status=$(jq -r .status "$f")
209+
210+
color="gray"
211+
symbol="□"
212+
213+
[[ "$status" == "success" ]] && { symbol="✔"; color="green"; prefix="ok"; }
214+
[[ "$status" == "skipped" ]] && { symbol="○"; color="gray"; prefix="na"; }
215+
[[ "$status" == "failure" ]] && { symbol="✘"; color="red"; prefix="failed"; }
216+
217+
label="${os}-${compiler}"
218+
badge="${{ steps.badge_dir.outputs.dir }}/${label}.svg"
219+
echo "https://img.shields.io/badge/${prefix}-${symbol}-${color}.svg $badge"
220+
curl -s "https://img.shields.io/badge/${prefix}-${symbol}-${color}.svg" -o "$badge"
221+
done
222+
223+
- name: Upload badge folder to GitHub Pages
224+
uses: peaceiris/actions-gh-pages@v3
225+
with:
226+
github_token: ${{ secrets.GITHUB_TOKEN }}
227+
publish_dir: ./${{ steps.badge_dir.outputs.dir }}
228+
destination_dir: ${{ steps.badge_dir.outputs.dir }}

README.md

Lines changed: 46 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
<!---
2-
Copyright (c) 2018-2020 Steven Varga, Toronto,ON Canada
3-
Author: Varga, Steven <[email protected]>
4-
--->
51

6-
Source code transformation tool for HDF5 dataformat H5CPP header only library
7-
----------------------------------------------------------------------------------------------------
2+
[![CI](https://github.com/vargaconsulting/h5cpp-compiler/actions/workflows/ci.yml/badge.svg)](https://github.com/vargaconsulting/h5cpp-compiler/actions/workflows/ci.yml)
3+
[![codecov](https://codecov.io/gh/vargaconsulting/h5cpp-compiler/branch/main/graph/badge.svg)](https://codecov.io/gh/vargaconsulting/h5cpp-compiler)
4+
[![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17069343.svg)](https://doi.org/10.5281/zenodo.17069343)
6+
7+
[![GitHub release](https://img.shields.io/github/v/release/vargaconsulting/h5cpp-compiler.svg)](https://github.com/vargaconsulting/h5cpp-compiler/releases)
8+
[![Documentation](https://img.shields.io/badge/docs-stable-blue)](https://vargaconsulting.github.io/h5cpp-compiler)
9+
10+
# Source code transformation tool for HDF5 dataformat H5CPP header only library
11+
## Build Matrix
12+
13+
| OS / Compiler | GCC 13 | GCC 14 | GCC 15 | Clang 14 | Clang 15 | Clang 17 |
14+
|---------------|-------------|-------------|-------------|---------------|---------------|---------------|
15+
| Ubuntu 22.04 |![gcc13][200]|![gcc14][201]|![gcc15][202]|![clang14][210]|![clang15][211]|![clang17][212]|
16+
| Ubuntu 24.04 |![gcc13][300]|![gcc14][301]|![gcc15][302]|![clang14][310]|![clang15][311]|![clang17][312]|
17+
| macOS |![gcc13][600]|![gcc14][601]|![gcc15][602]|![clang14][610]|![clang15][611]|![clang17][612]|
18+
| Windows |![gcc13][700]|![gcc13][701]|![gcc13][702]|![clang14][710]|![clang15][711]|![clang17][712]|
19+
820

921
This source code transformation tool simplifies the otherwise time consuming process of generating the shim code for HDF5 Compound datatypes by building the AST of a given TU translation unit, and identifying all POD datatypes referenced from H5CPP operators/functions.
1022
The result is a seamless persistence much similar to python, java or other reflection based languages.
@@ -68,64 +80,34 @@ namespace sn {
6880
/* END IGNORED STRUCTS */
6981
```
7082
71-
Install:
72-
----------
73-
Only **LLVM 6.0 is supported**, to compile from source you need both the llvm and clang-dev package installed:
74-
```
75-
sudo apt install llvm-6.0 llvm-6.0-dev libclang-6.0-dev # 640MB space needed
76-
make && make install # compile the source code transforation tool
77-
```
78-
optionally you can remove the development libraries, and install only the runtime
79-
```
80-
sudo apt purge llvm-6.0 libllvm-6.0-dev libclang-6.0-dev # remove development libraries
81-
sudo apt install libllvm6.0 libclang-common-6.0-dev # install runtime dependencies
82-
```
83-
84-
Caveat:
85-
-------
86-
All LLVM version other than 6.0 is failing, or crashing including the clang++ chain. This is being investigated, and once resolved this message
87-
will be removed.
88-
89-
Usage:
90-
-------
91-
`h5cpp your_translation_unit.cpp -- -v $(CXXFLAGS) -Dgenerated.h`
92-
will run the compiler front end on the specified input, and outputs the necessary HDF5 type descriptors, or
93-
the error message if any.
83+
<!-- Ubuntu 22.04 -->
84+
[200]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-13.svg
85+
[201]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-14.svg
86+
[202]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-15.svg
87+
[210]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-14.svg
88+
[211]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-15.svg
89+
[212]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-17.svg
9490
91+
<!-- Ubuntu 24.04 -->
92+
[300]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-13.svg
93+
[301]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-14.svg
94+
[302]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-15.svg
95+
[310]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-14.svg
96+
[311]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-15.svg
97+
[312]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-17.svg
9598
99+
<!-- macOS latest -->
100+
[600]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-13.svg
101+
[601]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-14.svg
102+
[602]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-15.svg
103+
[610]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-14.svg
104+
[611]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-15.svg
105+
[612]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-17.svg
96106
97-
[hdf5]: https://support.hdfgroup.org/HDF5/doc/H5.intro.html
98-
[1]: http://en.cppreference.com/w/cpp/container/vector
99-
[2]: http://arma.sourceforge.net
100-
[4]: https://support.hdfgroup.org/HDF5/doc/RM/RM_H5Front.html
101-
[5]: https://support.hdfgroup.org/HDF5/release/obtain5.html
102-
[6]: http://eigen.tuxfamily.org/index.php?title=Main_Page
103-
[7]: http://www.boost.org/doc/libs/1_65_1/libs/numeric/ublas/doc/matrix.htm
104-
[8]: https://julialang.org/
105-
[9]: https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_.28CSR.2C_CRS_or_Yale_format.29
106-
[10]: https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29
107-
[11]: https://en.wikipedia.org/wiki/List_of_numerical_libraries#C++
108-
[12]: http://en.cppreference.com/w/cpp/concept/StandardLayoutType
109-
[40]: https://support.hdfgroup.org/HDF5/Tutor/HDF5Intro.pdf
110-
[99]: https://en.wikipedia.org/wiki/C_(programming_language)#Pointers
111-
[100]: http://arma.sourceforge.net/
112-
[101]: http://www.boost.org/doc/libs/1_66_0/libs/numeric/ublas/doc/index.html
113-
[102]: http://eigen.tuxfamily.org/index.php?title=Main_Page#Documentation
114-
[103]: https://sourceforge.net/projects/blitz/
115-
[104]: https://sourceforge.net/projects/itpp/
116-
[105]: http://dlib.net/linear_algebra.html
117-
[106]: https://bitbucket.org/blaze-lib/blaze
118-
[107]: https://github.com/wichtounet/etl
119-
[200]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_profiling_README.html
120-
[201]: http://h5cpp.org/examples.html
121-
[202]: http://h5cpp.org/modules.html
122-
[305]: md__home_steven_Documents_projects_h5cpp_docs_pages_compiler_trial.html#link_try_compiler
123-
[400]: https://www.meetup.com/Chicago-C-CPP-Users-Group/events/250655716/
124-
[401]: https://www.hdfgroup.org/2018/07/cpp-has-come-a-long-way-and-theres-plenty-in-it-for-users-of-hdf5/
125-
[999]: http://h5cpp.org/cgi/redirect.py
126-
[301]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_conversion.html
127-
[302]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_exceptions.html
128-
[303]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_compiler.html
129-
[304]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_linalg.html
130-
[305]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_install.html
131-
[400]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_error_handling.html
107+
<!-- Windows (clang & gcc) -->
108+
[700]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-13.svg
109+
[701]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-14.svg
110+
[702]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-15.svg
111+
[710]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-14.svg
112+
[711]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-15.svg
113+
[712]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-17.svg

0 commit comments

Comments
 (0)