From 32eccbb130a883dfebbe3fc4d2101550d0892359 Mon Sep 17 00:00:00 2001 From: Oluwafemi Adenuga Date: Tue, 10 Oct 2023 12:45:52 +0100 Subject: [PATCH] Implement CI for checks and release --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ .github/workflows/release.yml | 20 ++++++++++++++++++++ openproject/client.py | 4 ++-- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3f3772e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx install poetry==1.6.1 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: poetry + - run: poetry install + - run: poetry run black --check . + - run: poetry run mypy --check . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2d9aaf5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: Release + +on: + release: + types: + - published + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx install poetry==1.6.1 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: poetry + - run: poetry install + - run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + - run: poetry publish --build diff --git a/openproject/client.py b/openproject/client.py index a52f256..7a607b2 100644 --- a/openproject/client.py +++ b/openproject/client.py @@ -1,5 +1,5 @@ import httpx -from exceptions import APIError, AuthenticationError +from openproject.exceptions import APIError, AuthenticationError from openproject.types import WorkPackage @@ -74,7 +74,7 @@ class WorkPackages(SubClient): "lock_version": "lockVersion", } - def _api_payload_from_kwargs(self, **kwargs) -> WorkPackage: + def _api_payload_from_kwargs(self, **kwargs: WorkPackage): items = self._args_api_mapping.items() data = {api_args: kwargs[args] for args, api_args in items if args in kwargs} return data