-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Unit tests, linting & formatting | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Flagsmith Workflows Unit Tests | ||
|
||
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 |
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?" | ||
) | ||
execute_from_command_line(sys.argv) |