-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: initial work to separate task processor from main repository #1
Changes from all commits
0eef3fb
8932e74
e36e79c
aa6f02e
e1546ea
89082cd
538413a
58610fa
9b8f17e
7d469ae
93b141e
fc82670
52fb316
b422789
1016207
5de1083
1fd3176
20e2723
1152d0b
cf373be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add |
||
|
||
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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?" | ||
) | ||
Comment on lines
+7
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering why this is necessary here but not in the main flagsmith repo manage.py. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question. I think the reason stems from the fact that I actually pulled it from flagsmith-ldap instead. The reason it's different there (I think) is that flagsmith/flagsmith repo was created with django 2.x (because old) whereas flagsmith-ldap was created with django 3.x. I guess the actionable change here would be to update manage.py in the flagsmith/flagsmith repository rather than change anything here. A quick test shows my assumption is correct:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. Maybe make a ticket so we don't forget to update the other one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just made the PR instead :) |
||
execute_from_command_line(sys.argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to bump Postgres version