Hooks and Actions
When developing an application, it's common to use different technologies to ensure the good condition of the code and its functioning. To do this, we can use verification and integration tools when certain important actions occur in code versioning.
Git Hooks
Below is the client-side Git Hook script used in this application, it is called pre-commit
because it is the first that will be automatically run locally when a commit occurs, and will perform certain checking actions depending on the files that have been changed and are being committed.
- Run the Lint when files from the
app
folder are committed. - Run the Lint when files from the
tests
folder are committed. - Run the Vulnerability Audit when files from the
requirements
folder are committed, which means new libraries, packages or dependencies have been installed. - Run the Tests anyway, ensuring everything is working.
pre-commit | |
---|---|
Tip
Don't forget to grant the necessary permissions to the hook file.
GitHub Actions
On the server-side, this application uses GitHub Actions to create workflows that will automatically trigger when a push
event occurs to the remote GitHub repository, automating verification and deployment jobs to run automatically.
Verification Job
For Linting and Testing, it will check the repository, configure Python3, install Poetry, load cached venv, and install all necessary dependencies like Pytest and Pylint to perform lint and test operations on the code ensuring everything is fine.
Documentation Job
It will check the repository, configure Python3, load cached venv, and install the MkDocs and Material for MkDocs libraries to configure, deploy and publish the static application documentation web page, written in Markdown, and which will be hosted on GitHub Pages on GitHub's github.io
domain.