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
36 changes: 36 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
cooldown:
default-days: 7
commit-message:
prefix: "deps"

- package-ecosystem: "pip"
directory: "/.github/workflow-test-fixtures/django-api"
schedule:
interval: "weekly"
groups:
workflow-test-fixtures:
applies-to: security-updates
patterns:
- "*"
open-pull-requests-limit: 0

- package-ecosystem: "uv"
directory: "/.github/workflow-test-fixtures/django-api-uv"
schedule:
interval: "weekly"
groups:
workflow-test-fixtures:
applies-to: security-updates
patterns:
- "*"
open-pull-requests-limit: 0
6 changes: 6 additions & 0 deletions .github/workflow-test-fixtures/commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// No rules enforced — any commit message is accepted.
// This config exists so that workflows using wagoid/commitlint-github-action
// do not fail with "no config found" when called from this repository.
export default {
rules: {},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repos: []
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

48 changes: 48 additions & 0 deletions .github/workflow-test-fixtures/django-api-uv/config/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import os
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = os.environ.get("SECRET_KEY", "compat-secret")
DEBUG = True
ALLOWED_HOSTS: list[str] = ["*"]

INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"dummy",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
]

ROOT_URLCONF = "config.urls"
TEMPLATES: list[dict[str, object]] = []
Comment thread
tuomas777 marked this conversation as resolved.
WSGI_APPLICATION = "config.wsgi.application"

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": os.environ.get("POSTGRES_DB", "test_db"),
"USER": os.environ.get("POSTGRES_USER", "test_user"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD", "test_password"),
"HOST": os.environ.get("POSTGRES_HOST", "localhost"),
"PORT": os.environ.get("POSTGRES_PORT", "5432"),
}
}

LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = True
STATIC_URL = "static/"
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
10 changes: 10 additions & 0 deletions .github/workflow-test-fixtures/django-api-uv/config/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.http import HttpResponse
from django.urls import path


def healthz(_request):
return HttpResponse("ok")

urlpatterns = [
path("healthz/", healthz),
]
7 changes: 7 additions & 0 deletions .github/workflow-test-fixtures/django-api-uv/config/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.db import migrations, models


class Migration(migrations.Migration):
initial = True
dependencies: list = []
operations = [
migrations.CreateModel(
name="DummyModel",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("name", models.CharField(max_length=100)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.db import models


class DummyModel(models.Model):
name = models.CharField(max_length=100)

class Meta:
app_label = "dummy"
14 changes: 14 additions & 0 deletions .github/workflow-test-fixtures/django-api-uv/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python
import os
import sys


def main() -> None:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)


if __name__ == "__main__":
main()
15 changes: 15 additions & 0 deletions .github/workflow-test-fixtures/django-api-uv/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
name = "workflow-fixture-django-api-uv"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"django>=5.2,<6",
"psycopg2-binary>=2.9",
]

[dependency-groups]
dev = [
"pytest>=8.4",
"pytest-cov>=6.1",
"pytest-django>=4.11",
]
2 changes: 2 additions & 0 deletions .github/workflow-test-fixtures/django-api-uv/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
DJANGO_SETTINGS_MODULE = config.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest
from dummy.models import DummyModel


@pytest.mark.django_db
def test_db_connection():
DummyModel.objects.create(name="test")
assert DummyModel.objects.count() == 1
285 changes: 285 additions & 0 deletions .github/workflow-test-fixtures/django-api-uv/uv.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repos: []
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

48 changes: 48 additions & 0 deletions .github/workflow-test-fixtures/django-api/config/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import os
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = os.environ.get("SECRET_KEY", "compat-secret")
DEBUG = True
ALLOWED_HOSTS: list[str] = ["*"]

INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"dummy",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
]

