Skip to content

Commit

Permalink
github: workflows: moved clang-format to Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vpirogov committed Dec 18, 2024
1 parent 8bdf073 commit 89e27ef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
11 changes: 0 additions & 11 deletions .github/automation/.azure-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ trigger:
- rls-*

jobs:
- job: 'ClangFormat'
pool:
vmImage: 'ubuntu-20.04'
steps:
- script: |
.github/automation/env/clang.sh 11
displayName: 'init'
- script: |
.github/automation/clang-format.sh
displayName: 'ClangFormat_Check'
failOnStderr: true
- job: 'Ubuntu20'
timeoutInMinutes: 120
pool:
Expand Down
13 changes: 10 additions & 3 deletions .github/automation/clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@
# limitations under the License.
#===============================================================================

echo "Using clang-format version: $(clang-format --version)"
CLANG_FORMAT=clang-format-11

echo "Checking ${CLANG_FORMAT}"
if ! ${CLANG_FORMAT} --version; then
echo ${CLANG_FORMAT} is not available or not working correctly.
exit 1
fi

echo "Starting format check..."

for filename in $(find "$(pwd)" -type f | grep -P ".*\.(c|cpp|h|hpp|cl)$"); do clang-format -style=file -i $filename; done
for filename in $(find "$(pwd)" -type f | grep -P ".*\.(c|cpp|h|hpp|cl)$"); do ${CLANG_FORMAT} -style=file -i $filename; done

RETURN_CODE=0
echo $(git status) | grep "nothing to commit" > /dev/null
Expand All @@ -32,4 +39,4 @@ else
echo "Clang-format check PASSED! Not formatted files not found..."
fi

exit ${RETURN_CODE}
exit ${RETURN_CODE}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
# *******************************************************************************

name: "PR Checks"
name: "PR Linters"

on:
pull_request:
Expand All @@ -31,8 +31,8 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
commit-message-check:
name: Commit message checker
pr-formatting:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -41,3 +41,7 @@ jobs:
fetch-depth: 0
- name: Check commit messages
run: python3 ./.github/automation/commit-msg-check.py "${{ github.event.pull_request.head.sha }}" "${{ github.event.pull_request.base.sha }}"
- name: Install clang-format
run: sudo apt update && sudo apt install -y "clang-format-11"
- name: Check code formatting
run: .github/automation/clang-format.sh

0 comments on commit 89e27ef

Please sign in to comment.