Skip to content

Commit 29b2f8f

Browse files
committed
Updates Readme
1 parent 08985da commit 29b2f8f

File tree

1 file changed

+31
-41
lines changed

1 file changed

+31
-41
lines changed

README.md

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,74 +3,64 @@
33
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
44
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/edumco/python-pipeline-example)
55

6-
Simple example of a pipeline on Docker to test your python code.
6+
Simple Docker pipeline to test your python code.
77

8-
## Pipeline on a container
8+
## About
99

1010
Although several pipeline solutions exist, they are too complex for small projects. With this solution you just need a Dockerfile.
1111

12-
### Implementation
12+
## Features
1313

1414
In this repo i've add a very basic python project with only four elements: a requirements file, a Dockerfile, a pytest.ini file and a simple python test that always pass.
1515

16-
#### Requirements file 📃
17-
18-
The requirements file lists all the project dependencies. This allows the pip (Python package manager) to download the correct versions of wich dependency. [See the dependencies tutorial to more details.](pipeline/dependencies.md)
19-
20-
#### Sample test ✅
21-
22-
Our project does not have a software but we need at least a single test to prove that our test library is working, so we add a simple function with the name test-pass.py.
23-
24-
When the PyTest framework execute it will find the test by the name test\*.py
25-
26-
#### Pytest configuration 💻
27-
28-
The PyTest configuration is used to define the root folder for the tests and to add options to PyTest. In this example it is used to disable a warning message when used with JUnit.
29-
30-
#### Dockerfile 🐳
31-
32-
The Dockerfile uses the multistage build feature to create the pipeline. Each stage can be executed by a diferent image and only the output artifacts will be reused.
33-
34-
## The pipeline stages
35-
3616
You can put several stages to your pipeline, but the most common stages are:
3717

3818
| 1 | 2 | 3 | 4 | 5 | 6 |
3919
| ----- | ---- | ---- | -------- | ------ | --- |
4020
| Build | Test | Lint | Analisys | Report | Tag |
4121

42-
### Build
22+
## The pipeline stages
23+
24+
[Build](pipeline/dependencies.md): Downloads and build dependencies.
25+
26+
[Test](pipeline/tests.md): Executes all tests found.
27+
28+
[Lint](pipeline/lint.md): Checks code style and format.
29+
30+
[Analisys](pipeline/static-analisys.md): Checks for bad code practicies.
4331

44-
Python does not have a build stage but has a pre-execution stage of build the dependency tree by download packages and resolving sub dependencies.
32+
[Report](pipeline/reports.md): Exports the results to archiving.
4533

46-
[Access the "Building the Dependency Tree" tutorial](pipeline/dependencies.md)
34+
[Tag](pipeline/tagging.md): Adds a unique identifier to the version.
4735

48-
### Test
36+
## Installation
4937

50-
After gather all the packages now we can test our application. The most common type of tests is the unit test but to achieve a good code quality we should add other types of test as well.
38+
1. Clone or download this repository.
5139

52-
[Access the "Testing with PyTest" tutorial](pipeline/tests.md)
40+
2. Move your code to this new structure or vice versa.
5341

54-
### Lint
42+
3. Make sure the `Dockerfile` is on project root folder.
5543

56-
When the tests are passing is time to check the code checking if guidelines for the code style are being followed. A consistent code style helps with readability and mantainece.
44+
4. Update the requiments with your dependencies or create your list of requirements. [See the dependencies tutorial to more details.](pipeline/dependencies.md)
5745

58-
- [Access the Lint tutorial](pipeline/lint.md)
46+
5. Make sure the name patterns on `pytest.ini`
5947

60-
### Analisys
48+
6. Make sure you have at least one passing test (there's one in test-pass.py)
6149

62-
With a consistent code base its easier to find code patterns that could lead to errors or make your code prone to atacks. Another advantage is the complexity management.
50+
7. In `Dockerfile` rename the `src` folder following your project organizaziton.
6351

64-
- [Access the Static Analisys tutorial](pipeline/static-analisys.md)
52+
## Usage
6553

66-
### Report
54+
Execute the docker build command
6755

68-
With all quality checks done it is necessary to comunicate the results. Its possible to send a message to external tools notifying the complete result.
56+
```bash
57+
docker build -t your-docker-user/projetc-name:tag .
58+
```
6959

70-
- [Access the Report tutorial](pipeline/reports.md)
60+
If every step works correctly the command `docker images` is going to list your newly created image.
7161

72-
### Tag
62+
If something goes wrong youll be promptly warned.
7363

74-
Now that all the steps complete we can define that this build is production ready and should receive a tag with its version number using some of the common tag practicies used world-wide.
64+
## License
7565

76-
- [Access the Tag tutorial](pipeline/tagging.md)
66+
[GNU General Public License v3.0](LICENSE)

0 commit comments

Comments
 (0)