Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Workflow #68

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .env_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SECRET_KEY=
APP_HASH=
DEBUG=false
DATABASE_URL=postgres://postgres:postgres@localhost:5432/connect
CELERY_BROKER_URL=redis://localhost:6379/0
REDIS_URL=redis://localhost:6379/0
DJANGO_ALLOWED_HOSTS=
CSRF_TRUSTED_ORIGINS=

TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_MESSAGING_SERVICE=

FCM_PROJECT_ID=
FCM_PRIVATE_KEY_ID=
FCM_CLIENT_EMAIL=
FCM_CLIENT_ID=
FCM_CLIENT_X509_CERT_URL=
FCM_PRIVATE_KEY=

OIDC_RSA_PRIVATE_KEY=

SENTRY_DSN=
SENTRY_ENVIRONMENT=
SENTRY_TRACES_SAMPLE_RATE=
63 changes: 63 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI

# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1

on:
pull_request:
branches: ['main']

push:
branches: ['main']

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Run pre-commit
uses: pre-commit/[email protected]

pytest:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
hemant10yadav marked this conversation as resolved.
Show resolved Hide resolved

env:
DATABASE_URL: 'postgres://postgres:postgres@localhost:5432/postgres'

steps:
- name: Checkout Code Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pip
cache-dependency-path: requirements-dev.txt

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Test with pytest
run: pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
/.idea
/.direnv
/.envrc
*.env
!*.env_example
58 changes: 58 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
exclude: '^docs/|/migrations/'
default_stages: [pre-commit]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: detect-private-key

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier
args: ['--tab-width', '2', '--single-quote']
exclude: 'templates/'

- repo: https://github.com/adamchainz/django-upgrade
rev: '1.13.0'
hooks:
- id: django-upgrade
args: ['--target-version', '4.1']

- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args: [--py311-plus]

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8

# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
autoupdate_schedule: weekly
skip: []
submodules: false
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Connect-ID


## Steps to Set Up the Project Locally:

1. **Create and activate a Python virtual environment using Python 3.11:**

```bash
python3.11 -m venv <virtual-env-path>
source <virtual-env-path>/bin/activate # On Windows, use <virtual-env-path>\Scripts\activate
```

2. **Install the required dependencies:**

```bash
pip install -r requirements-dev.txt
```

3. **Install Git hooks:**

```bash
pre-commit install
pre-commit run -a
```

4. **Create an environment file and edit the settings as needed:**

```bash
cp .env_template .env
```

5. **Set the following environment variables in the `.env` file:**

```env
DATABASE_URL=
DEBUG=True
SECRET_KEY=None # set None to use default secret key provided in settings.py
APP_HASH=None # set None to use default APP_HASH provided in settings.py
```

6. **Run Django migrations and start the development server:**

```bash
./manage.py migrate
./manage.py runserver

30 changes: 0 additions & 30 deletions connectid/localsettings.example.py

This file was deleted.

Loading
Loading