This project can be used as base template to easily start writing your app with the support of a basic CI pipeline that includes testing, linting and code coverage.
Pipeline can be run in you development environment or directly in GitHub.
Is currently supported:
- Formatting using black
- Isort sorts your imports.
- Linting checks using flake8
- Testing using pytest
- Executing the target app in a container using Docker
- GitHub Actions integration for CI/CD executions
- Project can be used as GitHub Template
Edit/Update the Pipfile
to the desired Python/Package version, then:
make run_docker_bash
cd /app
make upgrade_pipenv
Run make run_docker_image
in the command line. This command will build the CI image running all tests and finally build the release target image and run it.
Makefile contains all the targets to run the code in a containerized environment (Docker) and natively.
The run_docker_bash
make target can be used for development/testing without having to install the Python dependencies in the host machine. Everything can be run in a python:3.12
Docker image.
The following commands show how to run the image and format the python code:
make run_docker_bash
cd /app
make dev_dependencies
make activate_pipenv
make format
make ci
src
contains the source code of the target app. Useapp.py
as main() file.tests
include the pytest files used to test the appMakefile
implements all the Features currently supportedDockerfile
Docker image used for releasing the target app
Create the docker group and add your user to the docker group:
sudo groupadd docker
sudo usermod -aG docker $USER
First, build your image, e.g.: docker build -t myapp .
.
If your cloud uses a different CPU architecture than your development
machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
you'll want to build the image for that platform, e.g.:
docker build --platform=linux/amd64 -t myapp .
.