-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/consistent-er-uids
- Loading branch information
Showing
39 changed files
with
2,127 additions
and
912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Publish to PyPi | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
|
@@ -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 }}/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.