From 08e1a335247b9c6b5653bc75fd720574c12062e2 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Tue, 12 Mar 2024 14:38:12 -0400 Subject: [PATCH] GitHub Actions infrastructure for formatting checks (#1055) * add pre-commit config * GitHub Actions starting with pre-commit --- .github/workflows/ci.yml | 21 ++++++++++++++++++ .github/workflows/pre-commit.yml | 18 ++++++++++++++++ .pre-commit-config.yaml | 37 ++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..0a791491f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +--- +name: ci + +# yamllint disable-line rule:truthy +on: + push: + pull_request: + +concurrency: + group: ci-${{github.ref}}-${{github.event.pull_request.number || github.run_number}} + cancel-in-progress: true + +jobs: + prechecks: + uses: ./.github/workflows/pre-commit.yml + all-prechecks: + needs: [prechecks] + runs-on: ubuntu-latest + steps: + - name: Success + run: "true" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..795bdfe38 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,18 @@ +--- +name: pre-commit + +# yamllint disable-line rule:truthy +on: + workflow_call: + +concurrency: + group: style-${{github.ref}}-${{github.event.pull_request.number || github.run_number}} + cancel-in-progress: true + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..931a86b19 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,37 @@ +--- +fail_fast: false +repos: + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.5.0" + hooks: + - id: check-case-conflict + - id: check-merge-conflict + - repo: https://github.com/cheshirekow/cmake-format-precommit + rev: "v0.6.13" + hooks: + - id: cmake-format + args: [--config-files, experimental/.cmake-format.yaml] + additional_dependencies: + - pyyaml + - id: cmake-lint + additional_dependencies: + - pyyaml + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: "v12.0.1" + hooks: + - id: clang-format + types_or: [c++, c] + exclude: | + (?x)( + build/| + src/sst/core/libltdl/| + external/ + ) + - repo: https://github.com/Mateusz-Grzelinski/actionlint-py + rev: "v1.6.26.11" + hooks: + - id: actionlint