diff --git a/.github/workflows/static_tests.yml b/.github/workflows/static_tests.yml new file mode 100644 index 000000000..7f2cc313d --- /dev/null +++ b/.github/workflows/static_tests.yml @@ -0,0 +1,60 @@ +# +# 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 .