Run the below 2 codes right after clone this repo from your terminal.
pip install -r common.txt
pre-commit install
The steps ensure to work pre commit hooks before you push the code to the repo. By running "pre-commit install", it executes .pre-commit-config.yaml file, then, the yaml file sets up the git hook scripts. After the command, 'pre-commit' runs automatically on "git commit"
The picture is actually running for this repo. So, the file checks 7 points (6 ids under the hooks and black) Once, you change code on this repo and commit the changes through- git commit -m 'First Commit' on terminal
- Click the "Commit" panel (the left side on Pycharm)
Either way, it runs automatically like the below figure.
More information about
pre-commit: https://pre-commit.com/
black: https://github.com/psf/black
*additional material for code convention:
Docstring: https://peps.python.org/pep-0257/
Type Hints: https://peps.python.org/pep-0484/
Unit Test: https://docs.python.org/3/library/unittest.html and start with test_
Before downloading, Jenkins should check your PC system.
If you don't have JAVA, you need to download JAVA and Git Bah.
Then you check [System properties -> Environment Variables -> path], System variables has JAVA-HOME and right Path condition.
- Download Jenkins
- Run the below code from your terminal (Pycharm) where Jenkins is located. User\Desktop(Jenkins folder location)
java -jar jenkins.war
- Open browser, Type below port number for Jenkins
localhost:8080
When using Jenkins, do steps 1 and 2 every time.
When you open the dashboard, click New Item
Look at the picture above
- An item name = your project name
- Click Pipeline
Next step is What do you want to build.
Please follow the picture below
What do you want to run
- Set * * * * * (every minute) run
"Make Pipeline script and explanation of the syntax"
- Click try sample "Pipeline"
- stage is title
- echo is comment
Click "Build Now" you got the picture below
If the build is red, it's a failure.
You should check the "#number" -> "console output".
Then fix your code update and run it again.
Next step, click the "Pipeline Syntax"
- Checkout: Check out from version control
- SCM -> Git
- Repositories -> Git clone URL
- Credentials -> private access ID & password
- Save it, get script
- bat -> for windows command (This time, build docker)
This time, created three builds.
- First is "check it" for connect Git success.
- Second is "build" for create Git clone.
- Third is "unit test" for run unit test command.
More information about
CI/CD :https://www.simplilearn.com/tutorials/devops-tutorial/continuous-delivery-and-continuous-deployment
Docker is a tool for running your applications inside containers and similar in concept to virtual machines (can be run on any OS).
Containers are great for continuous integration and continuous delivery (CI/CD) workflows.
- Download and install Docker
You should create Dockerfile on your Pycharm.
Docker file name MUST be 'Dockerfile'.
- Dockerfile works top to bottom
- Dockerfile reserved word are the picture below
Created Dockerfile is the picture below
- Name and optionally a tag in the name:tag format (latest = NEW)
docker build -t test:latest .
docker images
An image is a read-only template with instructions for creating a Docker container.
When you push your code to the master branch on GitHub, GitHub will call Jenkins, and Jenkins runs Docker for unit testing through the above settings.
More information about
Docker: https://docs.docker.com/get-started/overview/