@@ -4,7 +4,7 @@ A modern, production-ready template for C++ development.
44
55| Capability | Tool / Setup | Status |
66| --------------- | -------------------------------------- | ------ |
7- | Build | CMake ≥ 3.16 | ✔ |
7+ | Build | CMake ≥ 3.20 | ✔ |
88| Unit tests | GoogleTest (optional) | ✔ |
99| Formatting | clang-format (pre-commit) | ✔ |
1010| Linting | clang-tidy (pre-commit) | ✔ |
@@ -22,10 +22,9 @@ git clone <your-fork> my_project && cd my_project
2222# Install pre-commit hooks (for code quality checks on push)
2323pre-commit install --hook-type pre-push
2424
25- ./scripts/fetch_googletest.sh # optional, only if you need tests
26- cmake -S . -B build # -DENABLE_TESTS=OFF to skip tests
25+ cmake -S . -B build # -DENABLE_UNIT_TESTS=OFF to skip tests
2726cmake --build build -j$( nproc)
28- ./build/main_exec
27+ ./build/bin/ main_exec
2928ctest --test-dir build --output-on-failure # if tests enabled
3029```
3130
@@ -106,13 +105,14 @@ your-package/
106105
107106### Build and Development
108107
109- | Script | Purpose |
110- | ------------ | ---------------------------------------------------- |
111- | ` build.sh ` | Configure and compile (Debug mode) |
112- | ` package.sh ` | Build and create distributable packages (Release) |
113- | ` format.sh ` | Run clang-format on sources |
114- | ` lint.sh ` | Run clang-tidy using compile commands |
115- | ` docs.sh ` | Generate HTML docs |
108+ | Script | Purpose |
109+ | ------------- | ---------------------------------------------------- |
110+ | ` build.sh ` | Configure and compile (Debug mode) |
111+ | ` package.sh ` | Build and create distributable packages (Release) |
112+ | ` coverage.sh ` | Build with coverage, run tests, generate report |
113+ | ` format.sh ` | Run clang-format on sources (use --check for CI) |
114+ | ` lint.sh ` | Run clang-tidy using compile commands |
115+ | ` docs.sh ` | Generate HTML docs |
116116
117117** Build vs Package:**
118118- ` ./scripts/build.sh ` — Debug build for development (fast compilation, debug symbols)
@@ -132,14 +132,21 @@ Docker-related scripts live under `scripts/docker/`:
132132
133133## Code quality
134134
135- Install hooks once:
135+ ### Pre-push Hooks
136+
137+ Install hooks once (runs on ` git push ` , not commit):
136138
137139``` bash
138- pip install --break-system-packages pre-commit
139- pre-commit install
140+ pre-commit install --hook-type pre-push
140141```
141142
142- On each commit clang-format rewrites staged files and clang-tidy analyses them.
143+ Before each push, pre-commit will:
144+ - Run ` clang-format ` to check code formatting
145+ - Run ` clang-tidy ` to analyze code quality
146+
147+ These checks ensure consistent code style across the team.
148+
149+ ** VS Code DevContainer users:** Hooks are installed automatically via ` postCreateCommand ` .
143150
144151---
145152
@@ -200,29 +207,33 @@ VS Code users can reopen the workspace in the container. The Dev Container uses
200207
201208## Continuous integration (GitHub Actions)
202209
203- ```
204- on: [push, pull_request]
210+ The CI pipeline runs on every push and pull request:
205211
206- job: build
212+ ``` yaml
213+ on : [push, pull_request]
207214runs-on : ubuntu-24.04
215+
208216steps :
209- - uses: actions/checkout@v4
210- - run: sudo apt-get update && sudo apt-get install -y cmake clang-format clang-tidy g++ doxygen
211- - run: cmake -S . -B build -DENABLE_TESTS=ON
212- - run: cmake --build build -j$(nproc)
213- - run: ctest --test-dir build --output-on-failure
217+ - Install dependencies (cmake, clang-format)
218+ - Build project with CMake
219+ - Run all unit tests with ctest
214220` ` `
215221
222+ See [.github/workflows/ci.yml](.github/workflows/ci.yml) for the complete configuration.
223+
216224---
217225
218226## Unit tests
219227
220- Enable tests by fetching GoogleTest:
228+ Unit tests are **enabled by default** using GoogleTest (fetched automatically via CMake FetchContent).
221229
222230` ` ` bash
223- cmake -S . -B build -DENABLE_TESTS=ON
231+ cmake -S . -B build
224232cmake --build build
225- ctest --test-dir build
233+ ctest --test-dir build --output-on-failure
226234```
227235
228- Disable with ` -DENABLE_TESTS=OFF ` . This is the default
236+ To disable tests:
237+ ``` bash
238+ cmake -S . -B build -DENABLE_UNIT_TESTS=OFF
239+ ```
0 commit comments