Add Doxygen, clang-format, cppcheck, and Gitea CI
Doxygen: - Doxyfile: minimal config, HTML output to docs/, no LaTeX - @file/@brief on all source files, full @param/@return on public API - docs/ added to .gitignore clang-format (14, Linux brace style, 4-space, column 100): - .clang-format added - Applied to entire codebase; this commit is the canonical baseline - just format rewrites in-place; just format-check is the CI gate cppcheck (--enable=warning,style,performance,portability): - Linker-symbol pointer comparisons in startup.c suppressed with inline cppcheck-suppress (false positives, not real bugs) - just lint runs cppcheck; zero warnings required to pass Dockerfile gains clang-format, cppcheck, doxygen packages so all tools run inside the existing container -- host stays clean. Gitea Actions (.gitea/workflows/ci.yml): - Four parallel jobs: build, format, lint, docs - All jobs use the same Dockerfile-based image - Doxygen job fails on any warning line in output
This commit is contained in:
99
.gitea/workflows/ci.yml
Normal file
99
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,99 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
IMAGE: ptt-builder
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build firmware
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build container image
|
||||
run: docker build -t $IMAGE .
|
||||
|
||||
- name: Compile firmware
|
||||
run: |
|
||||
docker run --rm \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
-v "$PWD:/src" \
|
||||
$IMAGE \
|
||||
sh -c "cmake -B /src/build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel /src \
|
||||
&& ninja -C /src/build"
|
||||
|
||||
- name: Print size
|
||||
run: |
|
||||
docker run --rm \
|
||||
-v "$PWD:/src" \
|
||||
$IMAGE \
|
||||
arm-none-eabi-size /src/build/firmware
|
||||
|
||||
format:
|
||||
name: Check formatting
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build container image
|
||||
run: docker build -t $IMAGE .
|
||||
|
||||
- name: clang-format check
|
||||
run: |
|
||||
docker run --rm \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
-v "$PWD:/src" \
|
||||
$IMAGE \
|
||||
sh -c "find /src/src /src/include -name '*.c' -o -name '*.h' | \
|
||||
xargs clang-format --dry-run --Werror \
|
||||
--style=file:/src/.clang-format"
|
||||
|
||||
lint:
|
||||
name: Static analysis
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build container image
|
||||
run: docker build -t $IMAGE .
|
||||
|
||||
- name: cppcheck
|
||||
run: |
|
||||
docker run --rm \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
-v "$PWD:/src" \
|
||||
$IMAGE \
|
||||
sh -c "cppcheck --error-exitcode=1 \
|
||||
--enable=warning,style,performance,portability \
|
||||
--suppress=missingInclude \
|
||||
--inline-suppr \
|
||||
--std=c11 \
|
||||
-I /src/include \
|
||||
/src/src/"
|
||||
|
||||
docs:
|
||||
name: Build documentation
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build container image
|
||||
run: docker build -t $IMAGE .
|
||||
|
||||
- name: Doxygen
|
||||
run: |
|
||||
docker run --rm \
|
||||
--user "$(id -u):$(id -g)" \
|
||||
-v "$PWD:/src" \
|
||||
$IMAGE \
|
||||
sh -c "cd /src && doxygen Doxyfile 2>&1 | tee /tmp/doxy.log && \
|
||||
! grep -q 'warning:' /tmp/doxy.log"
|
||||
Reference in New Issue
Block a user