Skip to content

Commit

Permalink
feat: initial work to separate task processor from main repository (#1)
Browse files Browse the repository at this point in the history
* Initial work to separate task processor from main repository

* Fix workflow

* Add pointless __init__ file

* Remove pointless __init__ file

* Loosen Django dependency

* Update readme wording and example

* typing.Optional -> `|`

* Add comment to seemingly unused import.

* Add TODO

* Remove unnecessary typing import

* Add typing to managers module

* Formatting

* Refactor helpers

* Add __init__.py

* Explicitly include sql files

* More pyproject changes

* re-add __init__ and change pyproject include

* change include definition

* Add build-system

* Add return types to manager methods
  • Loading branch information
matthewelwell authored Feb 12, 2024
1 parent 9f88feb commit f9c181a
Show file tree
Hide file tree
Showing 60 changed files with 3,950 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
max-line-length = 120
max-complexity = 10
exclude = .git,.venv,.direnv,__pycache__,*/migrations/*

per-file-ignores =
# Need the * prefix to work with pre-commit which runs from the root of the repo
*app/settings/local.py: F403, F405
*app/settings/production.py: F403, F405
*app/settings/saas.py: F403, F405
58 changes: 58 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Unit tests, linting & formatting

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
name: Flagsmith Workflows Unit Tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/flagsmith_task_processor
DJANGO_SETTINGS_MODULE: tests.settings

services:
postgres:
image: postgres:11.12-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
max-parallel: 4
matrix:
python-version: ['3.10', '3.11']

steps:
- name: Cloning repo
uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install

- name: Run Linters
run: |
poetry run black --check .
poetry run isort --check-only --diff .
poetry run flake8
- name: Check for missing migrations
run: poetry run python manage.py makemigrations --no-input --dry-run --check

- name: Run Tests
run: poetry run pytest tests/unit
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/flagsmith-task-processor.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
execute_from_command_line(sys.argv)
Loading

0 comments on commit f9c181a

Please sign in to comment.