-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Run clang-tidy | ||
description: Build clio in build directory | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Get number of threads | ||
uses: ./.github/actions/get_number_of_threads | ||
id: number_of_threads | ||
|
||
- name: Run clang-tidy | ||
shell: bash | ||
id: run_clang_tidy | ||
run: | | ||
run-clang-tidy -p build -j ${{ steps.number_of_threads.outputs.threads_number }} -fix -quiet 1>output.txt | ||
if [[ "$?" != 0 ]]; then | ||
echo 'clang_tidy_failed=true' >> $GITHUB_OUTPUT | ||
fi | ||
sed -i '/error\||/!d' ./output.txt | ||
- name: Print issues found | ||
shell: bash | ||
run: cat output.txt | ||
|
||
- name: Create an issue | ||
if: ${{ steps.run_clang_tidy.outputs.clang_tidy_failed == 'true' }} | ||
id: create_issue | ||
shell: bash | ||
run: | | ||
echo -e 'Clang-tidy found issues in the code:\n' > issue.md | ||
echo -e "List of the issues found: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ gihub.job_id }}" >> issue.md | ||
gh issue create --assignee 'cindyyan317,godexsoft,kuznetsss' --label bug --title 'Clang-tidy found bugs in code🐛' --body-file ./issue.md > create_issue.log | ||
created_issue=$(cat create_issue.log | sed 's|.*/||') | ||
echo "created_issue=$created_issue" >> $GITHUB_OUTPUT | ||
- name: Create PR with fixes | ||
if: ${{ steps.run_clang_tidy.outputs.clang_tidy_failed == 'true' }} | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: '[CI]: clang-tidy auto fixes' | ||
branch: 'clang_tidy/autofix' | ||
branch-suffix: timestamp | ||
delete-branch: true | ||
title: '[CI]: clang-tidy auto fixes' | ||
body: 'Fixes #${{ steps.create_issue.outputs.created_issue }}. Please review and commit clang-tidy fixes' | ||
reviewers: 'cindyyan317,godexsoft,kuznetsss' | ||
|
||
- name: Fail the job if issues found | ||
if: ${{ steps.run_clang_tidy.outputs.clang_tidy_failed == 'true' }} | ||
shell: bash | ||
run: exit 1 |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Clang-tidy check | ||
on: | ||
schedule: | ||
- cron: '0 6 * * 1-5' | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [develop] | ||
|
||
jobs: | ||
build: | ||
runs-on: [self-hosted, Linux] | ||
container: | ||
image: conanio/gcc11:1.61.0 | ||
options: --user root | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare runner | ||
uses: ./.github/actions/prepare_runner | ||
with: | ||
disable_ccache: true | ||
|
||
- name: Setup conan | ||
uses: ./.github/actions/setup_conan | ||
id: conan | ||
|
||
- name: Restore cache | ||
uses: ./.github/actions/restore_cache | ||
id: restore_cache | ||
with: | ||
conan_dir: ${{ env.CONAN_USER_HOME }}/.conan | ||
ccache_dir: ${{ env.CCACHE_DIR }} | ||
|
||
- name: Run conan and cmake | ||
uses: ./.github/actions/generate | ||
with: | ||
conan_profile: ${{ steps.conan.outputs.conan_profile }} | ||
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }} | ||
build_type: Release | ||
|
||
- name: Run clang-tidy | ||
uses: ./.github/actions/clang_tidy |