Skip to content

Commit 9ad044e

Browse files
committed
ci: isolate pre-commit builds and add debug hooks
Group all pre-commit builds under `.pre-commit-builds/` to isolate them from the developer's default `builddir`. Add new manual hooks `all-tests-debug` and `all-tests-clang-debug` to support GCC/Clang debug build validation. Update `.gitignore` and `src/README.md` to document and support the new configuration.
1 parent 39963f7 commit 9ad044e

3 files changed

Lines changed: 55 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ doxygen
1111

1212
# Build directories
1313
/builddir/
14+
/.pre-commit-builds/
1415

1516
# Meson subprojects (ignore cloned sources but keep wrap files tracked)
1617
/subprojects/*

.pre-commit-config.yaml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,61 @@ repos:
3232
files: \.(c|h)$
3333
- id: meson-test
3434
name: Meson Test
35-
entry: meson test -C builddir
35+
entry: >-
36+
bash -c 'if [ ! -d .pre-commit-builds/release ]; then
37+
meson setup .pre-commit-builds/release; fi &&
38+
meson test -C .pre-commit-builds/release'
3639
language: system
3740
pass_filenames: false
3841
files: \.(c|h)$
3942
- id: all-tests
4043
name: All Tests
4144
entry: >-
42-
meson test -C builddir
45+
bash -c 'if [ ! -d .pre-commit-builds/release ]; then
46+
meson setup .pre-commit-builds/release; fi &&
47+
meson test -C .pre-commit-builds/release
48+
--suite unit_test
49+
--suite integration_short
50+
--suite integration_long
51+
--verbose'
52+
language: system
53+
pass_filenames: false
54+
files: \.(c|h|py|sh)$
55+
stages: [manual]
56+
- id: all-tests-debug
57+
name: All Tests (Debug)
58+
entry: >-
59+
bash -c 'if [ ! -d .pre-commit-builds/debug ]; then
60+
meson setup .pre-commit-builds/debug --buildtype=debug; fi &&
61+
meson test -C .pre-commit-builds/debug
4362
--suite unit_test
4463
--suite integration_short
4564
--suite integration_long
46-
--verbose
65+
--verbose'
4766
language: system
4867
pass_filenames: false
4968
files: \.(c|h|py|sh)$
5069
stages: [manual]
5170
- id: all-tests-clang
5271
name: All Tests (Clang)
5372
entry: >-
54-
bash -c 'if [ ! -d builddir_clang ]; then
55-
CC=clang meson setup builddir_clang; fi &&
56-
meson test -C builddir_clang
73+
bash -c 'if [ ! -d .pre-commit-builds/clang-release ]; then
74+
CC=clang meson setup .pre-commit-builds/clang-release; fi &&
75+
meson test -C .pre-commit-builds/clang-release
76+
--suite unit_test
77+
--suite integration_short
78+
--suite integration_long
79+
--verbose'
80+
language: system
81+
pass_filenames: false
82+
files: \.(c|h|py|sh)$
83+
stages: [manual]
84+
- id: all-tests-clang-debug
85+
name: All Tests (Clang Debug)
86+
entry: >-
87+
bash -c 'if [ ! -d .pre-commit-builds/clang-debug ]; then
88+
CC=clang meson setup .pre-commit-builds/clang-debug --buildtype=debug; fi &&
89+
meson test -C .pre-commit-builds/clang-debug
5790
--suite unit_test
5891
--suite integration_short
5992
--suite integration_long

src/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,16 @@ pre-commit run --all-files
133133
> # Run all tests using the default compiler (GCC)
134134
> pre-commit run all-tests --hook-stage manual --all-files
135135
>
136+
> # Run all tests (GCC Debug)
137+
> pre-commit run all-tests-debug --hook-stage manual --all-files
138+
>
136139
> # Run all tests using Clang
137140
> pre-commit run all-tests-clang --hook-stage manual --all-files
141+
>
142+
> # Run all tests (Clang Debug)
143+
> pre-commit run all-tests-clang-debug --hook-stage manual --all-files
138144
> ```
139-
> Note that `all-tests-clang` requires `clang` to be installed (e.g.,
145+
> Note that the Clang-based hooks require `clang` to be installed (e.g.,
140146
> `sudo apt install clang` on Debian/Ubuntu systems).
141147
142148
### Running Tests
@@ -180,15 +186,21 @@ configurations:
180186
##### 3. Required Pre-Push Validation
181187
182188
Before pushing changes, developers are **required** to manually run the full
183-
suite using the manual pre-commit hooks to catch potential cache regressions
184-
locally:
189+
suite using the manual pre-commit hooks to catch potential cache regressions and
190+
memory leaks locally:
185191
186192
```bash
187193
# Run GCC-based compilation and all tests (unit_test, integration_short, integration_long)
188194
pre-commit run all-tests --hook-stage manual --all-files
189195
196+
# Run GCC-based compilation in Debug mode (with leak detection enabled) and all tests
197+
pre-commit run all-tests-debug --hook-stage manual --all-files
198+
190199
# Run Clang-based compilation and all tests
191200
pre-commit run all-tests-clang --hook-stage manual --all-files
201+
202+
# Run Clang-based compilation in Debug mode (with leak detection enabled) and all tests
203+
pre-commit run all-tests-clang-debug --hook-stage manual --all-files
192204
```
193205
194206
---

0 commit comments

Comments
 (0)