ROOT_URLCONF = "config.urls"
TEMPLATES: list[dict[str, object]] = []
WSGI_APPLICATION = "config.wsgi.application"

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": os.environ.get("POSTGRES_DB", "test_db"),
"USER": os.environ.get("POSTGRES_USER", "test_user"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD", "test_password"),
"HOST": os.environ.get("POSTGRES_HOST", "localhost"),
"PORT": os.environ.get("POSTGRES_PORT", "5432"),
}
}

LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = True
STATIC_URL = "static/"
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
10 changes: 10 additions & 0 deletions .github/workflow-test-fixtures/django-api/config/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.http import HttpResponse
from django.urls import path


def healthz(_request):
return HttpResponse("ok")

urlpatterns = [
path("healthz/", healthz),
]
7 changes: 7 additions & 0 deletions .github/workflow-test-fixtures/django-api/config/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.db import migrations, models


class Migration(migrations.Migration):
initial = True
dependencies: list = []
operations = [
migrations.CreateModel(
name="DummyModel",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("name", models.CharField(max_length=100)),
],
),
]
Empty file.
8 changes: 8 additions & 0 deletions .github/workflow-test-fixtures/django-api/dummy/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.db import models


class DummyModel(models.Model):
name = models.CharField(max_length=100)

class Meta:
app_label = "dummy"
14 changes: 14 additions & 0 deletions .github/workflow-test-fixtures/django-api/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python
import os
import sys


def main() -> None:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)


if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions .github/workflow-test-fixtures/django-api/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
DJANGO_SETTINGS_MODULE = config.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pytest
pytest-cov
pytest-django
2 changes: 2 additions & 0 deletions .github/workflow-test-fixtures/django-api/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Django>=5.2,<6
psycopg2-binary>=2.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest
from dummy.models import DummyModel


@pytest.mark.django_db
def test_db_connection():
DummyModel.objects.create(name="test")
assert DummyModel.objects.count() == 1
11 changes: 11 additions & 0 deletions .github/workflow-test-fixtures/node-pnpm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "workflow-compat-node-pnpm",
"private": true,
"version": "1.0.0",
"packageManager": "pnpm@11.5.3",
"scripts": {
"lint": "echo lint-ok",
"build": "mkdir -p dist && echo \"console.log('ok')\" > dist/index.js",
"test:coverage": "mkdir -p coverage && echo '{}' > coverage/coverage-final.json"
}
}
8 changes: 8 additions & 0 deletions .github/workflow-test-fixtures/node-pnpm/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .github/workflow-test-fixtures/node-yarn/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "workflow-compat-node-yarn",
"private": true,
"version": "1.0.0",
"scripts": {
"lint": "echo lint-ok",
"build": "mkdir -p dist && echo \"console.log('ok')\" > dist/index.js",
"test:coverage": "mkdir -p coverage && echo '{}' > coverage/coverage-final.json"
}
}
2 changes: 2 additions & 0 deletions .github/workflow-test-fixtures/node-yarn/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
2 changes: 1 addition & 1 deletion .github/workflows/build-python-dists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Build the distributions
run: ${{ inputs.build-command }}
- name: Store the distributions
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.artifact-path }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-django-api-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ To use this reusable workflow, create a project-specific workflow file in your `
- **`use-postgis`** (boolean): Set to `true` to enable the PostGIS extension. Default is `false`.
- **`extra-commands`** (string): Additional setup commands or checks to execute before running tests. Can be used to set environment variables: `echo "EXTRA_TEST_ENV_VAR=test" >> $GITHUB_ENV`.
- **`working-directory`** (string): Repository subdirectory where to run tests. Default is repository root.
- **`skip-sonar`** (boolean): Set to `true` to skip the SonarQube Cloud scan. Default is `false`.
- **`commitlint-config-file`** (string): Path to the commitlint config file. If not set, commitlint uses its default config discovery.
- **`pre-commit-config-file`** (string): Path to `.pre-commit-config.yaml`. If empty, pre-commit uses its default discovery (file in repository root).

### 🔑 Secrets

Expand Down
Loading
Loading