Skip to content

Commit

Permalink
Merge branch 'master' into feature/consistent-er-uids
Browse files Browse the repository at this point in the history
  • Loading branch information
obayemi authored Dec 2, 2024
2 parents 030ad87 + 9deaa63 commit 805d012
Show file tree
Hide file tree
Showing 39 changed files with 2,127 additions and 912 deletions.
95 changes: 81 additions & 14 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish to PyPi
name: Publish to PyPI

on:
release:
Expand All @@ -7,24 +7,91 @@ on:

jobs:
publish:
strategy:
fail-fast: true
matrix:
python-version: [ 3.8 ]
poetry-version: [ 1.3.2 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/djoser/

steps:
- uses: actions/[email protected]
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Run image
python-version: "3.8"

- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Build and publish
poetry-version: "1.8.4"

- name: Get release tag
id: get_tag
run: |
TAG=$(git describe --tags)
echo "TAG=$TAG" >> $GITHUB_ENV
VERSION=${TAG#v} # Remove "v" prefix if present
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Verify package version matches tag
run: |
PACKAGE_VERSION=$(poetry version -s)
if [ "$PACKAGE_VERSION" != "${{ env.VERSION }}" ]; then
echo "Package version ($PACKAGE_VERSION) does not match tag version (${{ env.VERSION }})"
exit 1
fi
- name: Update package version from tag
run: |
echo "Updating version to ${{ env.VERSION }}"
poetry version ${{ env.VERSION }}
- name: Compile translations
run: |
echo "Compiling translation files..."
poetry run pybabel compile --domain django --directory djoser/locale -f
- name: Build package
run: |
echo "Building package..."
poetry build
echo "Package contents:"
ls -l dist/
# Test PyPI deployment for pre-releases
- name: Configure Test PyPI
if: github.event.release.prerelease
run: |
echo "Configuring Test PyPI..."
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
- name: Publish to Test PyPI
if: github.event.release.prerelease
run: |
echo "Publishing to Test PyPI..."
poetry publish --no-interaction -r testpypi
echo "Package published to Test PyPI successfully"
# Production PyPI deployment
- name: Configure PyPI
if: "!github.event.release.prerelease"
run: |
echo "Configuring PyPI..."
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build --no-interaction
- name: Publish to PyPI
if: "!github.event.release.prerelease"
run: |
echo "Publishing to PyPI..."
poetry publish --no-interaction
echo "Package published to PyPI successfully"
- name: Verify publish
run: |
echo "Published version ${{ env.VERSION }} successfully"
echo "Package is available at https://pypi.org/p/djoser/${{ env.VERSION }}/"
153 changes: 91 additions & 62 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,111 +2,140 @@ name: Tests
on:
push:
branches:
- master
- master
pull_request:

schedule:
- cron: '0 0 * * 0'

jobs:
test:
name: Python ${{ matrix.python-version }} - Django ${{ matrix.django-version }} - DRF ${{ matrix.drf-version }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]
django-version: [3.2.18, 4.2]
drf-version: [3.14]
include:
# django 3.2, drf 3.12 and 3.14, py3.8-3.11
- python-version: 3.8
django-version: 3.2.18
drf-version: 3.12
- python-version: 3.8
django-version: 3.2.18
drf-version: 3.14
- python-version: 3.9
django-version: 3.2.18
drf-version: 3.12
- python-version: 3.9
django-version: 3.2.18
drf-version: 3.14
# Test latest Django stable with newest Python versions
- python-version: '3.10'
django-version: 3.2.18
drf-version: 3.12
- python-version: '3.10'
django-version: 3.2.18
django-version: "latest"
drf-version: 3.14
- python-version: 3.11
django-version: 3.2.18
drf-version: 3.12
- python-version: 3.11
django-version: 3.2.18
drf-version: 3.14
# django 4.2, drf 3.14, py3.8-3.11
- python-version: 3.8
django-version: 4.2
drf-version: 3.14
- python-version: 3.9
django-version: 4.2
django-version: "latest"
drf-version: 3.14
- python-version: '3.10'
django-version: 4.2
drf-version: 3.14
- python-version: 3.11
django-version: 4.2
drf-version: 3.14
# django 5, drf 3.14, py3.10-3.11
# Include Django 5 beta for future compatibility
- python-version: '3.10'
django-version: "5.0b1"
drf-version: 3.14
- python-version: 3.11
django-version: "5.0b1"
drf-version: 3.14

exclude:
# Exclude older Python versions from newer Django
- python-version: 3.8
django-version: "5.0b1"
- python-version: 3.9
django-version: "5.0b1"

runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run image

- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.django-version }}
restore-keys: |
${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-
${{ runner.os }}-poetry-
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.3.2
poetry-version: "1.8.4"

- name: Install dependencies
run: poetry install --only main,test --all-extras
- name: Upgrade django version

- name: Install Django version
run: |
poetry run pip install "Django==${{ matrix.django-version }}"
- name: Upgrade drf version
if [ "${{ matrix.django-version }}" = "latest" ]; then
poetry run pip install --upgrade "Django" # Force upgrade to latest
else
poetry run pip install --upgrade "Django==${{ matrix.django-version }}" # Force specific version
fi
- name: Install DRF version
run: poetry run pip install --upgrade "djangorestframework==${{ matrix.drf-version }}"

- name: Show environment info
run: |
poetry run pip install "djangorestframework==${{ matrix.drf-version }}"
- name: Echo env
run: poetry run pip freeze | grep -E 'djangorestframework|Django'
poetry run python --version
poetry run pip freeze | grep -E 'djangorestframework|Django'
- name: Run tests
run: make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
continue-on-error: true
with:
files: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

code-quality:
strategy:
fail-fast: false
matrix:
python-version: [ 3.8 ]
poetry-version: [ 1.3.2 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run image
python-version: "3.11"

- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-quality-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-quality-
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
poetry-version: "1.7.1"

- name: Install dependencies
run: poetry install --only code-quality

- name: Run pre-commit
run: make run-hooks

lock-file-check:
name: Check poetry.lock for changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.8.4"

- name: Install dependencies to check poetry.lock
run: poetry install

- name: Check if poetry.lock is up to date
run: poetry check --lock
8 changes: 3 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-20.04
tools:
python: "3.11"
jobs:
post_create_environment:
- python -m pip install poetry
post_install:
- pip install poetry
- poetry config virtualenvs.create false
- poetry install --only docs
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

sphinx:
configuration: docs/source/conf.py
29 changes: 28 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,30 @@ Change Log
This document records all notable changes to djoser.
This project adheres to `Semantic Versioning <http://semver.org/>`_.

---------------------
`2.3.1`_ (2024-11-09)
---------------------

* add support for Django 5.1.1 (mails serialization was failing) https://github.com/sunscrapers/djoser/issues/842
* remove django-templated-mail from deps https://github.com/sunscrapers/djoser/issues/846

---------------------
`2.3.0`_ (2024-11-09)
---------------------

* a potentially breaking change: fix vuln where users were given tokens if the given password was correct, but they haven't passed Django internal AUTHENTICATION_BACKENDS https://github.com/sunscrapers/djoser/issues/795


---------------------
`2.2.3`_ (2024-06-07)
---------------------

* add support for protocol, domain and site name customization in the email contents https://github.com/sunscrapers/djoser/issues/781
* remove unused `inactive_account` serializer error, not in use since Django 1.10 https://github.com/sunscrapers/djoser/pull/806/commits/b02c422151035a2616102fbb9b48af28067f9c5d
* add catalan translations, update spanish translations https://github.com/sunscrapers/djoser/pull/826
* move serializers for TokenDestroyView and SignupRequestView to class level, so the OpenAPI schema can be automatically generated https://github.com/sunscrapers/djoser/pull/817
* fixed typo SingupRequestView -> SignupRequestView https://github.com/sunscrapers/djoser/pull/817

---------------------
`2.2.2`_ (2023-11-09)
---------------------
Expand Down Expand Up @@ -245,7 +269,7 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
`0.7.0`_ (2017-09-01)
---------------------

* Add ``TOKEN_MODEL`` setting to allow third party apps to specify a custom token model
* Add ``TOKEN_MODEL`` setting to allow third party apps to specify a custom token modelclosed
* Add ``USER_EMAIL_FIELD_NAME`` setting as a compatibility solution in Django < 1.11
* Add support for Django Password Validators
* Add HTML templates for djoser emails
Expand Down Expand Up @@ -433,3 +457,6 @@ few bugfixes / documentation updates. List of changes:
.. _2.2.0: https://github.com/sunscrapers/djoser/compare/2.1.0...2.2.0
.. _2.2.1: https://github.com/sunscrapers/djoser/compare/2.2.0...2.2.1
.. _2.2.2: https://github.com/sunscrapers/djoser/compare/2.2.1...2.2.2
.. _2.2.3: https://github.com/sunscrapers/djoser/compare/2.2.2...2.2.3
.. _2.3.0: https://github.com/sunscrapers/djoser/compare/2.2.3...2.3.0
.. _2.3.1: https://github.com/sunscrapers/djoser/compare/2.3.0...2.3.1
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ djoser
.. image:: https://img.shields.io/pypi/v/djoser.svg
:target: https://pypi.org/project/djoser

.. image:: https://github.com/sunscrapers/djoser/workflows/Tests/badge.svg
:target: https://github.com/sunscrapers/djoser/actions?query=branch%3Amaster+workflow%Tests++
.. image:: https://github.com/sunscrapers/djoser/actions/workflows/test-suite.yml/badge.svg?branch=master
:target: https://github.com/sunscrapers/djoser/actions?query=branch%3Amaster
:alt: Build Status

.. image:: https://codecov.io/gh/sunscrapers/djoser/branch/master/graph/badge.svg
Expand Down
Loading

0 comments on commit 805d012

Please sign in to comment.