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

Ajout d'une configuration pour la CI #96

Merged
merged 1 commit into from
Jun 26, 2024
Merged
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
32 changes: 32 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Django application
on: [push]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.1
- name: Install dependencies
run: pip install pip-tools && pip-sync && playwright install
- name: Run ruff
run: ruff check .
- name: Run DjHTML
run: find -name *.html -not -path "./venv/*" | xargs djhtml
- name: Run tests
run: pytest
env:
SECRET_KEY: NOT_A_REAL_SECRET
DATABASE_URL: postgres://postgres:postgres@localhost/github_actions
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[pytest]
DJANGO_SETTINGS_MODULE = seves.settings
python_files = test_*.py
addopts = -nauto
7 changes: 7 additions & 0 deletions sv/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
from sv.models import Etat, FicheDetection


@pytest.fixture
def page(page):
timeout = 2_000
page.set_default_navigation_timeout(timeout)
page.set_default_timeout(timeout)
yield page

@pytest.fixture(scope="module", autouse=True)
def set_django_allow_async_unsafe():
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"
Expand Down