diff --git a/.devcontainer/complete-creation.sh b/.devcontainer/complete-creation.sh index 604abfdc..4e5754e8 100755 --- a/.devcontainer/complete-creation.sh +++ b/.devcontainer/complete-creation.sh @@ -8,8 +8,8 @@ set -o nounset # For VSCode extension used to edit sphinx projects. pip install esbonio -python manage.py createcachetable -python manage.py migrate +uv run python manage.py createcachetable +uv run python manage.py migrate npm install @@ -21,7 +21,7 @@ function setup-pre-commit() { sleep 30 done - pre-commit install --hook-type pre-commit --hook-type pre-push + uv run pre-commit install --hook-type pre-commit --hook-type pre-push } # Run in the backend to allow VSCode to configure git. diff --git a/.dockerignore b/.dockerignore index 2e803df3..b4747329 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,7 +8,8 @@ .pre-commit-config.yaml .readthedocs.yml .travis.yml -venv +venv/ +.venv/ .git/ devops/envs/ .pytest_cache/ diff --git a/.envrc b/.envrc index 00f76c52..7b62a58e 100644 --- a/.envrc +++ b/.envrc @@ -1,4 +1,5 @@ dotenv devops/envs/local/django dotenv devops/envs/local/pycharm -layout poetry +uv sync +source .venv/bin/activate diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1972bbbf..cbd45d08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,49 +19,66 @@ concurrency: cancel-in-progress: true jobs: - linter: + lint-and-test: runs-on: ubuntu-latest + services: + # Label used to access the service container + postgres: + # Docker Hub image + image: postgres + # Provide the password for postgres + env: + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + POSTGRES_DB: legadilo + POSTGRES_USER: django + POSTGRES_PASSWORD: django_passwd + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + env: + IS_PRODUCTION: "false" + PYTHONUNBUFFERED: "1" + PYTHONDEVMODE: "1" + USE_DOCKER: "no" + DATABASE_URL: "postgres://django:django_passwd@localhost:5432/legadilo" + steps: - name: Checkout Code Repository uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v4 with: - python-version: "3.12" + # Install a specific version of uv. + version: "0.5.8" - - name: Install poetry - run: pip install poetry==1.8.2 + - name: "Set up Python" + uses: actions/setup-python@v5 + with: + python-version-file: "pyproject.toml" - - name: Install typing deps - run: poetry install --with typing + - name: Install the project + run: uv sync --dev --locked - # Consider using pre-commit.ci for open source project - name: Run pre-commit - uses: pre-commit/action@v3.0.1 - - # With no caching at all the entire ci process takes 4m 30s to complete! - pytest: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code Repository - uses: actions/checkout@v4 - - - name: Build the Stack - run: docker compose -f local.yml build + run: uv run pre-commit run -a - name: Create cache table - run: docker compose -f local.yml run --rm django python manage.py createcachetable + run: uv run python manage.py createcachetable - name: Run DB Migrations - run: docker compose -f local.yml run --rm django python manage.py migrate + run: uv run python manage.py migrate - name: Run Django Tests - run: docker compose -f local.yml run --rm django pytest --cov --cov-report term:skip-covered --cov-fail-under=90 - - - name: Tear down the Stack - run: docker compose -f local.yml down + run: uv run pytest --cov --cov-report term:skip-covered --cov-fail-under=90 - name: Test build production images run: | diff --git a/.idea/misc.xml b/.idea/misc.xml index 37f6827c..facfce77 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,8 +6,8 @@ - + - + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_full_test_suite.xml b/.idea/runConfigurations/Run_full_test_suite.xml index a016849b..9615f68a 100644 --- a/.idea/runConfigurations/Run_full_test_suite.xml +++ b/.idea/runConfigurations/Run_full_test_suite.xml @@ -13,10 +13,9 @@ -