-
Notifications
You must be signed in to change notification settings - Fork 27
CI CD with pre commit hooks and pytest
Hi guys,
I set up the pre-commit
for stLearn then if you want to make a pull request, please follow this instruction:
Step 1:
Install the pre-commit by this https://pre-commit.com/. Please follow their Quick start tutorial but change the second step by (add .pre-commit-config.yaml file):
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: check-docstring-first
- id: check-byte-order-marker
- id: requirements-txt-fixer
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
Step 2:
You add the file to commit and do the commit. After that, it will show you some error in format and automatically fix them for you.
Step 3:
You need to do the git add
and git commit
again for the fixed files.
And you will see you pass all the tests
All now ready to push your commit.
The other part is pytest
. When using it, you will run through our unittest to make sure our code is working.
Before do the pull request, please run:
pytest
and make sure it passed all the test.