Skip to content

Commit 6691744

Browse files
committed
wip: documentation workflow + check_version
1 parent cd5db8f commit 6691744

9 files changed

Lines changed: 86 additions & 21 deletions

File tree

.github/workflows/benchmarks.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
build:
15-
name: Build and run benchmarks
15+
name: Build and Run Benchmarks (Smoke Test)
1616
runs-on: ubuntu-24.04
1717

1818
steps:
@@ -33,12 +33,12 @@ jobs:
3333
-DBUILD_BENCHMARKS=ON -DBENCH_INCLUDE_BGL=ON -DCMAKE_BUILD_TYPE=Release
3434
continue-on-error: false
3535

36-
- name: Build the benchmarks
36+
- name: Build the Benchmarks
3737
run: |
3838
cmake --build build_bench/ -j$(nproc)
3939
continue-on-error: false
4040

41-
- name: Execute the smoke test
41+
- name: Execute the Smoke Test
4242
run: |
4343
./build_bench/benchmarks/cpp-gl-bench \
4444
--benchmark_repetitions=1 --benchmark_display_aggregates_only=true \

.github/workflows/clang.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
build:
15-
name: Build and run tests
15+
name: Build and Run Tests (Clang)
1616
runs-on: ubuntu-24.04
1717

1818
steps:
@@ -27,12 +27,12 @@ jobs:
2727
cmake -B build_clang -DBUILD_TESTS=ON -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC
2828
continue-on-error: false
2929

30-
- name: Build test executable
30+
- name: Build Tests
3131
run: |
3232
cmake --build build_clang/ -j$(nproc)
3333
continue-on-error: false
3434

35-
- name: Run tests
35+
- name: Run Tests
3636
run: |
3737
./build_clang/tests/gl
3838
./build_clang/tests/hgl
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: documentation
1+
name: Documentation
22

33
on:
44
pull_request:
@@ -8,7 +8,6 @@ on:
88
tags:
99
- "v*"
1010

11-
# Grants the runner permission to push to the repository (protect your main branch via Settings!)
1211
permissions:
1312
contents: write
1413

@@ -37,8 +36,7 @@ jobs:
3736
pip install uv
3837
uv sync
3938
40-
- name: Validate internal project versions
41-
# Runs your script to ensure CMake, Doxygen, and Bazel versions are identical
39+
- name: Validate Internal Project Versions
4240
run: |
4341
VERSION=$(uv run python scripts/check_version.py)
4442
echo "project version = $VERSION"
@@ -54,7 +52,7 @@ jobs:
5452
exit 1
5553
fi
5654
57-
- name: Generate internal documentation assets
55+
- name: Generate Internal Documentation Assets
5856
run: |
5957
doxygen Doxyfile
6058
uv run python docs/scripts/gen_concept_docs.py --config docs/config/concepts.json --xml documentation/xml --out docs/cpp-gl
@@ -63,6 +61,7 @@ jobs:
6361
if: github.event_name == 'pull_request'
6462
run: uv run mkdocs build --strict
6563

64+
# See: https://api.github.com/users/github-actions%5Bbot%5D
6665
- name: Configure Git (Deploy Only)
6766
if: github.event_name == 'push'
6867
run: |

.github/workflows/format.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Set up python
2626
uses: actions/setup-python@v5
2727
with:
28-
python-version: "3.12"
28+
python-version: "3.14"
2929

3030
- name: Test formatting
3131
shell: bash

.github/workflows/gpp.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
build:
15-
name: Build and run tests
15+
name: Build and Run Tests (G++)
1616
runs-on: ubuntu-24.04
1717

1818
steps:
@@ -27,12 +27,12 @@ jobs:
2727
cmake -B build_gcc -DBUILD_TESTS=ON -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC
2828
continue-on-error: false
2929

30-
- name: Build test executable
30+
- name: Build Tests
3131
run: |
3232
cmake --build build_gcc/ -j$(nproc)
3333
continue-on-error: false
3434

35-
- name: Run tests
35+
- name: Run Tests
3636
run: |
3737
./build_gcc/tests/gl
3838
./build_gcc/tests/hgl

.github/workflows/licence.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build:
14-
name: Test code formatting
14+
name: Test License Comments
1515
runs-on: ubuntu-24.04
1616

1717
steps:
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
python-version: "3.12"
2525

