Skip to content

Commit bc177f7

Browse files
committed
workflow
1 parent 8fa2826 commit bc177f7

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/formatting.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Code Formatting
2+
3+
on:
4+
push:
5+
branches: [main, development]
6+
pull_request:
7+
branches: [main, development]
8+
9+
jobs:
10+
format:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest]
15+
16+
steps:
17+
- uses: actions/checkout@v5
18+
19+
# Install clang-format if needed
20+
- name: Install clang-format (Linux)
21+
if: matrix.os == 'ubuntu-latest'
22+
run: sudo apt-get update && sudo apt-get install -y clang-format
23+
24+
- name: Install clang-format (macOS)
25+
if: matrix.os == 'macos-latest'
26+
run: brew install clang-format || true
27+
28+
# Check formatting
29+
- name: Check C/C++ formatting
30+
run: |
31+
misformatted=$(find . -name '*.c' -o -name '*.h' -print0 | xargs -0 clang-format -style=file -output-replacements-xml | grep "<replacement " || true)
32+
if [ -n "$misformatted" ]; then
33+
echo "ERROR: Some files are not properly formatted. Run clang-format -i."
34+
exit 1
35+
else
36+
echo "All files are properly formatted."
37+
exit 0
38+
fi

.github/sanitizer.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: ASan+UBSan
2+
3+
on:
4+
push:
5+
branches: [main, development]
6+
pull_request:
7+
branches: [main, development]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest]
15+
16+
steps:
17+
- uses: actions/checkout@v5
18+
19+
# Configure CMake with ASan + UBSan
20+
- name: Configure with sanitizers
21+
run: cmake -B build -S . \
22+
-DCMAKE_BUILD_TYPE=Debug \
23+
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g" \
24+
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g"
25+
26+
# Build
27+
- name: Build
28+
run: cmake --build build --config Debug
29+
30+
# Run tests
31+
- name: Run tests under ASan+UBSan
32+
run: ./build/all_tests

.github/valgrind.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Valgrind
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
linux:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- name: Install dependencies
12+
run: |
13+
sudo apt-get update
14+
sudo apt-get install -y valgrind
15+
16+
- name: Configure Debug build
17+
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug
18+
19+
- name: Build
20+
run: cmake --build build --config Debug
21+
22+
- name: Run tests under Valgrind
23+
run: |
24+
valgrind --leak-check=full --show-leak-kinds=all \
25+
--track-origins=yes -s --show-reachable=yes \
26+
--error-exitcode=1 build/all_tests
27+

0 commit comments

Comments
 (0)