aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-13 14:37:43 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-13 14:49:05 +0100
commit68020ee51695a15b3e93f117aa90728f7ab87ecd (patch)
tree82fa004bc112f0ef708b225eab5c01b96e46afbd /.github/workflows
parenta1bfa7d2b28cfd416ca644bb73419517ddc2b17d (diff)
downloadFirmament-68020ee51695a15b3e93f117aa90728f7ab87ecd.tar.gz
Firmament-68020ee51695a15b3e93f117aa90728f7ab87ecd.tar.bz2
Firmament-68020ee51695a15b3e93f117aa90728f7ab87ecd.zip
meta: Add pre-commit checks
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/meta-checks.yml51
-rw-r--r--.github/workflows/reuse.yml18
2 files changed, 51 insertions, 18 deletions
diff --git a/.github/workflows/meta-checks.yml b/.github/workflows/meta-checks.yml
new file mode 100644
index 0000000..8a15be2
--- /dev/null
+++ b/.github/workflows/meta-checks.yml
@@ -0,0 +1,51 @@
+# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
+# SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+#
+# SPDX-License-Identifier: CC0-1.0
+
+name: Pre commit checks
+
+on: [ push, pull_request ]
+
+jobs:
+ reuse:
+ name: Run REUSE Compliance check
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout Repository
+ - name: REUSE Compliance Check
+ uses: fsfe/reuse-action@140e81ab76b30d9c5641b7b11e28222b3a11f8f9
+
+ pre-commit-generate:
+ name: Generate PRE-Commit hooks
+ runs-on: ubuntu-latest
+ outputs:
+ hooks: ${{ steps.generate-matrix.outputs.hooks }}
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout Repository+
+ - name: Generate matrix
+ id: generate-matrix
+ run: |
+ printf 'hooks=' >>"$GITHUB_OUTPUT"
+ # Note: GitHub runner image mentions a yq already being installed. That is not jq but for yaml, but another unrelated program
+ pipx run yq -c '[.repos[]|.hooks[]|.id]' <.pre-commit-config.yaml | tee -a "$GITHUB_OUTPUT"
+ echo >>"$GITHUB_OUTPUT"
+ cat "$GITHUB_OUTPUT"
+ pre-commit:
+ runs-on: ubuntu-latest
+ needs: pre-commit-generate
+ strategy:
+ matrix:
+ hook: ${{ fromJSON(needs.pre-commit-generate.outputs.hooks) }}
+ name: 'PRE-Commit: ${{ matrix.hook }}'
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout Repository
+ - uses: actions/setup-python@v4
+ name: Setup Python
+ - name: Check ${{ matrix.hook }}
+ uses: pre-commit/action@v3.0.1
+ with:
+ extra_args: ${{ matrix.hook }} --all-files
diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml
deleted file mode 100644
index 5d8a289..0000000
--- a/.github/workflows/reuse.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
-# SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
-#
-# SPDX-License-Identifier: CC0-1.0
-
-name: REUSE Compliance Check
-
-on: [push, pull_request]
-
-jobs:
- test:
- name: Run Compliance check
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- name: Checkout Repository
- - name: REUSE Compliance Check
- uses: fsfe/reuse-action@v4