This repository contains a simple Python application that demonstrates a basic CI/CD pipeline using GitHub Actions. The project includes basic mathematical operations, unit tests for these operations, and a workflow that automates the testing process.
This project is set up to showcase a straightforward Python application with an integrated continuous integration (CI) workflow. When code is pushed to the master
branch or a pull request is created against master
, the GitHub Actions workflow is automatically triggered.
The core of this project is a simple Python module that performs two basic mathematical operations:
- Addition
- Subtraction
- Basic Python Application: Includes a
src
directory with the main application logic. The application currently supports addition and subtraction. - Unit Tests: The
tests
directory contains unit tests written using thepytest
framework to ensure the reliability of the mathematical operations. - Automated CI Pipeline: A GitHub Actions workflow (
.github/workflows/python-app.yml
) is configured to automatically:- Check out the code from the repository.
- Set up a Python 3.10 environment.
- Install the required dependencies from the
requirements.txt
file. - Run the
pytest
suite to validate the code.
- Dependency Management: Project dependencies are managed in the
requirements.txt
file, which includespandas
andpytest
.
- Python 3.10 or later
pip
for installing packages
- Clone the repository:
git clone https://github.com/rohan-thoma/testing_github_actions.git cd testing_github_actions
- Install the dependencies:
pip install -r requirements.txt
To run the tests locally, navigate to the root directory of the project and execute the following command:
pytest
The tests will verify the correctness of the add
and sub
functions in the src.math_operations
module.
This project uses GitHub Actions for its CI pipeline. The workflow is defined in the .github/workflows/python-app.yml
file and is triggered on every push
and pull_request
to the master
branch.
The CI pipeline performs the following steps:
- Checkout Code: The first step checks out the repository's code.
- Set up Python: It sets up the Python 3.10 environment.
- Install Dependencies: It installs all the necessary dependencies from the
requirements.txt
file. - Run Tests: Finally, it runs the test suite using
pytest
to ensure that the changes have not introduced any regressions.