Scripts to run clang-format formatting and clang-tidy checks on all source c++/cuda files #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# detailed syntax defined in | |
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions | |
# | |
name: "Static Tests" | |
on: [push, pull_request] | |
jobs: | |
clang-format: | |
runs-on: "ubuntu-20.04" | |
env: | |
CLANG_REQUIRE_VERSION: 17.0.4 | |
CLANG_FORMAT_FILE: ".clang-format" | |
steps: | |
- name: "Checkout repository content" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: "Install dependencies" | |
run: | | |
python -m pip install --force-reinstall clang-format==${{ env.CLANG_REQUIRE_VERSION }} | |
- name: "Run clang-format..." | |
run: | | |
files=$(find . -iname "*.h" -o -iname "*.cu" -o -iname "*.cpp") | |
diff -u <(cat ${files}) <(clang-format ${files}) | |
black: | |
runs-on: "ubuntu-20.04" | |
steps: | |
- name: "Checkout repository content" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: "Run black..." | |
uses: psf/black@2a1c67e0b2f81df602ec1f6e7aeb030b9709dc7c # 23.11.0 | |
flake8: | |
runs-on: "ubuntu-20.04" | |
steps: | |
- name: "Checkout repository content" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: "Set up Python 3.x" | |
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | |
with: | |
python-version: 3.9 | |
- name: "Install dependencies" | |
run: | | |
pip install flake8 | |
- name: "Run flake8..." | |
run: | | |
flake8 . |