diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..eae3f875 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,38 @@ +firmware: + - changed-files: + - any-glob-to-any-file: + - src/** + - lib/** + - open-x4-sdk/** + +ui: + - changed-files: + - any-glob-to-any-file: + - src/activities/** + - src/network/html/** + - docs/images/** + +epub: + - changed-files: + - any-glob-to-any-file: + - lib/Epub/** + +network: + - changed-files: + - any-glob-to-any-file: + - src/network/** + - src/util/UrlUtils.* + - lib/OpdsParser/** + +docs: + - changed-files: + - any-glob-to-any-file: + - docs/** + - README* + - CHANGELOG* + +tests: + - changed-files: + - any-glob-to-any-file: + - test/** + - scripts/** diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57c7c2de..e12c26a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,34 @@ permissions: pull-requests: write jobs: - build: + 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 @@ -23,19 +50,22 @@ jobs: - name: Install PlatformIO Core run: pip install --upgrade platformio - - 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 cppcheck run: pio check --fail-on-defect low --fail-on-defect medium --fail-on-defect high - - 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) + 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: | diff --git a/.github/workflows/pr-formatting-check.yml b/.github/workflows/pr-formatting-check.yml index 044b7b64..fd9c4d02 100644 --- a/.github/workflows/pr-formatting-check.yml +++ b/.github/workflows/pr-formatting-check.yml @@ -9,6 +9,7 @@ on: permissions: statuses: write + pull-requests: write jobs: title-check: @@ -21,6 +22,44 @@ jobs: egress-policy: audit - name: Check PR Title + id: title_check uses: amannn/action-semantic-pull-request@v6 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Comment with changelog hint on failure + if: failure() + uses: actions/github-script@v7 + with: + script: | + const marker = ''; + const error = + `${{ steps.title_check.outputs.error_message || steps.title_check.outputs.error || '' }}`.trim(); + const details = error ? `\n\n**Error:** ${error}` : '\n\n**Error:** See workflow logs.'; + const body = `${marker} + **PR title check failed** + + Please use a Conventional Commit-style prefix (e.g., \`feat:\`, \`fix:\`, \`docs:\`, \`chore:\`). + If this change should appear in release notes, ensure the title reflects the correct category.${details}`; + + 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, + }); + }