Skip to content

Commit

Permalink
Merge branch 'release/1.6.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Dec 16, 2024
2 parents 1029220 + ba59e03 commit bf2a718
Show file tree
Hide file tree
Showing 26 changed files with 1,891 additions and 137 deletions.
78 changes: 0 additions & 78 deletions .circleci/config.yml

This file was deleted.

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
- 'uv.lock'
- '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'

migrations:
- added|modified: 'src/**/migrations/*'

lint:
- *python
- '.flake8'
- 'pyproject.toml'
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build release distributions
run: |
python -m pip install uv
uv build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest

needs:
- release-build

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
environment:
name: pypi

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
111 changes: 111 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Test

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

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

defaults:
run:
shell: bash

permissions:
id-token: write
attestations: write


jobs:
changes:
runs-on: ubuntu-latest
concurrency:
group: changes-group
cancel-in-progress: true
timeout-minutes: 1
defaults:
run:
shell: bash
outputs:
run_tests: ${{steps.changes.outputs.run_tests }}
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

ci:
runs-on: ubuntu-latest
name: Test py${{ matrix.python-version }}/dj${{matrix.django-version}}
defaults:
run:
shell: bash
strategy:
max-parallel: 1
matrix:
python-version: [ "3.11", "3.12" ]
django-version: [ "3.2", "4.2", "5.0", "5.1" ]
fail-fast: true
needs: [ changes ]
if: needs.changes.outputs.run_tests || needs.changes.outputs.lint
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Cache virtualenv
uses: actions/cache@v3
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('uv.lock') }}
path: .venv

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install the project
run: |
uv sync --all-extras --dev
uv pip install .
- name: lint
if: needs.changes.outputs.lint
run: |
uv run isort src/ --check-only
uv run flake8 src/
- name: Test
if: needs.changes.outputs.run_tests
run: |
uv run pytest tests --create-db --junit-xml junit-${{ matrix.python-version }}-${{matrix.django-version}}.xml
- 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() }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: ${{ always() }}
continue-on-error: true
with:
env_vars: OS,PYTHON
fail_ci_if_error: true
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: false
name: codecov-${{env.GITHUB_REF_NAME}}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ config.json
.env
.envrc
.venv/
.pdm-python
# Sphinx documentation
docs/_build/

Expand Down
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Release 1.7
-----------
* removed UNICEFAzureADB2COAuth2


Release 1.6.3
-------------
* admin tweaks for users
Expand Down
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@ Develop
~~~~~~~

.. image:: https://travis-matrix-badges.herokuapp.com/repos/unicef/unicef-security/branches/develop


Build
~~~~~

.. uv build
26 changes: 8 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[project]
name = "unicef-security"
version = "1.6.3"
version = "1.6.4"
description = "Provides Basic UNICEF User model and integration with Azure"
readme = "README.rst"
license = {text = "Apache-2.0 OR MIT"}
Expand All @@ -17,6 +13,7 @@ classifiers = [
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -36,8 +33,9 @@ dependencies = [
"wheel"
]

[project.optional-dependencies]
test = [
[tool.uv]
dev-dependencies = [
"django_regex",
"django-webtest",
"factory-boy",
"flake8",
Expand All @@ -48,21 +46,13 @@ test = [
"pytest-cov",
"pytest-django",
"pytest-echo",
"pytest-factoryboy",
"requests-mock",
"responses",
"tox",
"unittest2",
"vcrpy",
]

[project.urls]
Homepage = "https://github.com/unicef/unicef-security"

[tool.hatch.build.targets.sdist]
include = [
"/src",
]

[tool.hatch.build.targets.wheel]
packages = ["/src/unicef_security"]

[tool.pdm]
version = { source = "file", path = "src/unicef_security/__init__.py" }
11 changes: 10 additions & 1 deletion src/unicef_security/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,19 @@ class UserAdminPlus(ExtraButtonsMixin, UserAdmin):
),
("email", "display_name"),
("job_title",),
("is_active",),
)
},
),
(
_("Permissions"),
{
"fields": (
"is_active",
"groups",
"user_permissions",
),
},
),
(_("Important dates"), {"fields": ("last_login", "date_joined")}),
)
add_fieldsets = (
Expand Down
Loading

0 comments on commit bf2a718

Please sign in to comment.