Skip to content
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
17 changes: 2 additions & 15 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
FROM windpioneers/gdal-python:rational-swordtail-gdal-3.10.0-python-3.13-dev

# Bust any pre-existing apt cache
# Solves: https://askubuntu.com/questions/1388000/failed-to-fetch-deb-debian-org-debian-pool-main-l-linux-linux-libc-dev-5-10-70-1
# + Overcome the fact that yarn don't bother putting their keys on the ring (required for installing sshd feature)...
# https://github.com/yarnpkg/yarn/issues/7866#issuecomment-1404052064
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo gpg --dearmour -o "/usr/share/keyrings/yarn-keyring.gpg" & \
echo "deb [signed-by=/usr/share/keyrings/yarn-keyring.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list & \
gpg --refresh-keys & \
apt-get update -y

# Install poetry
USER vscode
ENV POETRY_HOME=/home/vscode/.poetry
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH "$POETRY_HOME/bin:$PATH"
RUN poetry config virtualenvs.create false
# Use system environment for UV instead of .venv (we're already in a devcontainer)
ENV UV_PROJECT_ENVIRONMENT="/usr/local/"

# Install localtunnel
RUN npm install -g localtunnel
9 changes: 6 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@

// Use devcontainer features
"features": {
"ghcr.io/devcontainers/features/terraform:1": {},
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true,
"configureZshAsDefaultShell": true,
Expand All @@ -88,7 +87,11 @@
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": false,
"version": "latest"
}
"version": "24"
},
"ghcr.io/devcontainers-extra/features/terraform-asdf:2": {
"version": "1.5.2"
},
"ghcr.io/dhoeric/features/terraformer:1": {}
}
}
1 change: 0 additions & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ services:
context: ..
dockerfile: .devcontainer/Dockerfile
args:
VARIANT: '3.9'
INSTALL_NODE: 'true'
NODE_VERSION: 'lts/*'

Expand Down
6 changes: 2 additions & 4 deletions .devcontainer/postattach.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/zsh


# Install dependencies to a cache that persists across devcontainer builds
poetry config cache-dir /workspace/.poetry_cache
poetry install
# Sync the project into a new environment, asserting the lockfile is up to date
uv sync --locked

# Auto set up remote when pushing new branches
git config --global --add push.autoSetupRemote 1
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install poetry
uses: snok/install-poetry@v1.4.1

- name: Check pyproject.toml file
run: poetry check
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: 'pyproject.toml'
python-version: 3.13

- name: Get package version
id: get-package-version
run: echo "package_version=$(poetry version -s)" >> $GITHUB_OUTPUT
run: echo "package_version=$(uv version --short)" >> $GITHUB_OUTPUT

- name: Create release
uses: actions/create-release@v1.1.4
Expand All @@ -47,11 +48,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install poetry
uses: snok/install-poetry@v1.4.1
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: 'pyproject.toml'
python-version: 3.13

- name: Build a binary wheel and a source tarball
run: poetry build
run: uv build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
89 changes: 27 additions & 62 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,52 +51,39 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.11'

- name: Install and configure poetry
uses: snok/install-poetry@v1.4.1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Setup virtual environment cache
id: cached-poetry-dependencies
uses: actions/cache@v4.3.0
with:
path: .venv
key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies (if not cached)
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --only dev --no-interaction --no-root

- name: Install root project
run: poetry install --no-interaction
enable-cache: true
cache-dependency-glob: 'pyproject.toml'
python-version: 3.13

- name: Run precommit
run: SKIP=build-docs,check-branch-name poetry run pre-commit run --all-files
run: SKIP=build-docs,check-branch-name uv run pre-commit run --all-files

publish-test:
runs-on: ubuntu-latest
needs:
- lint
- check-ahead-of-main
- check-semantic-version

permissions:
id-token: write
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install poetry
uses: snok/install-poetry@v1.4.1
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: 'pyproject.toml'
python-version: 3.13

- name: Build a binary wheel and a source tarball
run: poetry build
run: uv build

- name: Test package is publishable with PyPI test server
uses: pypa/gh-action-pypi-publish@v1.13.0
Expand All @@ -114,14 +101,10 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
django-version: ['>=4.2,<4.3', '>=5.0,<5.1']
database-engine: ['sqlite', 'postgres']

exclude:
# Exclude Django 5 with Python 3.9
- python-version: '3.9'
django-version: '>=5.0,<5.1'
os: [ubuntu-latest] # [ubuntu-latest, windows-latest, macos-latest] for full coverage but this gets expensive quickly

permissions:
id-token: write
Expand All @@ -143,7 +126,7 @@ jobs:
--health-timeout 5s
--health-retries 5

runs-on: 'ubuntu-latest'
runs-on: ${{ matrix.os }}

env:
DJANGO_SETTINGS_MODULE: tests.server.settings
Expand Down Expand Up @@ -177,43 +160,25 @@ jobs:
# - name: Setup gcloud
# uses: 'google-github-actions/setup-gcloud@v2'

- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: 'pyproject.toml'
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1.4.1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Setup virtual environment cache
id: cached-poetry-dependencies
uses: actions/cache@v4.3.0
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies (if not cached)
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install root project
run: poetry install --no-interaction
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Install django ${{ matrix.django-version }}
run: |
source .venv/bin/activate
pip install "django${{ matrix.django-version }}"
run: uv add "django${{ matrix.django-version }}"

- name: Setup tmate session [DEBUG]
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'}}
uses: mxschmitt/action-tmate@v3.23
uses: mxschmitt/action-tmate@v3

- name: Run tests
run: poetry run pytest --cov=django_gcp --cov-report=xml
run: uv run pytest --cov=django_gcp --cov-report=xml

- name: Upload coverage to Codecov
# This seems redundant inside the test matrix but actually isn't, since different
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ repos:
- '^main$'
- '^([a-z][a-z0-9#]*)(-[a-z0-9#]+)*$'

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.7
hooks:
- id: uv-lock

- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v2.2.1'
hooks:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

django_gcp is Copyright (c) 2022-2023 Octue Ltd
django_gcp is Copyright (c) 2022-2026 Octue Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading
Loading