Skip to content

Commit

Permalink
Merge branch 'release/2.5'
Browse files Browse the repository at this point in the history
* release/2.5:
  updates tox.ini
  updates CI
  updates CI
  add pytest.ini
  pep 621
  Update code blocks in README
  • Loading branch information
saxix committed Oct 16, 2024
2 parents 31a5dfe + 53e2910 commit 7b42ef9
Show file tree
Hide file tree
Showing 82 changed files with 792 additions and 1,426 deletions.
3 changes: 2 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.4.3
current_version = 2.5.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<release>\d+)
serialize = {major}.{minor}.{release}
commit = False
Expand All @@ -9,3 +9,4 @@ allow_dirty = False
tag_name = {new_version}

[bumpversion:file:src/adminfilters/__init__.py]
[bumpversion:file:pyproject.toml]
30 changes: 30 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This is used by the action https://github.com/dorny/paths-filter
dependencies: &dependencies
- 'pyproject.toml'

python: &python
- added|modified: 'src/**'
- added|modified: 'tests/**'
- 'manage.py'

changelog:
- added|modified: 'changes/**'
- 'CHANGELOG.md'

mypy:
- *python
- 'mypy.ini'

run_tests:
- *python
- *dependencies
- 'pytest.ini'
- '.github/workflows/test.yml'
- '.github/file-filters.yml'

lint:
- *python
- '.flake8'
- 'pyproject.toml'
- '.github/file-filters.yml'
- '.github/workflows/lint.yml'
67 changes: 67 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "Documentation"

on:
push:
branches:
- develop
- master
schedule:
- cron: '37 23 * * 2'

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
generate:
name: Generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore cached venv
id: cache-venv-restore
uses: actions/cache/restore@v4
with:
path: |
.cache-uv/
.venv/
key: ${{ matrix.python-version }}-${{matrix.django-version}}-venv

- uses: yezz123/setup-uv@v4
- name: Build Doc
run: |
uv sync --extra docs
PYTHONPATH=./src uv run --cache-dir .cache-uv/ mkdocs build -d ./docs-output
- name: Cache venv
if: steps.cache-venv-restore.outputs.cache-hit != 'true'
id: cache-venv-save
uses: actions/cache/save@v4
with:
path: |
.cache-uv/
.venv/
key: ${{ matrix.python-version }}-${{matrix.django-version}}-venv

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs-output

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: generate
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
62 changes: 62 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Lint

on:
push:
branches:
- '**' # matches every branch

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

defaults:
run:
shell: bash

permissions:
id-token: write
attestations: write


jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 1
defaults:
run:
shell: bash
outputs:
lint: ${{steps.changes.outputs.lint }}
steps:
- name: Checkout code
uses: actions/[email protected]
- id: changes
name: Check for file changes
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml

lint:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: [ changes ]
if: needs.changes.outputs.lint
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
architecture: 'x64'
- uses: yezz123/setup-uv@v4
- name: lint
if: needs.changes.outputs.lint
run: |
uv run isort src/ --check-only
uv run flake8 src/
129 changes: 96 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,52 @@ name: Test
on:
push:
branches:
- master
- develop
pull_request:
- '**' # matches every branch

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

defaults:
run:
shell: bash

permissions:
id-token: write
attestations: write


jobs:
lint:
changes:
runs-on: ubuntu-latest
timeout-minutes: 1
defaults:
run:
shell: bash
outputs:
run_tests: ${{steps.changes.outputs.run_tests }}
lint: ${{steps.changes.outputs.lint }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2

- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Lint with flake8
run: |
tox -e lint
- name: Checkout code
uses: actions/[email protected]
- id: changes
name: Check for file changes
uses: dorny/[email protected]
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml

test:
# if: ${{github.event}} && ${{ !contains(github.event.head_commit.message, 'ci skip') }}
ci:
needs: [ changes ]
runs-on: ubuntu-latest
name: Test py${{ matrix.python-version }}/dj${{matrix.django-version}}
defaults:
run:
shell: bash
services:
postgres:
image: postgres:12
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -35,30 +57,71 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
fail-fast: false
max-parallel: 1
matrix:
django-version: [ "3.2", "4.2", "5.0"]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
exclude:
- django-version: 5.0
python-version: 3.9
python-version: [ "3.11", "3.12" ]
django-version: [ "4.2", "5.1" ]
fail-fast: true
# if: needs.changes.outputs.run_tests || needs.changes.outputs.lint
env:
DATABASE_URL: postgres://postgres:[email protected]:5432/adminfilters
PY_VER: ${{ matrix.python-version}}
DJ_VER: ${{ matrix.django-version}}
DOCKER_DEFAULT_PLATFORM: linux/amd64
DATABASE_URL: postgres://postgres:postgres@localhost:5432/adminfilters
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Restore cached venv
id: cache-venv-restore
uses: actions/cache/restore@v4
with:
path: |
.cache-uv/
.venv/
key: ${{ matrix.python-version }}-${{matrix.django-version}}-${{ hashFiles('pyproject.toml') }}-venv

- name: Install dependencies
run: python -m pip install --upgrade pip .[test] "django==${DJ_VER}.*"
- uses: yezz123/setup-uv@v4
with:
python: ${{ matrix.python-version }}

- name: Test with
run: py.test --selenium -vv --cov-report=xml --cov-report=term --junitxml=pytest.xml --cov-config=tests/.coveragerc --cov adminfilters
- name: Test
# if: needs.changes.outputs.run_tests
run: |
uv export -q --no-hashes -o requirements.txt
pip install -r requirements.txt
pip install "django==${{ matrix.django-version }}.*"
python -m pytest tests/ \
--junit-xml junit-${{ matrix.python-version }}-${{matrix.django-version}}.xml \
--cov --cov-report xml
- name: Cache venv
if: steps.cache-venv-restore.outputs.cache-hit != 'true'
id: cache-venv-save
uses: actions/cache/save@v4
with:
path: |
.cache-uv/
.venv/
key: ${{ matrix.python-version }}-${{matrix.django-version}}-${{ hashFiles('pyproject.toml') }}-venv

- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}-${{matrix.django-version}}
path: junit-${{ matrix.python-version }}-${{matrix.django-version}}.xml
if: ${{ always() }}

- uses: codecov/codecov-action@v1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == 3.12
continue-on-error: true
with:
verbose: true # optional (default = false)
env_vars: OS,PYTHON
fail_ci_if_error: true
flags: unittests
files: ./coverage.xml
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-${{env.GITHUB_REF_NAME}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.*
~*
*.lock
build
__pycache__
*.egg-info
!docs/**/.pages
!.gitignore
!.github
!.bumpversion.cfg
Expand Down
8 changes: 7 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Release 2.5
===========
* PEP 621 support (pyproject.toml)
* Added partial Proxy Models support to AutoCompleteFilter


Release 2.4.3
=============
* Fixes bug in UnionListFilter
Expand All @@ -12,7 +18,7 @@ Release 2.4.2

Release 2.4.1
=============
* Fixes bug in AutoCompleteFilter
* Fixes bug in AutiCompleteFilter


Release 2.4
Expand Down
Loading

0 comments on commit 7b42ef9

Please sign in to comment.