From ff9171505b99573788879e86aeb897a8461c42ec Mon Sep 17 00:00:00 2001 From: "joel@joellee.org" Date: Fri, 15 Sep 2023 21:35:40 +0800 Subject: [PATCH 1/3] feat:add semver --- .github/workflows/ci.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76274c6a..5c46583e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,22 +29,36 @@ jobs: - name: Upload Coverage uses: codecov/codecov-action@v1 - publish: needs: test - if: ${{ !startsWith(github.event.head_commit.message, 'bump:') && github.ref == 'refs/heads/main' && github.event_name == 'push' }} + if: ${{ !startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore') && github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository_owner == 'supabase-community' }} runs-on: ubuntu-latest name: "Bump version, create changelog and publish" + environment: + name: pypi + url: https://pypi.org/p/storage3 + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + contents: write # needed for github actions bot to write to repo steps: - name: Clone Repository uses: actions/checkout@v2 with: ref: ${{ github.ref }} fetch-depth: 0 + - name: Python Semantic Release + id: release + uses: python-semantic-release/python-semantic-release@v8.0.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. + # See https://github.com/actions/runner/issues/1173 + if: steps.release.outputs.released == 'true' - name: Python Semantic Release - uses: relekang/python-semantic-release@master + uses: python-semantic-release/upload-to-gh-release@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - repository_username: __token__ - repository_password: ${{ secrets.PYPI_TOKEN }} From 98aae1c7b8ebb383ab005fbaf4c70f8b388bca9e Mon Sep 17 00:00:00 2001 From: "joel@joellee.org" Date: Fri, 15 Sep 2023 21:53:53 +0800 Subject: [PATCH 2/3] fix: run unasync and also patch type --- storage3/_async/file_api.py | 2 +- storage3/_sync/bucket.py | 2 +- storage3/_sync/file_api.py | 4 ++-- tests/_sync/test_client.py | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/storage3/_async/file_api.py b/storage3/_async/file_api.py index fdecd7b1..b980a573 100644 --- a/storage3/_async/file_api.py +++ b/storage3/_async/file_api.py @@ -258,7 +258,7 @@ async def copy(self, from_path: str, to_path: str) -> dict[str, str]: ) return res.json() - async def remove(self, paths: list) -> dict[str, str]: + async def remove(self, paths: list) -> list[dict[str, any]]: """ Deletes files within the same bucket diff --git a/storage3/_sync/bucket.py b/storage3/_sync/bucket.py index 5780776c..3782fe07 100644 --- a/storage3/_sync/bucket.py +++ b/storage3/_sync/bucket.py @@ -5,7 +5,7 @@ from httpx import HTTPError, Response from ..types import CreateOrUpdateBucketOptions, RequestMethod -from ..utils import StorageException, SyncClient +from ..utils import SyncClient, StorageException from .file_api import SyncBucket __all__ = ["SyncStorageBucketAPI"] diff --git a/storage3/_sync/file_api.py b/storage3/_sync/file_api.py index 90dbe77b..2a1c23c6 100644 --- a/storage3/_sync/file_api.py +++ b/storage3/_sync/file_api.py @@ -19,7 +19,7 @@ SignedUploadURL, TransformOptions, ) -from ..utils import StorageException, SyncClient +from ..utils import SyncClient, StorageException __all__ = ["SyncBucket"] @@ -258,7 +258,7 @@ def copy(self, from_path: str, to_path: str) -> dict[str, str]: ) return res.json() - def remove(self, paths: list) -> dict[str, str]: + def remove(self, paths: list) -> list[dict[str, any]]: """ Deletes files within the same bucket diff --git a/tests/_sync/test_client.py b/tests/_sync/test_client.py index f897dcf5..5ac6b3fe 100644 --- a/tests/_sync/test_client.py +++ b/tests/_sync/test_client.py @@ -79,7 +79,9 @@ def bucket(storage: SyncStorageClient, uuid_factory: Callable[[], str]) -> str: @pytest.fixture(scope="module") -def public_bucket(storage: SyncStorageClient, uuid_factory: Callable[[], str]) -> str: +def public_bucket( + storage: SyncStorageClient, uuid_factory: Callable[[], str] +) -> str: """Creates a test public bucket which will be used in the whole storage tests run and deleted at the end""" bucket_id = uuid_factory() From 14be2669e381e3bd3fd3a2b73f8a76a3294f33b1 Mon Sep 17 00:00:00 2001 From: "joel@joellee.org" Date: Fri, 15 Sep 2023 23:26:19 +0800 Subject: [PATCH 3/3] chore: run black --- storage3/_sync/bucket.py | 2 +- storage3/_sync/file_api.py | 2 +- tests/_sync/test_client.py | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/storage3/_sync/bucket.py b/storage3/_sync/bucket.py index 3782fe07..5780776c 100644 --- a/storage3/_sync/bucket.py +++ b/storage3/_sync/bucket.py @@ -5,7 +5,7 @@ from httpx import HTTPError, Response from ..types import CreateOrUpdateBucketOptions, RequestMethod -from ..utils import SyncClient, StorageException +from ..utils import StorageException, SyncClient from .file_api import SyncBucket __all__ = ["SyncStorageBucketAPI"] diff --git a/storage3/_sync/file_api.py b/storage3/_sync/file_api.py index 2a1c23c6..eaadbcbc 100644 --- a/storage3/_sync/file_api.py +++ b/storage3/_sync/file_api.py @@ -19,7 +19,7 @@ SignedUploadURL, TransformOptions, ) -from ..utils import SyncClient, StorageException +from ..utils import StorageException, SyncClient __all__ = ["SyncBucket"] diff --git a/tests/_sync/test_client.py b/tests/_sync/test_client.py index 5ac6b3fe..f897dcf5 100644 --- a/tests/_sync/test_client.py +++ b/tests/_sync/test_client.py @@ -79,9 +79,7 @@ def bucket(storage: SyncStorageClient, uuid_factory: Callable[[], str]) -> str: @pytest.fixture(scope="module") -def public_bucket( - storage: SyncStorageClient, uuid_factory: Callable[[], str] -) -> str: +def public_bucket(storage: SyncStorageClient, uuid_factory: Callable[[], str]) -> str: """Creates a test public bucket which will be used in the whole storage tests run and deleted at the end""" bucket_id = uuid_factory()