Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jochengcd committed May 5, 2024
2 parents 8b279dc + c83a281 commit a4cba06
Show file tree
Hide file tree
Showing 36 changed files with 363 additions and 298 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ charset = utf-8
[Makefile]
indent_style = tab

[*.{yaml,yml}]
indent_size = 2

# We don't want to apply our defaults to third-party code or minified bundles:
[**/{external,vendor}/**,**.min.{js,css}]
indent_style = ignore
Expand Down
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Keep GitHub Actions up to date with GitHub's Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
version: 2
updates:
- package-ecosystem: github-actions
directory: /
groups:
github-actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
22 changes: 11 additions & 11 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ name: "CodeQL"

on:
push:
branches: [master, ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 6 * * 5'
- cron: "0 6 * * 5"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: python
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
18 changes: 9 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install sphinx
- name: Build docs
run: cd docs && make html
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: pip install sphinx
- name: Build docs
run: cd docs && make html
60 changes: 30 additions & 30 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@ name: "PyPI releases"
on: release

jobs:
build_sdist:
name: Build Python source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
build_sdist:
name: Build Python source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist
- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz

pypi-publish:
name: Upload release to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs:
- build_sdist
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/django-haystack
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
pypi-publish:
name: Upload release to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs:
- build_sdist
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/django-haystack
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
70 changes: 36 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ on:
branches: [master]

jobs:
ruff: # https://beta.ruff.rs
ruff: # https://docs.astral.sh/ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install --user ruff
- run: ruff --output-format=github .
- uses: actions/checkout@v4
- run: pip install --user ruff
- run: ruff --output-format=github

test:
runs-on: ubuntu-latest
needs: ruff # Do not run the tests if linting fails.
needs: ruff # Do not run the tests if linting fails.
strategy:
fail-fast: false
matrix: # https://docs.djangoproject.com/en/4.1/faq/install
django-version: ["3.2", "4.0", "4.1"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
elastic-version: ["1.7", "2.4", "5.5", "7.13.1"]
matrix: # https://docs.djangoproject.com/en/stable/faq/install/#what-python-version-can-i-use-with-django
django-version: ["3.2", "4.2", "5.0"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
elastic-version: ["7.17.9"]
exclude:
- django-version: "4.0"
python-version: "3.7"
- django-version: "4.1"
python-version: "3.7"
include:
- django-version: "4.1"
- django-version: "3.2"
python-version: "3.11"
elastic-version: "7.13.1"
- django-version: "3.2"
python-version: "3.12"
- django-version: "5.0"
python-version: "3.8"
- django-version: "5.0"
python-version: "3.9"
services:
elastic:
image: elasticsearch:${{ matrix.elastic-version }}
Expand All @@ -47,22 +47,24 @@ jobs:
solr:
image: solr:6
ports:
- 9001:9001
- 9001:8983
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: sudo apt install --no-install-recommends -y gdal-bin
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install coverage requests tox tox-gh-actions
pip install django==${{ matrix.django-version }} elasticsearch==${{ matrix.elastic-version }}
python setup.py clean build install
- name: Run test
run: tox -v
env:
DJANGO: ${{ matrix.django-version }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: sudo apt install --no-install-recommends -y gdal-bin
- name: Setup solr test server in Docker
run: bash test_haystack/solr_tests/server/setup-solr-test-server-in-docker.sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install coverage requests tox tox-gh-actions
pip install django==${{ matrix.django-version }} elasticsearch==${{ matrix.elastic-version }}
pip install --editable .
- name: Run test
run: tox -v
env:
DJANGO: ${{ matrix.django-version }}
88 changes: 51 additions & 37 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,54 @@
exclude: ".*/vendor/.*"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: ruff
# args: [ --fix, --exit-non-zero-on-fix ]
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.15.0
hooks:
- id: django-upgrade
args: [--target-version, "5.0"] # Replace with Django version

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.12.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=128"]
- id: check-ast
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: pretty-format-json
args: ["--autofix", "--no-sort-keys", "--indent=4"]
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks:
- id: ruff
# args: [ --fix, --exit-non-zero-on-fix ]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
args: ["--maxkb=128"]
- id: check-ast
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: pretty-format-json
args: ["--autofix", "--no-sort-keys", "--indent=4"]
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [json, toml, xml, yaml]
8 changes: 4 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.12"
os: ubuntu-22.04
tools:
python: "3.12"

sphinx:
configuration: docs/conf.py
configuration: docs/conf.py
2 changes: 1 addition & 1 deletion docs/haystack_theme/layout.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "basic/layout.html" %}

{%- block extrahead %}
<link rel="stylesheet" href="http://haystacksearch.org/css/front.css" media="screen">
<link rel="stylesheet" href="https://haystacksearch.org/css/front.css" media="screen">
<link rel="stylesheet" href="_static/documentation.css" media="screen">
{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion example_project/regular_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def full_name(self):


class Toy(models.Model):
dog = models.ForeignKey(Dog, related_name="toys")
dog = models.ForeignKey(Dog, on_delete=models.CASCADE, related_name="toys")
name = models.CharField(max_length=60)

def __str__(self):
Expand Down
Loading

0 comments on commit a4cba06

Please sign in to comment.