Compare commits

...

6 Commits

Author SHA1 Message Date
f4c9b7b6b6 Update ci.yml 2024-04-01 20:38:16 +02:00
5b3389e939 Added manual triggering of the action 2024-04-01 20:33:34 +02:00
7eabeb3e04 Moved to tagging without prefix 2024-04-01 20:31:45 +02:00
51d4e7e6b8 Reworked CI 2024-04-01 20:28:16 +02:00
3fc6ae51c3 Added todos 2024-04-01 20:19:43 +02:00
525af5b34d Merged workflows 2024-04-01 20:19:02 +02:00
4 changed files with 35 additions and 35 deletions

View File

@@ -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,16 @@ 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
- name: setup git - name: setup git
run: | run: |
@@ -54,12 +60,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 }}

View File

@@ -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 }}

View File

@@ -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:

View File

@@ -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