Skip to content

Commit 43bf8c8

Browse files
authored
Add GitHub CI checks (#5)
1 parent c329760 commit 43bf8c8

File tree

4 files changed

+60
-5
lines changed

4 files changed

+60
-5
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
pre-commit:
12+
name: Pre-commit checks
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4.3.1
16+
17+
- uses: actions/setup-python@v5.6.0
18+
with:
19+
python-version: '3.12'
20+
21+
- uses: pre-commit/action@v3.0.1
22+
23+
lint:
24+
name: Static analysis
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4.3.1
28+
29+
- name: Install clang-tidy
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y clang-tidy
33+
34+
- name: Run clang-tidy
35+
run: ./script/clang-tidy.sh
36+
37+
build:
38+
name: Build
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4.3.1
42+
43+
- name: Configure CMake
44+
run: cmake -B build
45+
46+
- name: Build
47+
run: cmake --build build

.markdownlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Markdownlint configuration
23
default: true
34
MD013: false # Disable line length limit

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# microOggDemuxer
22

3+
[![CI](https://github.com/esphome-libs/micro-ogg-demuxer/actions/workflows/ci.yml/badge.svg)](https://github.com/esphome-libs/micro-ogg-demuxer/actions/workflows/ci.yml)
4+
35
A lightweight, platform-agnostic Ogg container demuxer for embedded systems and general use.
46

57
## Features

script/clang-tidy.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ if [ -z "$CLANG_TIDY" ]; then
3333
exit 1
3434
fi
3535

36-
# Check for compile_commands.json
36+
# Ensure compile_commands.json exists
3737
if [ ! -f "${BUILD_DIR}/compile_commands.json" ]; then
38-
echo "Error: compile_commands.json not found in ${BUILD_DIR}"
39-
echo "Run: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .."
40-
exit 1
38+
echo "Generating compile_commands.json..."
39+
cmake -B "$BUILD_DIR" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "$ROOT_DIR"
4140
fi
4241

43-
SOURCES="${ROOT_DIR}/src/ogg_demuxer.cpp"
42+
# Find all C++ source files
43+
SOURCES=$(find "$ROOT_DIR/src" -name '*.cpp' -o -name '*.c' 2>/dev/null || true)
44+
45+
if [ -z "$SOURCES" ]; then
46+
echo "No source files found"
47+
exit 0
48+
fi
4449

4550
# Parse arguments
4651
FIX_FLAG=""

0 commit comments

Comments
 (0)