Skip to content
Merged

V0.1 #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/publish-testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Publish to TestPyPI

# Manual workflow for testing package publishing to TestPyPI
# This allows you to verify the package before publishing to production PyPI

on:
workflow_dispatch:
inputs:
build_only:
description: 'Only build package (do not upload)'
required: false
type: boolean
default: false

jobs:
build:
name: Build distribution packages
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: List package contents
run: |
echo "## 📦 Package Contents" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Wheel file:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
unzip -l dist/*.whl | grep -E "(internal_admin|\.py$|static|templates)" | head -40 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/
retention-days: 7

publish-testpypi:
name: Publish to TestPyPI
runs-on: ubuntu-latest
needs: build
if: inputs.build_only != true

permissions:
id-token: write # Required for trusted publishing

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist-packages
path: dist/

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
print-hash: true

- name: Create success summary
run: |
echo "## Published to TestPyPI" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Test installation with:" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo "pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ internal-admin" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "View on TestPyPI: https://test.pypi.org/project/internal-admin/" >> $GITHUB_STEP_SUMMARY

verify:
name: Verify TestPyPI installation
runs-on: ubuntu-latest
needs: publish-testpypi
if: inputs.build_only != true

steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Wait for TestPyPI to update
run: sleep 30

- name: Install from TestPyPI
run: |
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ internal-admin
continue-on-error: true

- name: Test import
run: |
python -c "from internal_admin import AdminSite, ModelAdmin, AdminConfig; print('✓ Package successfully installed from TestPyPI')"
continue-on-error: true
94 changes: 93 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,58 @@ name: Release
on:
push:
branches: ["main"]
workflow_dispatch:
inputs:
release_type:
description: 'Release type (leave empty for auto)'
required: false
type: choice
options:
- ''
- 'patch'
- 'minor'
- 'major'

# Only one release job runs at a time; queued runs wait rather than cancel.
concurrency:
group: release
cancel-in-progress: false

jobs:
# Run tests before releasing
test:
name: Run tests before release
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install dependencies
run: pip install -e ".[dev]"

- name: Run linting
run: |
black --check internal_admin tests
isort --check-only internal_admin tests
ruff check internal_admin tests

- name: Run type checking
run: mypy internal_admin

- name: Run tests
run: pytest tests/ --cov=internal_admin --cov-report=term-missing

release:
name: Semantic release
runs-on: ubuntu-latest
needs: test

# Prevent release from running on the automated version-bump commit itself.
if: "!contains(github.event.head_commit.message, '[skip ci]')"
Expand All @@ -21,6 +63,11 @@ jobs:
id-token: write # required for PyPI trusted publishing
contents: write # required to push the version-bump commit and tag

outputs:
released: ${{ steps.semantic.outputs.released }}
version: ${{ steps.semantic.outputs.version }}
tag: ${{ steps.semantic.outputs.tag }}

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -33,7 +80,7 @@ jobs:
python-version: "3.12"
cache: pip

- name: Install dev dependencies
- name: Install dependencies
run: pip install -e ".[dev]"

- name: Configure git identity
Expand All @@ -56,8 +103,53 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Upload build artifacts
if: steps.semantic.outputs.released == 'true'
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/
retention-days: 30

- name: Publish to PyPI
if: steps.semantic.outputs.released == 'true'
run: semantic-release publish
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Create release summary
if: steps.semantic.outputs.released == 'true'
run: |
echo "## 🎉 Release Published" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ steps.semantic.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "**Tag:** ${{ steps.semantic.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 Published to" >> $GITHUB_STEP_SUMMARY
echo "- [PyPI](https://pypi.org/project/internal-admin/${{ steps.semantic.outputs.version }}/)" >> $GITHUB_STEP_SUMMARY
echo "- [GitHub Releases](https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic.outputs.tag }})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📥 Install with" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo "pip install internal-admin==${{ steps.semantic.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

verify:
name: Verify PyPI publication
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.released == 'true'

steps:
- name: Wait for PyPI to update
run: sleep 60

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Verify package on PyPI
run: |
pip install internal-admin==${{ needs.release.outputs.version }}
python -c "from internal_admin import AdminSite, ModelAdmin, AdminConfig; print('✓ Package successfully installed from PyPI')"
28 changes: 28 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Include documentation files
include README.md
include LICENSE
include CHANGELOG.md
include CONTRIBUTING.md
include CODE_OF_CONDUCT.md

# Include static assets
recursive-include internal_admin/static *.css *.js *.png *.jpg *.svg *.ico
recursive-include internal_admin/templates *.html

# Include configuration
include pyproject.toml

# Exclude development and build artifacts
exclude .env
exclude .env.example
exclude demo.py
exclude example.py
exclude cookies.txt
exclude *.db
recursive-exclude tests *
recursive-exclude .github *
recursive-exclude __pycache__ *
recursive-exclude *.egg-info *
global-exclude *.pyc
global-exclude *.pyo
global-exclude .DS_Store
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Internal Admin

[![CI](https://github.com/ayahaustine/internal-admin/workflows/CI/badge.svg)](https://github.com/ayahaustine/internal-admin/actions/workflows/ci.yml)
[![Release](https://github.com/ayahaustine/internal-admin/workflows/Release/badge.svg)](https://github.com/ayahaustine/internal-admin/actions/workflows/release.yml)
[![PyPI version](https://badge.fury.io/py/internal-admin.svg)](https://pypi.org/project/internal-admin/)
[![Python Versions](https://img.shields.io/pypi/pyversions/internal-admin.svg)](https://pypi.org/project/internal-admin/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A reusable, pip-installable administrative framework for FastAPI applications.
Automatically generates a full CRUD interface from your SQLAlchemy models, with
session-based authentication, role-based permissions, and a clean Bootstrap 5 UI
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ include = [
"/CHANGELOG.md",
"/README.md",
"/LICENSE",
"/pyproject.toml",
]

# ---------------------------------------------------------------------------
Expand Down
Loading
Loading