mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
ci: Run clang-tidy 3 times to make sure we don't have to fix again (#2803)
This commit is contained in:
33
.github/workflows/clang-tidy.yml
vendored
33
.github/workflows/clang-tidy.yml
vendored
@@ -62,27 +62,30 @@ jobs:
|
|||||||
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
||||||
id: nproc
|
id: nproc
|
||||||
|
|
||||||
- name: Run clang-tidy
|
- name: Run clang-tidy (several times)
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
id: run_clang_tidy
|
id: clang_tidy
|
||||||
run: |
|
run: |
|
||||||
run-clang-tidy-${{ env.LLVM_TOOLS_VERSION }} -p build -j "${{ steps.nproc.outputs.nproc }}" -fix -quiet 1>output.txt
|
# 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
|
- name: Fix local includes and clang-format style
|
||||||
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
if: ${{ steps.files_changed.outcome != 'success' }}
|
||||||
run: |
|
run: |
|
||||||
pre-commit run --all-files fix-local-includes || true
|
pre-commit run --all-files fix-local-includes || true
|
||||||
pre-commit run --all-files clang-format || true
|
pre-commit run --all-files clang-format || true
|
||||||
|
|
||||||
- name: Print issues found
|
|
||||||
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
|
||||||
run: |
|
|
||||||
sed -i '/error\||/!d' ./output.txt
|
|
||||||
cat output.txt
|
|
||||||
rm output.txt
|
|
||||||
|
|
||||||
- name: Create an issue
|
- name: Create an issue
|
||||||
if: ${{ steps.run_clang_tidy.outcome != 'success' && github.event_name != 'pull_request' }}
|
if: ${{ (steps.clang_tidy.outcome != 'success' || steps.files_changed.outcome != 'success') && github.event_name != 'pull_request' }}
|
||||||
id: create_issue
|
id: create_issue
|
||||||
uses: ./.github/actions/create-issue
|
uses: ./.github/actions/create-issue
|
||||||
env:
|
env:
|
||||||
@@ -95,7 +98,7 @@ jobs:
|
|||||||
List of the issues found: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/
|
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
|
- uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
|
||||||
if: ${{ steps.run_clang_tidy.outcome != 'success' && github.event_name != 'pull_request' }}
|
if: ${{ steps.files_changed.outcome != 'success' && github.event_name != 'pull_request' }}
|
||||||
with:
|
with:
|
||||||
gpg_private_key: ${{ secrets.ACTIONS_GPG_PRIVATE_KEY }}
|
gpg_private_key: ${{ secrets.ACTIONS_GPG_PRIVATE_KEY }}
|
||||||
passphrase: ${{ secrets.ACTIONS_GPG_PASSPHRASE }}
|
passphrase: ${{ secrets.ACTIONS_GPG_PASSPHRASE }}
|
||||||
@@ -103,7 +106,7 @@ jobs:
|
|||||||
git_commit_gpgsign: true
|
git_commit_gpgsign: true
|
||||||
|
|
||||||
- name: Create PR with fixes
|
- name: Create PR with fixes
|
||||||
if: ${{ steps.run_clang_tidy.outcome != 'success' && github.event_name != 'pull_request' }}
|
if: ${{ steps.files_changed.outcome != 'success' && github.event_name != 'pull_request' }}
|
||||||
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
|
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
|
||||||
env:
|
env:
|
||||||
GH_REPO: ${{ github.repository }}
|
GH_REPO: ${{ github.repository }}
|
||||||
@@ -119,5 +122,5 @@ jobs:
|
|||||||
reviewers: "godexsoft,kuznetsss,PeterChen13579,mathbunnyru"
|
reviewers: "godexsoft,kuznetsss,PeterChen13579,mathbunnyru"
|
||||||
|
|
||||||
- name: Fail the job
|
- name: Fail the job
|
||||||
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
if: ${{ steps.clang_tidy.outcome != 'success' || steps.files_changed.outcome != 'success' }}
|
||||||
run: exit 1
|
run: exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user