Smart github actions for shellcheck and clang-format (#14881)

* Smart github actions for shellcheck and clang-format

* Try to remove paths

* Added exclude
This commit is contained in:
Ilya Lavrenov 2023-01-02 05:16:45 +04:00 committed by GitHub
parent a856dc4776
commit f78fa5b769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,8 @@ concurrency:
jobs: jobs:
clang-format: clang-format:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
permissions:
contents: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -34,33 +36,19 @@ jobs:
# Run cmake with -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT in order to enable codestyle check for ITT collector # Run cmake with -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT in order to enable codestyle check for ITT collector
- name: CMake configure - name: CMake configure
run: | run: cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -B build
cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -B build
- name: Check code style - name: Fix code style
run: cmake --build build --target clang_format_check_all -j8 run: cmake --build build --target clang_format_fix_all -j8
- name: Create code style diff - uses: stefanzweifel/git-auto-commit-action@v4
if: failure()
run: |
cmake --build build --target clang_format_fix_all -j8
git diff > code_style_diff.diff
- name: suggester / clang-format
if: failure() && startsWith(github.event_name, 'pull_request')
uses: reviewdog/action-suggester@v1
with: with:
level: error commit_message: "[github actions] Apply clang-format code style fixes"
tool_name: clang-format
- uses: actions/upload-artifact@v3
if: failure()
with:
name: code_style_diff
path: code_style_diff.diff
ShellCheck: ShellCheck:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
permissions:
pull-requests: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -74,9 +62,22 @@ jobs:
- name: CMake configure - name: CMake configure
run: cmake -DENABLE_INTEL_MYRIAD_COMMON=OFF -B build run: cmake -DENABLE_INTEL_MYRIAD_COMMON=OFF -B build
- name: ShellCheck - name: Shellcheck cmake target
run: cmake --build build --target ie_shellcheck -j8 run: cmake --build build --target ie_shellcheck -j8
# always provide suggestions even for skipped scripts in ie_shellcheck tagret
- name: ShellCheck action
if: always()
uses: reviewdog/action-shellcheck@v1
with:
level: style
reporter: github-pr-review
check_all_files_with_shebangs: true
fail_on_error: true
exclude: |
"*/thirdparty/*"
"./temp/*"
NamingConventionCheck: NamingConventionCheck:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps: