qingyi-yan / POET

Other
1 stars 2 forks source link

Add pre-push hooks #27

Closed yimjay closed 1 year ago

yimjay commented 1 year ago

This PR's main goal is to add a pre-push hook to enforce "make check" tests to pass before one is able to push to the remote.

In order to be able to push this PR to remote I had to:

To test the pre-push hook in this PR, please follow these steps:

  1. checkout feat-add-hooks
  2. edit to add: might want to fork the repo and experiment on a forked version for the following steps
  3. checkout a new branch (based on feat-add-hooks so you get the hook)
  4. might require rebuilding POET depending on your system
  5. update git's default hooks directory (local only to this repository) with:
    • find .git/hooks -type l -exec rm {} \; //removes any already existing symlinks
    • find hooks -type f -exec ln -sf ../../{} .git/hooks/ \; //creates a symlink to hooks/pre-push
  6. make a small test change and commit
    • for example, to see the pre-push hook rejecting pushes when make check doesn't pass, one can add parsePy to testdirs in configure.ac to re-enable parsePy tests
  7. git push --> this should push if tests pass

Future developments