40 lines
922 B
YAML
40 lines
922 B
YAML
name: Code Formatting
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CLANG_VERSION: "20"
|
|
|
|
jobs:
|
|
clang-format:
|
|
name: Run clang-format
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Install the exact clang-format binary
|
|
- name: Install clang-format
|
|
run: |
|
|
sudo apt install clang-format-${{ env.CLANG_VERSION }}
|
|
|
|
# Prints the version of clang-format being used
|
|
- name: Log clang-format version
|
|
run: clang-format-${{ env.CLANG_VERSION }} --version
|
|
|
|
# Runs clang-format over the repository codebase
|
|
- name: Check format
|
|
run: |
|
|
{
|
|
find include/gsl -type f
|
|
find tests -type f \( -name '*.cpp' -o -name '*.h' \)
|
|
} | xargs clang-format-${{ env.CLANG_VERSION }} --dry-run --Werror
|