name: CI on: push: branches: [main] pull_request: branches: [main] jobs: build: name: Build firmware runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - name: Install toolchain run: | sudo apt-get update -q sudo apt-get install -y --no-install-recommends \ gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi \ cmake ninja-build - name: Compile firmware run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel . && ninja -C build - name: Memory summary run: | echo '## Memory usage' >> "$GITHUB_STEP_SUMMARY" echo '' >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY" arm-none-eabi-size -A build/firmware \ | grep -E '^\.(text|data|bss|rodata|ARM)' \ >> "$GITHUB_STEP_SUMMARY" echo '' >> "$GITHUB_STEP_SUMMARY" arm-none-eabi-size build/firmware | tail -1 >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY" - name: Upload firmware artifacts uses: actions/upload-artifact@v4 with: name: firmware-${{ github.sha }} path: | build/firmware.hex build/firmware.map if-no-files-found: error format: name: Check formatting runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install clang-format run: | sudo apt-get update -q sudo apt-get install -y --no-install-recommends clang-format - name: clang-format check run: | find src include -name '*.c' -o -name '*.h' | \ xargs clang-format --dry-run --Werror --style=file:.clang-format lint: name: Static analysis runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install cppcheck run: | sudo apt-get update -q sudo apt-get install -y --no-install-recommends cppcheck - name: cppcheck run: | cppcheck --error-exitcode=1 \ --enable=warning,style,performance,portability \ --suppress=missingInclude \ --inline-suppr \ --std=c11 \ -I include \ src/ docs: name: Build documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Doxygen run: | sudo apt-get update -q sudo apt-get install -y --no-install-recommends doxygen - name: Doxygen run: | doxygen Doxyfile 2>&1 | tee /tmp/doxy.log ! grep -q 'warning:' /tmp/doxy.log - name: Deploy to gh-pages if: github.ref == 'refs/heads/main' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd docs/html git init -b gh-pages git config user.name "ci" git config user.email "ci@localhost" git add -A git commit -m "docs: ${GITHUB_SHA}" SERVER="${GITHUB_SERVER_URL#https://}" git push --force \ "https://x-token:${GITHUB_TOKEN}@${SERVER}/${GITHUB_REPOSITORY}.git" \ HEAD:gh-pages