Page MenuHomePhabricator

[CI] Add identity pre-commit hook
ClosedPublic

Authored by jon on Sep 14 2022, 10:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 2 2024, 1:15 PM
Unknown Object (File)
Nov 2 2024, 1:15 PM
Unknown Object (File)
Nov 2 2024, 1:15 PM
Unknown Object (File)
Nov 2 2024, 1:07 PM
Unknown Object (File)
Nov 2 2024, 12:41 PM
Unknown Object (File)
Oct 9 2024, 8:40 PM
Unknown Object (File)
Oct 9 2024, 8:40 PM
Unknown Object (File)
Oct 8 2024, 1:16 AM
Subscribers

Details

Summary

Force the identity test suite to run as a pre-commit hook when editing
files from that directory.

This can take ~1s for a dirty repository, up to ~40s for a clean build.

bash -c had to be used, because it looks like they fork + exec the command, which means that you need a valid interpreter as the command. cd is just a shell builtin and only exists in the context of an interpreter shell.

https://linear.app/comm/issue/ENG-1813

Test Plan
# change a file in services/identity
git add .
git commit -m "test"
# assert that hook is ran

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested changes to this revision.Sep 15 2022, 7:17 AM

Hm, followed the Test Plan (added a println! to main.rs) but got the following:

de0c4d.png (282×998 px, 59 KB)

Specifically "No staged files match any configured task."

Is there something I'm missing?

This revision now requires changes to proceed.Sep 15 2022, 7:17 AM

services/identity/*.rs

Guessing it's because main.rs is within services/identity/src?

Think we need a globstar

Right, good catch

could also use --manifest-path to avoid cd-ing

This revision is now accepted and ready to land.Sep 19 2022, 1:59 PM
This revision was automatically updated to reflect the committed changes.