mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-14 04:10:30 +02:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f4e3e7dba | |||
| 38d9a0c177 | |||
| f4c9b7b6b6 | |||
| 5b3389e939 | |||
| 7eabeb3e04 | |||
| 51d4e7e6b8 | |||
| 3fc6ae51c3 | |||
| 525af5b34d |
@@ -1,4 +1,4 @@
|
|||||||
name: Lint and tag
|
name: Lint, Test, Tag & Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -10,6 +10,7 @@ on:
|
|||||||
- "**/.vscode/**"
|
- "**/.vscode/**"
|
||||||
- "**/README.md"
|
- "**/README.md"
|
||||||
- "**/CHANGELOG.md"
|
- "**/CHANGELOG.md"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
@@ -39,11 +40,18 @@ jobs:
|
|||||||
- run: python -m pip install -r requirements.txt
|
- run: python -m pip install -r requirements.txt
|
||||||
- run: python test.py
|
- run: python test.py
|
||||||
|
|
||||||
tag:
|
tag_and_publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: test
|
needs: test
|
||||||
|
permissions:
|
||||||
|
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: setup git
|
- name: setup git
|
||||||
run: |
|
run: |
|
||||||
@@ -54,12 +62,30 @@ jobs:
|
|||||||
uses: codacy/git-version@2.8.0
|
uses: codacy/git-version@2.8.0
|
||||||
id: git_version
|
id: git_version
|
||||||
with:
|
with:
|
||||||
prefix: v
|
|
||||||
minor-identifier: "feat:"
|
minor-identifier: "feat:"
|
||||||
major-identifier: "breaking:"
|
major-identifier: "breaking:"
|
||||||
|
|
||||||
- name: Create Tag
|
- name: Create Tag
|
||||||
run: git tag -a ${{ steps.git_version.outputs.version }} -m "${{ steps.git_version.outputs.version }}"
|
run: git tag ${{ steps.git_version.outputs.version }}
|
||||||
|
|
||||||
- name: Push Tag
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
run: git push origin ${{ steps.git_version.outputs.version }}
|
with:
|
||||||
|
commit_message: Add new tag
|
||||||
|
push_options: --tags
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.build.txt
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
|
- name: Build and publish
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
user: __token__
|
||||||
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
29
.github/workflows/publish.yml
vendored
29
.github/workflows/publish.yml
vendored
@@ -1,29 +0,0 @@
|
|||||||
name: Publish to pypi
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.12'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -r requirements.build.txt
|
|
||||||
|
|
||||||
- name: Build and publish
|
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
|
||||||
with:
|
|
||||||
user: __token__
|
|
||||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
# creyPY
|
# creyPY
|
||||||
|
|
||||||
My collection of Python and FastAPI shortcuts etc.
|
My collection of Python and FastAPI shortcuts etc.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ def get_object_or_404(db_class: Type[T], id: UUID | str, db: Session, expunge: b
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Add testing
|
||||||
def create_obj_from_data(
|
def create_obj_from_data(
|
||||||
data: BaseModel, model: Type[T], db: Session, additonal_data={}, exclude={}
|
data: BaseModel, model: Type[T], db: Session, additonal_data={}, exclude={}
|
||||||
) -> T:
|
) -> T:
|
||||||
@@ -29,6 +30,7 @@ def create_obj_from_data(
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Add testing
|
||||||
def update_obj_from_data(
|
def update_obj_from_data(
|
||||||
data: BaseModel,
|
data: BaseModel,
|
||||||
model: Type[T],
|
model: Type[T],
|
||||||
@@ -50,6 +52,7 @@ def update_obj_from_data(
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Add testing
|
||||||
def delete_object(db_class: Type[T], id: UUID | str, db: Session) -> None:
|
def delete_object(db_class: Type[T], id: UUID | str, db: Session) -> None:
|
||||||
obj = db.query(db_class).filter(db_class.id == id).one_or_none()
|
obj = db.query(db_class).filter(db_class.id == id).one_or_none()
|
||||||
if obj is None:
|
if obj is None:
|
||||||
|
|||||||
@@ -23,3 +23,5 @@ twine==5.0.0
|
|||||||
urllib3==2.2.1
|
urllib3==2.2.1
|
||||||
wheel==0.43.0
|
wheel==0.43.0
|
||||||
zipp==3.18.1
|
zipp==3.18.1
|
||||||
|
|
||||||
|
-r requirements.txt
|
||||||
|
|||||||
1
setup.py
1
setup.py
@@ -24,6 +24,7 @@ setup(
|
|||||||
name="creyPY",
|
name="creyPY",
|
||||||
version=get_latest_git_tag(),
|
version=get_latest_git_tag(),
|
||||||
description="Collection of my Python and FastAPI shortcuts, snippets etc.",
|
description="Collection of my Python and FastAPI shortcuts, snippets etc.",
|
||||||
|
long_description=open("README.md").read(),
|
||||||
author="Conrad Großer",
|
author="Conrad Großer",
|
||||||
author_email="conrad@noah.tech",
|
author_email="conrad@noah.tech",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
|
|||||||
Reference in New Issue
Block a user