Skip to content

Commit 65c080c

Browse files
authored
[ci] Test Git hooks (#919)
1 parent 8fa5a84 commit 65c080c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ jobs:
411411
cargo install cargo-readme --version 3.2.0 &> /dev/null || true
412412
cargo install --locked kani-verifier &> /dev/null || true
413413
cargo kani setup &> /dev/null || true
414+
414415
check-all-toolchains-tested:
415416
runs-on: ubuntu-latest
416417
name: Check that all toolchains listed in Cargo.toml are tested in CI
@@ -431,6 +432,22 @@ jobs:
431432
- name: Run dependency check
432433
run: ./ci/check_job_dependencies.sh
433434

435+
run-git-hooks:
436+
runs-on: ubuntu-latest
437+
name: Run Git hooks
438+
steps:
439+
- name: Install yq (for YAML parsing)
440+
run: go install github.com/mikefarah/yq/v4@latest
441+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
442+
- name: Run dependency check
443+
# Ensure that Git hooks execute successfully.
444+
#
445+
# Note that this runs all hooks. As of this writing, the only Git hook
446+
# is `pre-push`. Running all hooks ensures that, if a new hook is added
447+
# which can't run in CI (at least not using this naive setup), we'll
448+
# notice and it will remind us to update this test.
449+
run: set -e; for hook in ./githooks/*; do $hook; done
450+
434451
# Used to signal to branch protections that all other jobs have succeeded.
435452
all-jobs-succeed:
436453
name: All checks succeeded
@@ -441,7 +458,7 @@ jobs:
441458
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
442459
if: failure()
443460
runs-on: ubuntu-latest
444-
needs: [build_test, kani, check_fmt, check_readme, check_msrv, check_versions, generate_cache, check-all-toolchains-tested, check-job-dependencies]
461+
needs: [build_test, kani, check_fmt, check_readme, check_msrv, check_versions, generate_cache, check-all-toolchains-tested, check-job-dependencies, run-git-hooks]
445462
steps:
446463
- name: Mark the job as failed
447464
run: exit 1

0 commit comments

Comments
 (0)