Skip to content

Commit

Permalink
Merge pull request #138 from SADiLaR/chore/misc-dx-fixes
Browse files Browse the repository at this point in the history
Assorted dev experience & CI fixes
  • Loading branch information
Restioson authored Nov 5, 2024
2 parents ada8c44 + e07ccb8 commit 61c3f07
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 .

Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
3 changes: 1 addition & 2 deletions app/general/tests/test_frontend.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 61c3f07

Please sign in to comment.