This is a project for Python for Web API Development to demonstrate a CI/CD pipeline for a simple FastAPI calculator application. It includes:
- A FastAPI application with basic arithmetic operations.
- Logging for all endpoints.
- Unit, Integration, and End-to-End (Playwright) tests.
- A GitHub Actions workflow to automate testing.
- A Docker Compose setup to run the app with PostgreSQL and pgAdmin.
This is the easiest way to run the full application stack, including the database.
- Make sure you have Docker Desktop running.
- Clone this repository.
- From the project's root directory, run:
docker-compose up --build
- The application will be running at
http://127.0.0.1:8000. - pgAdmin (database manager) will be available at
http://127.0.0.1:5050.
This method runs the app directly on your machine using a Python virtual environment.
- Clone the repository:
git clone <YOUR_REPO_URL_HERE> cd fastapi-calculator-ci
- Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate - Install dependencies:
pip install -r requirements.txt playwright install
- Run the application:
uvicorn app.main:app --reload
- The application will be running at
http://127.0.0.1:8000.
These tests do not require the application to be running.
pytest tests/test_unit.py tests/test_integration.py