Skip to content

Merge pull request #894 from AMS21/dependabot/submodules/external/fmt… #1649

Merge pull request #894 from AMS21/dependabot/submodules/external/fmt…

Merge pull request #894 from AMS21/dependabot/submodules/external/fmt… #1649

Workflow file for this run

name: StyleCheck
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches-ignore:
- 'dependabot/**'
release:
types: [published]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
clang-format:
runs-on: ubuntu-24.04
env:
LLVM_VERSION: 18
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install
run: external/Phi/scripts/ci/InstallTools.sh clang-format-${{ env.LLVM_VERSION }}
- name: Run clang-format
run: clang-format-${{ env.LLVM_VERSION }} -i $(find ! \( -path ./external -prune \) -iname "*.[hc]pp" -type f)
- name: Report result
run: |
if [ -z "$(git status -s)" ]; then
echo Everything seems to be in order
else
echo Formatting problems found!
git diff --color=always --minimal
exit 1
fi
cmake-format:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install
run: external/Phi/scripts/ci/InstallTools.sh cmake-format
- name: Run cmake-format
run: cmake-format -c ".cmake-format.yaml" -i $(find ! \( -path ./external -prune \) -iregex "./.*\.cmake" -or -iregex "./.*\CMakeLists\.txt") external/CMakeLists.txt
- name: Report result
run: |
if [ -z "$(git status -s)" ]; then
echo Everything seems to be in order
else
echo Formatting problems found!
git diff --color=always --minimal
exit 1
fi
spacing:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install
run: sudo apt-get install moreutils
- name: Fix spacing
run: |
# Fix mixed tabs and spaces
find . -path "./external" -prune -o -iregex '.*\.\(hpp\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'expand -t 4 "$0" | sponge "$0"' {} \;
# Fix trailing white spaces
find . -path "./external" -prune -o -iregex '.*\.\(hpp\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'sed -i '' -e's/[[:space:]]*$//' "$0"' {} \;
# Ensure files end with a new line
find . -path "./external" -prune -o -iregex '.*\.\(hpp\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'tail -c1 < "$0" | read -r _ || echo >> "$0"' {} \;
- name: Report result
run: |
if [ -z "$(git status -s)" ]; then
echo Everything seems to be in order
else
echo Formatting problems found!
git diff --color=always --minimal
exit 1
fi
encoding:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install
run: sudo apt-get install dos2unix recode
- name: Fix encoding
run: |
# Ensure that files are UTF-8 formatted
find . -path "./external" -prune -o -iregex '.*\.\(hpp\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'recode UTF-8 "$0" 2> /dev/null' {} \;
# Ensure that files have LF line endings and do not contain a BOM.
find . -path "./external" -prune -o -iregex '.*\.\(hpp\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'dos2unix "$0" 2> /dev/null' {} \;
- name: Report result
run: |
if [ -z "$(git status -s)" ]; then
echo Everything seems to be in order
else
echo Formatting problems found!
git diff --color=always --minimal
exit 1
fi
misspell:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine reporter
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: 'github-pr-check'
if_false: 'github-check'
- name: Run misspell with reviewdog
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
locale: US
reporter: ${{ steps.reporter.outputs.value }}
level: warning
yamllint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine reporter
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: 'github-pr-check'
if_false: 'github-check'
- name: Run yamllint with reviewdog
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
yamllint_flags: '-d "{extends: relaxed, rules: {line-length: {max: 100}}}"'
level: warning
markdownlint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine reporter
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: 'github-pr-check'
if_false: 'github-check'
- name: Run markdownlint with reviewdog
uses: prologic/action-markdownlint@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
level: warning
remark-lint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine reporter
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: 'github-pr-check'
if_false: 'github-check'
- name: Run remark-lint with reviewdog
uses: prologic/action-remark-lint@v5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
level: warning
languagetool:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine reporter
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: 'github-pr-check'
if_false: 'github-check'
- name: Run languagetool with Reviewdog
uses: reviewdog/action-languagetool@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
level: warning
alex:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine reporter
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: 'github-pr-check'
if_false: 'github-check'
- name: Run alex with reviewdog
uses: reviewdog/action-alex@v1
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
level: warning