Skip to content

Commit 153a88d

Browse files
committed
Initial commit
0 parents  commit 153a88d

29 files changed

Lines changed: 2938 additions & 0 deletions

.clang-format

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright (c) 2026 Agustin Berge
2+
#
3+
# Distributed under the Boost Software License, Version 1.0.
4+
# See accompanying file LICENSE.txt or copy at
5+
# http://www.boost.org/LICENSE_1_0.txt
6+
---
7+
Language: Cpp
8+
Standard: Latest
9+
10+
# -- Indentation --------------------------------------------------------------
11+
IndentWidth: 4
12+
TabWidth: 4
13+
UseTab: Never
14+
ContinuationIndentWidth: 4
15+
IndentCaseLabels: true
16+
IndentPPDirectives: AfterHash # `# if`, `# define` inside nested ifdefs
17+
NamespaceIndentation: None # namespace bodies are NOT indented
18+
19+
# -- Column limit -------------------------------------------------------------
20+
ColumnLimit: 80 # classic; fits terminal & paper
21+
22+
# -- Brace style --------------------------------------------------------------
23+
BreakBeforeBraces: Mozilla # wraps after functions and classes/structs
24+
25+
# -- Spaces -------------------------------------------------------------------
26+
SpaceBeforeParens: ControlStatements
27+
SpaceInEmptyParentheses: false
28+
SpacesInParentheses: false
29+
SpacesInSquareBrackets: false
30+
SpacesInAngles: false # `vector<int>` not `vector< int >`
31+
SpaceAfterTemplateKeyword: true # `template <typename T>` (space after kw)
32+
SpaceBeforeAssignmentOperators: true
33+
SpaceBeforeCpp11BracedList: false
34+
35+
# -- Pointer / reference alignment --------------------------------------------
36+
# East-const style: `T const&`, `T*` -> pointer/ref binds to the type, not name
37+
PointerAlignment: Left # `T* p` / `T& r` - type-side binding
38+
ReferenceAlignment: Left
39+
40+
# -- Template / requires ------------------------------------------------------
41+
AlwaysBreakTemplateDeclarations: Yes # `template <...>` always on its own line
42+
# before the declaration
43+
44+
# -- Function / call formatting -----------------------------------------------
45+
AllowShortFunctionsOnASingleLine: Inline # only genuinely trivial accessors inline
46+
AllowShortIfStatementsOnASingleLine: true
47+
AllowShortLoopsOnASingleLine: true
48+
AllowShortLambdasOnASingleLine: Inline
49+
AlignAfterOpenBracket: BlockIndent # always breaks, places closing
50+
# brackets on new lines
51+
52+
BinPackArguments: true # all args same line
53+
BinPackParameters: true # same for parameters
54+
55+
# -- Return type --------------------------------------------------------------
56+
AlwaysBreakAfterReturnType: None # return type stays on same line as name
57+
# unless forced by column limit
58+
59+
# -- Constructor initialiser lists --------------------------------------------
60+
BreakConstructorInitializers: BeforeColon # `: base(x)\n, member_(y)` style
61+
ConstructorInitializerIndentWidth: 4
62+
PackConstructorInitializers: Never
63+
64+
# -- Inheritance --------------------------------------------------------------
65+
BreakInheritanceList: BeforeColon
66+
67+
# -- Include sorting ----------------------------------------------------------
68+
SortIncludes: CaseSensitive
69+
IncludeBlocks: Regroup
70+
IncludeCategories:
71+
# 1. The library's own headers <eggs/...>
72+
- Regex: '^<eggs/'
73+
Priority: 1
74+
# 2. Standard library
75+
- Regex: '^<[a-z_]+>$'
76+
Priority: 2
77+
# 3. Everything else (config, platform)
78+
- Regex: '.*'
79+
Priority: 3
80+
81+
# -- Comments -----------------------------------------------------------------
82+
ReflowComments: false # do NOT reflow // section banners
83+
# (e.g. `// namespace detail`)
84+
SpacesBeforeTrailingComments: 1
85+
86+
# -- Alignment ----------------------------------------------------------------
87+
AlignConsecutiveAssignments: false # no forced vertical alignment of `=`
88+
AlignConsecutiveDeclarations: false
89+
AlignTrailingComments: true # trailing `//` comments align in a block
90+
AlignEscapedNewlines: Left
91+
92+
# -- Misc ---------------------------------------------------------------------
93+
Cpp11BracedListStyle: true
94+
FixNamespaceComments: true # auto-add `// namespace foo` at closing }
95+
CompactNamespaces: false
96+
MaxEmptyLinesToKeep: 1
97+
KeepEmptyLinesAtTheStartOfBlocks: false
98+
DerivePointerAlignment: false
99+
SeparateDefinitionBlocks: Always # blank line between top-level definitions

