Thank you for considering contributing to the Risk Analysis Syatem! This document outlines the development and deployment process, including setup instructions, CI/CD configurations, and branching strategy.
- Getting Started
- Development Workflow
- CI/CD Pipeline
- Deployment Instructions
- Reporting Issues
- Submitting Pull Requests
Before you begin, ensure you have the following installed:
- Python 3.x: Required for running the application.
- pip: Python package manager.
- git: Version control system.
- Heroku CLI (if deploying to Heroku).
- AWS CLI (if deploying to AWS Elastic Beanstalk).
-
Clone the repository:
git clone https://github.com/MALVMAS/RAS.git cd MALVMAS -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
Create a
.envfile in the root of your project and add the necessary environment variables:DEBUG=True SECRET_KEY=your-secret-key DATABASE_URL=your-database-url -
Run the development server:
python manage.py runserver
We follow the GitFlow branching model:
- main: The main branch contains the production-ready code.
- develop: The development branch is where the latest development happens.
- feature/*: Feature branches are created from
developfor new features. - hotfix/*: Hotfix branches are created from
mainto address critical issues.
We use autopep8 and pycodestyle to enforce code style:
-
Run the linter:
pycodestyle your_module/
-
Auto-format code:
autopep8 --in-place --aggressive --aggressive your_module/
We use pytest for testing:
-
Run all tests:
pytest
We use GitHub Actions for continuous integration:
- The CI pipeline runs automatically on every push to the
mainanddevelopbranches. - It installs dependencies, runs tests, and checks code quality.
Example CI configuration (.github/workflows/ci.yml):
name: CI Pipeline
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt- name: Run tests
run: pytest
We use Heroku or AWS Elastic Beanstalk for automatic deployments:
The deployment pipeline triggers after a successful build on the main branch.
Deployment to Heroku is configured in the CI pipeline:
deploy: runs-on: ubuntu-latest needs: test steps:
- uses: actions/checkout@v2
- name: Deploy to Heroku env: HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} run: | git remote add heroku https://git.heroku.com/.git git push heroku main
- Install Heroku CLI: curl https://cli-assets.heroku.com/install.sh | sh
- Login to Heroku: heroku login
- Deploy manually (if needed): git push heroku main
- Install AWS CLI: pip install awscli
- Configure AWS CLI: aws configure
- Deploy manually (if needed): eb deploy
If you encounter any issues or bugs, please open an issue in the GitHub repository. Provide as much detail as possible, including steps to reproduce the issue.
- Fork the repository.
- Create a new branch: git checkout -b feature/your-feature-name.
- Commit your changes: git commit -m 'Add some feature'.
- Push to the branch: git push origin feature/your-feature-name.
- Open a pull request in the GitHub repository.
Please ensure your pull request adheres to the following guidelines:
- Include tests that cover your changes.
- Follow the code style guidelines.
- Ensure that all tests pass before submitting.
Thank you for contributing to the Risk Analysis System Project!