diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 62347b9..2c297fc 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to SADiLaR Container Registry diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index c8383e1..59c5d72 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to SADiLaR Container Registry diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 79106b6..9590f0b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -23,6 +23,8 @@ jobs: options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-python@v5 with: python-version: 3.12 @@ -34,7 +36,8 @@ jobs: - name: Run linting tools run: | cd app/ - ruff format . + ruff format --diff . + ruff check --diff . - name: Create logging folder run: | sudo mkdir -p /logging @@ -79,6 +82,8 @@ jobs: options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-python@v5 with: python-version: 3.12 @@ -125,6 +130,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + persist-credentials: false - name: Get all commits on current main run: git fetch origin main - name: Log all commits we will analyse diff --git a/Makefile b/Makefile index 9e73fd8..b4aa8e6 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ +.PHONY: list up upd build stop down restart make-migrations migrate collectstatic shell logs create-super-user \ + docker-stop-all create-schema test ruff-check ruff-fix ruff-format load-fixtures pre-commit-install \ + dev-import-documents dev-quick-install lighthouse dev_update_vector_search docker-shell check make-messages \ + compile-messages fmt lint + list: @echo "Available commands:" @echo "up - Start the project" @@ -70,14 +75,18 @@ create-schema: @docker compose run --rm web python manage.py graph_models -a -o schema/schema.png test: - @docker compose run --rm web python manage.py test + @docker compose run --rm web python manage.py test $(module) ruff-check: @docker compose run --rm web ruff check . +lint: ruff-check + ruff-format: @docker compose run --rm web ruff format . +fmt: ruff-format + ruff-fix: @docker compose run --rm web ruff check --fix . diff --git a/README.md b/README.md index 8c3971a..959006d 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,17 @@ Docker Volumes for production: .env file * EMAIL_BACKEND_CONSOLE=False + +## Notes to Developers + +- When setting up the app (from scratch or from a wipe), the following commands should be run: + - (Optional) `make build` + - `make up` - wait for the database to start, then hit Control-C + - `make migrate` + - `make up` - runs the app +- To wipe the database, use `make down` +- The Django admin interface is at `/admin/` + - An admin user can be created through `make create-super-user` +- To run a single module of tests, you can pass the Makefile `module` variable on the command line. For instance, to run + only tests defined in [`test_document_admin.py`](./app/general/tests/test_document_admin.py), run + `make test module=general.tests.test_document_admin` \ No newline at end of file diff --git a/app/general/tests/test_frontend.py b/app/general/tests/test_frontend.py index e7df8d0..97779cd 100644 --- a/app/general/tests/test_frontend.py +++ b/app/general/tests/test_frontend.py @@ -1,10 +1,9 @@ from django.contrib.staticfiles.testing import StaticLiveServerTestCase from selenium.common import TimeoutException -from selenium.webdriver.chrome.webdriver import WebDriver, Options +from selenium.webdriver.chrome.webdriver import Options, WebDriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait - # Wait timeout in seconds WAIT_TIMEOUT = 5