.github/workflows/coverage.yml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
# Eggs.Stacktrace
2+
#
3+
# Copyright (c) 2026 Agustin Berge
4+
#
5+
6+
name: coverage
7+
8+
on:
9+
push:
10+
branches: [ main, feature/** ]
11+
pull_request:
12+
types: [opened, synchronize, reopened]
13+
workflow_dispatch:
14+
15+
jobs:
16+
coverage:
17+
name: ubuntu-24.04 / llvm-cov
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 6
20+
21+
steps:
22+
- uses: actions/checkout@v5
23+
24+
- name: Install CMake
25+
uses: lukka/get-cmake@latest
26+
with:
27+
cmakeVersion: "4.4.0"
28+
29+
- name: Set up APT package cache
30+
run: |
31+
mkdir -p ~/.cache/apt/archives/partial
32+
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
33+
| sudo tee /etc/apt/apt.conf.d/99user-cache
34+
35+
- name: Cache APT packages
36+
uses: actions/cache@v5
37+
with:
38+
path: ~/.cache/apt/archives
39+
key: apt-ubuntu-24.04-clang-22-${{ hashFiles('.github/workflows/coverage.yml') }}
40+
restore-keys: apt-ubuntu-24.04-clang-22-
41+
42+
- name: Install Clang 22
43+
run: |
44+
wget -q https://apt.llvm.org/llvm.sh
45+
sudo bash llvm.sh 22 all
46+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200
47+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200
48+
49+
- name: Fix APT cache permissions
50+
if: always()
51+
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
52+
53+
- name: Configure (coverage)
54+
run: |
55+
cmake --preset dev-clang -B build/coverage \
56+
-DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping" \
57+
-DCMAKE_EXE_LINKER_FLAGS="-fprofile-instr-generate"
58+
59+
- name: Build
60+
run: cmake --build build/coverage --config Debug
61+
62+
- name: Test
63+
run: |
64+
LLVM_PROFILE_FILE="${GITHUB_WORKSPACE}/build/coverage/cov-%p.profraw" \
65+
ctest --test-dir build/coverage --build-config Debug \
66+
--output-on-failure --no-compress-output
67+
68+
- name: Merge profile data
69+
run: |
70+
llvm-profdata-22 merge -sparse build/coverage/cov-*.profraw \
71+
-o build/coverage/coverage.profdata
72+
73+
- name: Coverage report
74+
run: |
75+
mapfile -t objects < <(find build/coverage -path "*/Debug/*" -type f -perm /111)
76+
first="${objects[0]}"
77+
obj_args=()
78+
for o in "${objects[@]:1}"; do obj_args+=("-object=$o"); done
79+
llvm-cov-22 report "$first" "${obj_args[@]}" \
80+
-instr-profile=build/coverage/coverage.profdata \
81+
-use-color=false src include/eggs 2>/dev/null
82+
83+
- name: Generate HTML report
84+
run: |
85+
mapfile -t objects < <(find build/coverage -path "*/Debug/*" -type f -perm /111)
86+
first="${objects[0]}"
87+
obj_args=()
88+
for o in "${objects[@]:1}"; do obj_args+=("-object=$o"); done
89+
llvm-cov-22 show "$first" "${obj_args[@]}" \
90+
-instr-profile=build/coverage/coverage.profdata \
91+
-format=html \
92+
-output-dir=build/coverage/html \
93+
-show-line-counts-or-regions \
94+
src include/eggs 2>/dev/null
95+
96+
- name: Upload coverage report
97+
uses: actions/upload-artifact@v6
98+
with:
99+
name: coverage-report-llvm-cov
100+
path: build/coverage/html/
101+
retention-days: 7
102+
103+
coverage-gcov:
104+
name: ubuntu-24.04 / gcov
105+
runs-on: ubuntu-24.04
106+
timeout-minutes: 6
107+
108+
steps:
109+
- uses: actions/checkout@v5
110+
111+
- name: Install CMake
112+
uses: lukka/get-cmake@latest
113+
with:
114+
cmakeVersion: "4.4.0"
115+
116+
- name: Set up APT package cache
117+
run: |
118+
mkdir -p ~/.cache/apt/archives/partial
119+
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
120+
| sudo tee /etc/apt/apt.conf.d/99user-cache
121+
122+
- name: Cache APT packages
123+
uses: actions/cache@v5
124+
with:
125+
path: ~/.cache/apt/archives
126+
key: apt-ubuntu-24.04-gcc-16-${{ hashFiles('.github/workflows/coverage.yml') }}
127+
restore-keys: apt-ubuntu-24.04-gcc-16-
128+
129+
- name: Install GCC 16
130+
run: |
131+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
132+
sudo apt-get update -q
133+
sudo apt-get install -y gcc-16 g++-16
134+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-16 100 \
135+
--slave /usr/bin/g++ g++ /usr/bin/g++-16
136+
137+
- name: Install lcov
138+
run: |
139+
sudo apt-get install -y libcapture-tiny-perl libdatetime-perl libtimedate-perl
140+
curl -sL https://github.com/linux-test-project/lcov/releases/download/v2.4/lcov-2.4.tar.gz \
141+
| tar xz -C "$HOME"
142+
echo "$HOME/lcov-2.4/bin" >> "$GITHUB_PATH"
143+
144+
- name: Fix APT cache permissions
145+
if: always()
146+
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
147+
148+
- name: Configure (coverage)
149+
run: |
150+
cmake --preset dev-gcc -B build/coverage-gcc \
151+
-DCMAKE_CXX_FLAGS="--coverage" \
152+
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
153+
154+
- name: Build
155+
run: cmake --build build/coverage-gcc --config Debug
156+
157+
- name: Test
158+
run: |
159+
find build/coverage-gcc -name "*.gcda" -delete
160+
ctest --test-dir build/coverage-gcc --build-config Debug \
161+
--output-on-failure --no-compress-output
162+
163+
- name: Collect coverage
164+
run: |
165+
lcov --capture \
166+
--gcov-tool gcov-16 \
167+
--ignore-errors mismatch,inconsistent \
168+
--directory build/coverage-gcc \
169+
--output-file build/coverage-gcc/coverage.info
170+
lcov --extract build/coverage-gcc/coverage.info \
171+
'*/src/*' '*/include/eggs/*' \
172+
--ignore-errors unused \
173+
--output-file build/coverage-gcc/coverage.info
174+
175+
- name: Coverage report
176+
run: |
177+
lcov --list build/coverage-gcc/coverage.info
178+
179+
- name: Generate HTML report
180+
run: |
181+
genhtml build/coverage-gcc/coverage.info \
182+
--output-directory build/coverage-gcc/html \
183+
--quiet
184+
185+
- name: Upload coverage report
186+
uses: actions/upload-artifact@v6
187+
with:
188+
name: coverage-report-gcov
189+
path: build/coverage-gcc/html/
190+
retention-days: 7

.github/workflows/format.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Eggs.Stacktrace
2+
#
3+
# Copyright (c) 2026 Agustin Berge
4+
#
5+
# Distributed under the Boost Software License, Version 1.0.
6+
# See accompanying file LICENSE.txt or copy at
7+
# http://www.boost.org/LICENSE_1_0.txt
8+
9+
name: format
10+
11+
on:
12+
push:
13+
branches: [ main, feature/** ]
14+
pull_request:
15+
types: [opened, synchronize, reopened]
16+
17+
jobs:
18+
ascii-encoding:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v5
23+
24+
- name: Scan files for non-ASCII characters
25+
run: |
26+
if grep -rnP '[^\x00-\x7F]' --exclude-dir=.git .; then
27+
echo "error: non-ASCII characters found."
28+
exit 1
29+
fi
30+
31+
clang-format:
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v5
36+
37+
- name: Run clang-format check
38+
uses: jidicula/clang-format-action@v4.16.0
39+
with:
40+
clang-format-version: "22"
41+
check-path: "."
42+
43+
gersemi:
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- uses: actions/checkout@v5
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v6
51+
with:
52+
python-version: '3.11'
53+
54+
- name: Install Gersemi
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install gersemi[color]
58+
59+
- name: Run Gersemi check
60+
run: gersemi --definitions . --check --diff --color .

0 commit comments

Comments
 (0)