26-
- name: Test formatting
26+
- name: Validate Licence Comments
2727
shell: bash
2828
run: |
2929
python3 scripts/check_licence.py

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ If CMake is not being used, simply download the desired version of the library f
112112

113113
## Benchmarks
114114

115-
Performance and zero-cost abstraction are primary goals of this library. A comprehensive evaluation suite built on top of **Google Benchmark** provides a structured way to measure, filter, and report the library's performance across various graph algorithms and memory layouts.
115+
Performance and zero-cost abstraction are primary goals of this library. A comprehensive evaluation suite built on top of **Google Benchmark** provides a structured way to measure, filter, and report the library's performance across various graph algorithms and memory layouts.
116116

117117
For detailed performance metrics, configuration instructions (including BGL integration), and CLI usage, please refer to the **[Benchmarks Guide](benchmarks/README.md)**.
118118

@@ -154,9 +154,9 @@ To format only the files modified in the last commit:
154154
python scripts/format.py -m -exe clang-format-18
155155
```
156156

157-
> [!NOTE]
157+
> [!NOTE]
158158
>
159-
> If `clang-format-18` is your system's default, you can omit the `-exe` flag.
159+
> If `clang-format-18` is your system's default, you can omit the `-exe` flag.
160160
161161
### Building the Documentation
162162

docs/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
[![G++](https://github.com/SpectraL519/cpp-gl/actions/workflows/gpp.yaml/badge.svg)](https://github.com/SpectraL519/cpp-gl/actions/workflows/gpp.yaml)
1414
[![Clang++](https://github.com/SpectraL519/cpp-gl/actions/workflows/clang.yaml/badge.svg)](https://github.com/SpectraL519/cpp-gl/actions/workflows/clang.yaml)
1515

16-
1716
</div>
1817

1918
<div align="center" markdown="1">

scripts/check_version.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import argparse
2+
import re
3+
import sys
4+
from pathlib import Path
5+
from collections.abc import Iterable
6+
7+
8+
VERSION_REGEX = r"(\d+\.\d+(?:\.\d+)*)"
9+
10+
11+
def get_cmake_version(cmake_path: Path) -> str:
12+
text = cmake_path.read_text()
13+
match = re.search(rf'project\s*\([^\)]*VERSION\s+{VERSION_REGEX}', text, re.IGNORECASE)
14+
if match:
15+
return match.group(1)
16+
raise ValueError(f"[CMake] Could not find a valid project version in {cmake_path}")
17+
18+
19+
def get_doxy_version(doxyfile_path: Path) -> str:
20+
text = doxyfile_path.read_text()
21+
match = re.search(rf'^\s*PROJECT_NUMBER\s*=\s*("?){VERSION_REGEX}\1', text, re.MULTILINE)
22+
if match:
23+
return match.group(2) # group(2) because group(1) is the optional quote
24+
raise ValueError(f"[Doxygen] Could not find a valid PROJECT_NUMBER in {doxyfile_path}")
25+
26+
27+
def all_equal(items: Iterable) -> bool:
28+
return len(set(items)) == 1
29+
30+
31+
def main(cmake: Path, doxygen: Path):
32+
try:
33+
project_versions = {
34+
"CMake": get_cmake_version(cmake),
35+
"Doxygen": get_doxy_version(doxygen),
36+
}
37+
except Exception as e:
38+
print(f"Error: {e}", file=sys.stderr)
39+
sys.exit(1)
40+
41+
42+
if not all_equal(project_versions.values()):
43+
version_msg_entries = [f"{source}: {version}" for source, version in project_versions.items()]
44+
print(f"Error: Project version mismatch:\n {'\n '.join(version_msg_entries)}", file=sys.stderr)
45+
sys.exit(1)
46+
47+
print(project_versions['CMake']) # print the version to stdout for shell capture
48+
49+
50+
if __name__ == "__main__":
51+
parser = argparse.ArgumentParser()
52+
parser.add_argument(
53+
"-c", "--cmake",
54+
type=Path,
55+
default="CMakeLists.txt",
56+
nargs=1,
57+
help="Path to the root CMake file"
58+
)
59+
parser.add_argument(
60+
"-d", "--doxygen",
61+
type=Path,
62+
default="Doxyfile",
63+
nargs=1,
64+
help="Path to the Doxygen config file"
65+
)
66+
67+
main(**vars(parser.parse_args()))

0 commit comments

Comments
 (0)