Skip to content

Commit

Permalink
added ci/cd workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
sidravi1 committed Feb 2, 2025
1 parent 6105596 commit 75ed477
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Reviewer:
Estimate:

---

## Ticket

Fixes: JIRA_TICKET_LINK

## Description

### Goal

### Changes

### Future Tasks (optional)

## How has this been tested?

## To-do before merge (optional)

## Checklist

Fill with `x` for completed.

- [ ] My code follows the style guidelines of this project
- [ ] I have reviewed my own code to ensure good quality
- [ ] I have tested the functionality of my code to ensure it works as intended
- [ ] I have resolved merge conflicts

(Delete any items below that are not relevant)
- [ ] I have updated the automated tests
- [ ] I have updated the scripts in `scripts/`
- [ ] I have updated the requirements
- [ ] I have updated the README file
- [ ] I have updated affected documentation
- [ ] I have added a blogpost in Latest Updates
- [ ] I have updated the CI/CD scripts in `.github/workflows/`
- [ ] I have updated the Terraform code
42 changes: 42 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Python Linting
on:
workflow_dispatch:
push:
branches:
- "**"
paths:
- "**.py"

jobs:
python-lint-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: |
backend/requirements.txt
requirements-dev.txt
- run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt
pip install -r requirements-dev.txt
- name: Run MyPy
run: |
mypy backend/app
- name: Run ruff
run: |
ruff check --exclude "backend/migrations" .
- name: Check code formatting with Black
run: |
cd backend
black --check .
63 changes: 63 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Unit Tests
on:
workflow_dispatch:
push:
branches:
- "**"
paths:
- "**.py"
- ".github/workflows/tests.yaml"
env:
POSTGRES_PASSWORD: postgres-test-pw
POSTGRES_USER: postgres-test-user
POSTGRES_DB: postgres-test-db
REDIS_HOST: redis://redis:6379
jobs:
container-job:
runs-on: ubuntu-20.04
container: node:20.7-bullseye
services:
postgres:
image: postgres:16.4
env:
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:6.0-alpine
options: >-
--health-cmd "redis-cli ping || exit 1"
--health-interval 5s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: install dependencies
run: apt-get update && apt-get install -y lsb-release && apt-get clean all
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Python libraries
run: |
python -m pip install -r backend/requirements.txt
python -m pip install -r requirements-dev.txt
- name: Run Unit Tests
env:
PROMETHEUS_MULTIPROC_DIR: /tmp
REDIS_HOST: ${{ env.REDIS_HOST }}
run: |
cd backend
export POSTGRES_HOST=postgres POSTGRES_USER=$POSTGRES_USER \
POSTGRES_PASSWORD=$POSTGRES_PASSWORD POSTGRES_DB=$POSTGRES_DB \
python -m alembic upgrade head
python -m pytest -m "not slow" tests

0 comments on commit 75ed477

Please sign in to comment.