Skip to content

Release v0.5.0

Release v0.5.0 #146

Workflow file for this run

name: CI
on:
push:
branches: ["**"]
pull_request:
branches: [main]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
cpp-format:
name: C++ Format Check
runs-on: ubuntu-latest
container: mcr.microsoft.com/devcontainers/cpp:ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: apt-get update -qq && apt-get install -y --no-install-recommends clang-format
- name: Check C++ code formatting
run: |
# Find all C++ files
FILES=$(find . -name "*.cpp" -o -name "*.h" -o -name "*.hpp" | grep -v \.pio | grep -v build)
if [ -n "$FILES" ]; then
echo "Checking formatting for files:"
echo "$FILES"
clang-format --dry-run --Werror $FILES
else
echo "No C++ files found to check"
fi
markdown-lint:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DavidAnson/markdownlint-cli2-action@v22
with:
globs: "*.md"
mermaid-lint:
name: Mermaid Diagram Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install mermaid-cli
run: npm install -g @mermaid-js/mermaid-cli
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run Mermaid validation script
run: python scripts/validate_mermaid.py
unit-tests:
name: Host Unit Tests
runs-on: ubuntu-latest
container: mcr.microsoft.com/devcontainers/cpp:ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache CMake build directory
uses: actions/cache@v4
with:
path: .vscode/build
key: cmake-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'test/CMakeLists.txt') }}
restore-keys: |
cmake-${{ runner.os }}-
- name: Configure CMake
run: |
cmake -B .vscode/build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-Wno-dev
- name: Build tests
run: cmake --build .vscode/build --target pedal_tests -j$(nproc)
- name: Run tests
run: |
mkdir -p test-results
.vscode/build/test/pedal_tests --gtest_output=xml:test-results/
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: test-results/*.xml
comment_mode: always
check_name: "GoogleTest Results"
- name: Upload test report artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results/
retention-days: 30
# Coverage threshold (gcovr --fail-under-line 80) is intentionally CI-only.
# The local pre-commit hook (scripts/pre-commit) does NOT enforce it — running
# gcovr on every commit is too slow for an interactive workflow. A drop below
# 80% will fail this CI job, not the local commit. See TASK-321 closing notes.
coverage:
name: Code Coverage
runs-on: ubuntu-latest
container: mcr.microsoft.com/devcontainers/cpp:ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install gcovr
run: apt-get update -qq && apt-get install -y --no-install-recommends gcovr
- name: Configure CMake with coverage instrumentation
run: |
cmake -B .vscode/build-coverage \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
-Wno-dev
- name: Build tests
run: cmake --build .vscode/build-coverage --target pedal_tests -j$(nproc)
- name: Run tests
run: .vscode/build-coverage/test/pedal_tests
- name: Generate coverage report (HTML + XML, enforce 80% threshold)
run: |
mkdir -p docs/coverage
gcovr \
--root . \
--filter='lib/PedalLogic/.*' \
--filter='lib/hardware/.*' \
--exclude='.*littlefs_file_system.*' \
--html-details docs/coverage/index.html \
--xml coverage.xml \
--print-summary \
--fail-under-line 80
- name: Upload coverage HTML report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-html
path: docs/coverage/
retention-days: 30
- name: Upload coverage XML
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-xml
path: coverage.xml
retention-days: 30