name: CI 'on': push: branches: [master] pull_request: permissions: contents: read pull-requests: write jobs: label: runs-on: ubuntu-latest steps: - uses: actions/labeler@v5 clang-format: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: recursive - uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install clang-format-21 run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 21 sudo apt-get update sudo apt-get install -y clang-format-21 - name: Run clang-format run: PATH="/usr/lib/llvm-21/bin:$PATH" ./bin/clang-format-fix && git diff --exit-code || (echo "Please run 'bin/clang-format-fix' to fix formatting issues" && exit 1) cppcheck: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: recursive - uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install PlatformIO Core run: pip install --upgrade platformio - name: Run cppcheck run: pio check --fail-on-defect low --fail-on-defect medium --fail-on-defect high build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: submodules: recursive - uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install PlatformIO Core run: pip install --upgrade platformio - name: Build CrossPoint run: | set -euo pipefail pio run | tee pio.log - name: Extract firmware stats id: fw_stats run: | set -euo pipefail ram_line="$(grep -E "RAM:\\s" -m1 pio.log || true)" flash_line="$(grep -E "Flash:\\s" -m1 pio.log || true)" echo "ram_line=${ram_line}" >> "$GITHUB_OUTPUT" echo "flash_line=${flash_line}" >> "$GITHUB_OUTPUT" { echo "## Firmware build stats" if [ -n "$ram_line" ]; then echo "- ${ram_line}"; else echo "- RAM: not found"; fi if [ -n "$flash_line" ]; then echo "- ${flash_line}"; else echo "- Flash: not found"; fi } >> "$GITHUB_STEP_SUMMARY" - name: Comment PR with firmware stats if: github.event_name == 'pull_request' uses: actions/github-script@v7 with: script: | const marker = ''; const ram = `${{ steps.fw_stats.outputs.ram_line }}`.trim(); const flash = `${{ steps.fw_stats.outputs.flash_line }}`.trim(); const body = `${marker}\n**Firmware build stats**\n\n- ${ram || 'RAM: not found'}\n- ${flash || 'Flash: not found'}`; const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, }); const existing = comments.find((comment) => comment.body && comment.body.includes(marker)); if (existing) { await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: existing.id, body, }); } else { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body, }); }