sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

Addition of pre-commit script

Open AbhijithGanesh opened this issue 2 years ago • 18 comments

Signed-off-by: Abhijith Ganesh [email protected]

PR Info

  • Closes #610
  • Dependencies:
    • None
  • Dependents:
    • None

Adds

A pre-commit script that takes care of CI and commit signing.

Fixes

None

Breaking Changes

None

Changes

Adds DCO Workflow to the project

AbhijithGanesh avatar Mar 15 '22 06:03 AbhijithGanesh

Is there a difference between DCO and -s? I thought they were the same thing. We agreed not to enforce GPG based commit signing

AbhijithGanesh avatar Mar 15 '22 06:03 AbhijithGanesh

According to the docs , I think -s and DCO are the same thing?

AbhijithGanesh avatar Mar 15 '22 06:03 AbhijithGanesh

im guessing what billy means is that instead of adding a check and making the user add a -s flag to the commit, use a pre commit hook to add the flag automatically

pre commit hook is something like husky

kakarot-dev avatar Mar 15 '22 07:03 kakarot-dev

Thanks!! @kakarot-dev That's what I meant :P

billy1624 avatar Mar 15 '22 07:03 billy1624

I can integrate the same

AbhijithGanesh avatar Mar 16 '22 13:03 AbhijithGanesh

Yeah but what if the contributors don't use Husky ? It won't sign it off?

AbhijithGanesh avatar Mar 16 '22 13:03 AbhijithGanesh

Well first off, Husky is a nodejs module, so i cant see how ur gonna use it in seaorm Secondly, pre commit hooks can also be configured by git config core.hooksPath <dir>

My suggestion is to make a .sh ( strictly names as pre-commit) doing the precommit, then add that using the above command during the initialization of the project

For refrence, you can check this out

kakarot-dev avatar Mar 16 '22 23:03 kakarot-dev

well the whole thing isnt completed yet, if pre commit is by default meant to be implemented

kakarot-dev avatar Mar 18 '22 13:03 kakarot-dev

So, the pre-commit hook should be run on commit and without the need to config / enable it?

billy1624 avatar Mar 18 '22 14:03 billy1624

So, the pre-commit hook should be run on commit and without the need to config / enable it?

It wont run rn if you dont config it with git config core.hooksPath But then again, that command works for a dir, @AbhijithGanesh can u tell how r u planning to make this work?

kakarot-dev avatar Mar 18 '22 23:03 kakarot-dev

@billy1624 any suggestions?

AbhijithGanesh avatar Mar 22 '22 02:03 AbhijithGanesh

I think it's better to add the extra -s when performing git commit and leave testing for GitHub Actions to handle it

Btw... @tyt2y3 do you think we should enforce Developer Certificate of Origin (DCO)? https://github.com/apps/dco

billy1624 avatar Mar 22 '22 04:03 billy1624

The script does add -s, in addition, the script runs couple of tests, thats it. If you want the tests removed, let me know!

AbhijithGanesh avatar Mar 22 '22 05:03 AbhijithGanesh

Tests r not optional tho… Also how bout moving the scripts to a folder and adding some lines that specify how to set it up with git

kakarot-dev avatar Mar 22 '22 08:03 kakarot-dev

The tests are not optional because they are being run in the script. Do you want them optional?

AbhijithGanesh avatar Mar 22 '22 15:03 AbhijithGanesh

Also how bout moving the scripts to a folder and adding some lines that specify how to set it up with git

I'd say we only have a few scripts, so the folder part is not necessary, but how to set it up with git can be done!

AbhijithGanesh avatar Mar 22 '22 15:03 AbhijithGanesh

@billy1624 can you look at this please? Thanks

AbhijithGanesh avatar Mar 26 '22 10:03 AbhijithGanesh

Hey @AbhijithGanesh, as I said on the Discord. I would suggest not to enforce DCO with GitHub Action. Maybe we can just add a pre-commit hook to add the sign -s flag when running git commit.

I would suggest that you check everything you want enforced in a pipeline, after all git commit --no-verify skips the hooks, or contributors might forget to install the hooks on a new machine.

Also git config --global commit.gpgsign true (not sure) might be an option, which goes in a similar direction like a hook. (Downside you need an ssh key, upside it is actually signed). Unfortunately I ahve not found a plain signoff option that could be set.

That said, the reason I am writing here is #591 and the resulting #757 which was created before I was aware of this PR.

maltevesper avatar May 22 '22 00:05 maltevesper