Skip to content

Latest commit

 

History

History
143 lines (92 loc) · 3.64 KB

CONTRIBUTING.md

File metadata and controls

143 lines (92 loc) · 3.64 KB

Contributing Guidelines

Welcome! We're excited that you're interested in contributing to this project. Below are guidelines to help you get started.

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. Please note we have a code of conduct, please follow it in all your interactions with the project.

Table of Contents

  1. Getting Started
  2. Testing Locally
  3. Running Tests
  4. Code Coverage
  5. Continuous Integration
  6. Submitting Changes

Getting Started

  1. Fork the repository.
  2. Clone your fork:
git clone https://github.com/your-username/yourIP.git

Testing Locally

Running the app through poetry

To test the application locally:

  1. Install dependencies using Poetry:
poetry install --with dev
  1. Activate the virtual environment:
poetry shell
  1. Run the Flask app:
poetry run flask --app app/main.py --debug run --host 127.0.0.1 --port 8080
  1. Visit http://127.0.0.1:8080 in your browser.

Using docker-compose.debug.yml

To run the application in development mode with debugging:

Building the Docker Image

To build the Docker image and tag it as yourip:

  1. Ensure you are in the root directory of the repository where the Dockerfile is located.
  2. Build the Docker image:
docker build -t yourip:latest .

This command builds the Docker image using the Dockerfile in the current directory and tags it as yourip:latest.

Run the Docker Compose command:

docker compose -f docker-compose.yml -f docker-compose.debug.yml up -d

This command uses both docker-compose.yml and docker-compose.debug.yml to start the container in detached mode with development settings.

Running Tests

We use pytest for testing. To run tests:

  1. Ensure you're in the virtual environment:
poetry shell
  1. Run the tests:
pytest

Code Coverage

We use coverage.py to measure code coverage. To generate a coverage report:

  1. Run the tests with coverage:
coverage run -m pytest
  1. Generate a coverage report:
coverage report
  1. Generate an HTML coverage report:
coverage html
  1. Open htmlcov/index.html in your browser to view the detailed coverage report.

Continuous Integration

We've set up GitHub Actions for Continuous Integration (CI) to automatically run tests and generate coverage reports on every commit. The configuration is located in .github/workflows/python-app.yml.

To set up GitHub Actions

  1. Push your changes to your fork.
  2. Create a pull request to the main repository.
  3. The CI will automatically run and display results on the pull request page.

Submitting Changes

  1. Ensure all tests pass.
  2. Ensure code coverage is adequate.
  3. Create a pull request with a clear description of your changes.

How to submit a Pull Request

  1. Search our repository for open or closed Pull Requests that relate to your submission. You don't want to duplicate effort.
  2. Fork the project
  3. Create your feature branch (git checkout -b feat/amazing_feature)
  4. Commit your changes (git commit -m 'feat: add amazing_feature') yourIP uses conventional commits, so please follow the specification in your commit messages.
  5. Push to the branch (git push origin feat/amazing_feature)
  6. Open a Pull Request

Thank you for contributing! Your help is much appreciated. If you have any questions, feel free to open an issue.