fix: WorkQueue contention (#2866) #1107
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Clang-tidy check | |
| on: | |
| push: | |
| branches: [develop] | |
| schedule: | |
| - cron: "0 9 * * 1-5" | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [develop] | |
| paths: | |
| - .github/workflows/clang-tidy.yml | |
| - .clang_tidy | |
| concurrency: | |
| # Only cancel in-progress jobs or runs for the current workflow - matches against branch & tags | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CONAN_PROFILE: clang | |
| LLVM_TOOLS_VERSION: 20 | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| clang_tidy: | |
| if: github.event_name != 'push' || contains(github.event.head_commit.message, 'clang-tidy auto fixes') | |
| runs-on: heavy | |
| container: | |
| image: ghcr.io/xrplf/clio-ci:067449c3f8ae6755ea84752ea2962b589fe56c8f | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Prepare runner | |
| uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6 | |
| with: | |
| disable_ccache: true | |
| - name: Run conan | |
| uses: ./.github/actions/conan | |
| with: | |
| conan_profile: ${{ env.CONAN_PROFILE }} | |
| - name: Run CMake | |
| uses: ./.github/actions/cmake | |
| with: | |
| conan_profile: ${{ env.CONAN_PROFILE }} | |
| - name: Get number of processors | |
| uses: XRPLF/actions/get-nproc@cf0433aa74563aead044a1e395610c96d65a37cf | |
| id: nproc | |
| - name: Run clang-tidy (several times) | |
| continue-on-error: true | |
| id: clang_tidy | |
| run: | | |
| # We run clang-tidy several times, because some fixes may enable new fixes in subsequent runs. | |
| CLANG_TIDY_COMMAND="run-clang-tidy-${{ env.LLVM_TOOLS_VERSION }} -p build -j ${{ steps.nproc.outputs.nproc }} -fix -quiet" | |
| ${CLANG_TIDY_COMMAND} || | |
| ${CLANG_TIDY_COMMAND} || | |
| ${CLANG_TIDY_COMMAND} | |
| - name: Check for changes | |
| id: files_changed | |
| continue-on-error: true | |
| run: | | |
| git diff --exit-code | |
| - name: Fix local includes and clang-format style | |
| if: ${{ steps.files_changed.outcome != 'success' }} | |
| run: | | |
| pre-commit run --all-files fix-local-includes || true | |
| pre-commit run --all-files clang-format || true | |
| - name: Create an issue | |
| if: ${{ (steps.clang_tidy.outcome != 'success' || steps.files_changed.outcome != 'success') && github.event_name != 'pull_request' }} | |
| id: create_issue | |
| uses: ./.github/actions/create-issue | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| with: | |
| title: "Clang-tidy found bugs in code 🐛" | |
| body: > | |
| Clang-tidy found issues in the code: | |
| List of the issues found: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/ | |
| - uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0 | |
| if: ${{ steps.files_changed.outcome != 'success' && github.event_name != 'pull_request' }} | |
| with: | |
| gpg_private_key: ${{ secrets.ACTIONS_GPG_PRIVATE_KEY }} | |
| passphrase: ${{ secrets.ACTIONS_GPG_PASSPHRASE }} | |
| git_user_signingkey: true | |
| git_commit_gpgsign: true | |
| - name: Create PR with fixes | |
| if: ${{ steps.files_changed.outcome != 'success' && github.event_name != 'pull_request' }} | |
| uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0 | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} | |
| with: | |
| commit-message: "[CI] clang-tidy auto fixes" | |
| committer: Clio CI <[email protected]> | |
| branch: "clang_tidy/autofix" | |
| branch-suffix: timestamp | |
| delete-branch: true | |
| title: "style: clang-tidy auto fixes" | |
| body: "Fixes #${{ steps.create_issue.outputs.created_issue_id }}. Please review and commit clang-tidy fixes." | |
| reviewers: "godexsoft,kuznetsss,PeterChen13579,mathbunnyru" | |
| - name: Fail the job | |
| if: ${{ steps.clang_tidy.outcome != 'success' || steps.files_changed.outcome != 'success' }} | |
| run: exit 1 |