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
4 changes: 3 additions & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
with:
repository: django/django-asv
path: "."
persist-credentials: false
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
# Pinned to v3.2.0.
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f
with:
miniforge-version: "24.1.2-0"
activate-environment: asv-bench
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/check_commit_messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,32 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
check-commit-prefix:
if: startsWith(github.event.pull_request.base.ref, 'stable/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false

- name: Calculate commit prefix
id: vars
env:
BASE: ${{ github.event.pull_request.base.ref }}
run: |
BASE="${{ github.event.pull_request.base.ref }}"
echo "BASE=$BASE" >> $GITHUB_ENV
VERSION="${BASE#stable/}"
echo "prefix=[$VERSION]" >> $GITHUB_OUTPUT

- name: Check PR title prefix
env:
TITLE: ${{ github.event.pull_request.title }}
PREFIX: ${{ steps.vars.outputs.prefix }}
run: |
PREFIX="${{ steps.vars.outputs.prefix }}"
if [[ "$TITLE" != "$PREFIX"* ]]; then
echo "❌ PR title must start with the required prefix: $PREFIX"
exit 1
Expand All @@ -40,8 +46,9 @@ jobs:
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr

- name: Check commit messages prefix
env:
PREFIX: ${{ steps.vars.outputs.prefix }}
run: |
PREFIX="${{ steps.vars.outputs.prefix }}"
COMMITS=$(git rev-list base..pr)
echo "Checking commit messages for required prefix: $PREFIX"
FAIL=0
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Coverage

on:
pull_request_target:
paths:
- 'django/**/*.py'
- 'tests/**/*.py'
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
diff-coverage:
if: github.repository == 'django/django'
name: Diff Coverage (Windows)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
cache: 'pip'
cache-dependency-path: 'tests/requirements/py3.txt'

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r tests/requirements/py3.txt -e .
python -m pip install 'coverage[toml]' diff-cover

- name: Run tests with coverage
env:
PYTHONPATH: ${{ github.workspace }}/tests
COVERAGE_PROCESS_START: ${{ github.workspace }}/tests/.coveragerc
RUNTESTS_DIR: ${{ github.workspace }}/tests
run: |
python -Wall tests/runtests.py -v2

- name: Generate coverage report
if: success()
env:
COVERAGE_RCFILE: ${{ github.workspace }}/tests/.coveragerc
RUNTESTS_DIR: ${{ github.workspace }}/tests
run: |
python -m coverage combine
python -m coverage report --show-missing
python -m coverage xml -o tests/coverage.xml

- name: Run diff-cover
if: success()
run: |
if (Test-Path 'tests/coverage.xml') {
diff-cover tests/coverage.xml --compare-branch=origin/main --fail-under=0 > tests/diff-cover-report.md
} else {
Set-Content -Path tests/diff-cover-report.md -Value 'No coverage.xml found; skipping diff-cover.'
}

- name: Post/update PR comment
if: success()
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const reportPath = 'tests/diff-cover-report.md';
let body = 'No coverage data available.';
if (fs.existsSync(reportPath)) {
body = fs.readFileSync(reportPath, 'utf8');
}
const commentBody = '### 📊 Coverage Report for Changed Files\n\n```\n' + body + '\n```\n\n**Note:** Missing lines are warnings only. Some lines may not be covered by SQLite tests as they are database-specific.\n\nFor more information about code coverage on pull requests, see the [contributing documentation](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#code-coverage-on-pull-requests).';

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
for (const c of comments) {
if ((c.body || '').includes('📊 Coverage Report for Changed Files')) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: c.id,
});
}
}

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody,
});
6 changes: 6 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -44,6 +46,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -65,6 +69,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Labels
on:
pull_request_target:
types: [ edited, opened, reopened, ready_for_review ]
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,6 +21,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false

- name: "Check title and manage labels"
uses: actions/github-script@v8
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -41,6 +43,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -58,5 +62,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: black
uses: psf/black@stable

zizmor:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Run zizmor
uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0
with:
advanced-security: false
annotations: true
4 changes: 4 additions & 0 deletions .github/workflows/new_contributor_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ name: New contributor message
on:
pull_request_target:
types: [opened]
branches:
- main

permissions:
pull-requests: write

jobs:
build:
# Only trigger on the main Django repository
if: github.repository == 'django/django'
name: Hello new contributor
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/postgis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/python_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
persist-credentials: false
- id: set-matrix
run: |
python_versions=$(sed -n "s/^.*Programming Language :: Python :: \([[:digit:]]\+\.[[:digit:]]\+\).*$/'\1', /p" pyproject.toml | tr -d '\n' | sed 's/, $//g')
Expand All @@ -37,6 +39,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/schedule_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -43,6 +45,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -69,6 +73,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v5
with:
Expand All @@ -84,6 +90,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down Expand Up @@ -120,6 +128,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down Expand Up @@ -165,6 +175,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/selenium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down Expand Up @@ -58,6 +60,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -46,6 +48,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v5
with:
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ repos:
rev: v9.36.0
hooks:
- id: eslint
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.16.3
hooks:
- id: zizmor
Loading