Skip to content

Commit

Permalink
ci: consistent formatting in style.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
skosukhin committed Dec 23, 2024
1 parent baa930e commit 5c18809
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Check Style
on:
push:
branches:
- main
- develop
- main
- develop
pull_request:
branches-ignore:
- documentation
- documentation
workflow_dispatch:

env:
Expand All @@ -21,52 +21,52 @@ jobs:
GREEN: '\033[0;32m'
FORMAT_PATCH: '${{ github.workspace }}/format.patch'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '>=3.8'
- name: Install required tools
run: python -m pip install cmake-format
- name: Format CMake
run: cmake-format -i $(eval "${FIND_CMAKE_FILES_CMD}")
- name: Check if patching is required
id: patch-required
run: |
git -C '${{ github.workspace }}' diff --patch-with-raw > "${FORMAT_PATCH}"
test -s "${FORMAT_PATCH}" && {
printf "${RED}The source code does not meet the format requirements. \
Please, apply the patch (see artifacts).${DEFAULT}\n"
- name: Check out code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '>=3.8'
- name: Install required tools
run: python -m pip install cmake-format
- name: Format CMake
run: cmake-format -i $(eval "${FIND_CMAKE_FILES_CMD}")
- name: Check if patching is required
id: patch-required
run: |
git -C '${{ github.workspace }}' diff --patch-with-raw > "${FORMAT_PATCH}"
test -s "${FORMAT_PATCH}" && {
printf "${RED}The source code does not meet the format requirements. \
Please, apply the patch (see artifacts).${DEFAULT}\n"
printf "${RED}Note that the result of the formatting might depend on \
the versions of the formatting tools. In this project, whatever \
formatting this CI job produces if the correct one. If it expects you \
to reformat parts of the source code that you did not modify, do so in \
a separate commit, which must not be squashed, and list the commit in \
the '.git-blame-ignore-revs' file.${DEFAULT}\n"
printf "${RED}Note that the result of the formatting might depend \
on the versions of the formatting tools. In this project, whatever \
formatting this CI job produces if the correct one. If it expects \
you to reformat parts of the source code that you did not modify, do \
so in a separate commit, which must not be squashed, and list the \
commit in the '.git-blame-ignore-revs' file.${DEFAULT}\n"
exit 1
} || {
printf "${GREEN}The source code meets the format requirements.${DEFAULT}\n"
rm -rf "${FORMAT_PATCH}"
}
- name: Upload the patch file
if: always() && steps.patch-required.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: format-patch
path: ${{ env.FORMAT_PATCH }}
exit 1
} || {
printf "${GREEN}The source code meets the format requirements.${DEFAULT}\n"
rm -rf "${FORMAT_PATCH}"
}
- name: Upload the patch file
if: always() && steps.patch-required.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: format-patch
path: ${{ env.FORMAT_PATCH }}
Lint:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '>=3.8'
- name: Install required tools
run: python -m pip install cmake-format
- name: Lint CMake
run: cmake-lint $(eval "${FIND_CMAKE_FILES_CMD}")
- name: Check out code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '>=3.8'
- name: Install required tools
run: python -m pip install cmake-format
- name: Lint CMake
run: cmake-lint $(eval "${FIND_CMAKE_FILES_CMD}")

0 comments on commit 5c18809

Please sign in to comment.