From 12e57bdc6a90db3143469cd6e57f33b8317a2e53 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Fri, 16 Aug 2024 11:27:17 +0000 Subject: [PATCH] ci: simplify ci to one file (#492) --- .github/workflows/ci.yml | 90 +++++++------- .github/workflows/tests.yml | 32 ----- poetry.lock | 233 +----------------------------------- pyproject.toml | 15 +-- 4 files changed, 47 insertions(+), 323 deletions(-) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6c75ab..e0a7ddf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,66 +1,64 @@ -name: Release +name: CI/CD on: - workflow_run: - workflows: ["Run Tests"] - branches: [master] - types: [completed] - -permissions: - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing - contents: write # needed for github actions bot to write to repo - pull-requests: write + push: + branches: + - master + pull_request: + workflow_dispatch: jobs: - release-please: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - name: "Bump version, create changelog and publish" - environment: - name: pypi - url: https://pypi.org/p/postgrest + test: + name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: [3.9, '3.10', '3.11', '3.12'] + runs-on: ${{ matrix.os }} steps: - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: 3.11 + - name: Clone Repository + uses: actions/checkout@v4 - - name: Set up Poetry - uses: abatilo/actions-poetry@v3 - with: - poetry-version: 1.8.3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Poetry + uses: abatilo/actions-poetry@v3.0.0 + with: + poetry-version: 1.8.3 + + - name: Run Tests + run: make run_tests + + - name: Upload Coverage + uses: codecov/codecov-action@v4.5.0 + release-please: + needs: test + if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository_owner == 'supabase' }} + runs-on: ubuntu-latest + name: "Bump version and create changelog" + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + contents: write # needed for github actions bot to write to repo + pull-requests: write + steps: - uses: googleapis/release-please-action@v4 id: release with: target-branch: ${{ github.ref_name }} - - - if: ${{ steps.release.outputs }} - id: versions - run: | - set -ex - - MAIN_RELEASE_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} - RELEASE_VERSION="$MAIN_RELEASE_VERSION" - RELEASE_NAME="v$RELEASE_VERSION" - RELEASE_CREATED='${{ steps.release.outputs.release_created }}' - PRS_CREATED='${{ steps.release.outputs.prs_created }}' - PR_TITLE='${{ github.event.workflow_run.head_commit.message }}' - - echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" >> "${GITHUB_OUTPUT}" - echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_OUTPUT}" - echo "RELEASE_CREATED=${RELEASE_CREATED}" >> "${GITHUB_OUTPUT}" - echo "RELEASE_NAME=${RELEASE_NAME}" >> "${GITHUB_OUTPUT}" - echo "PRS_CREATED=${PRS_CREATED}" >> "${GITHUB_OUTPUT}" - echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_OUTPUT}" publish: needs: release-please + if: ${{ startsWith(github.event.head_commit.message, 'chore(master)') && github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository_owner == 'supabase' }} runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_commit.message, 'chore(master)') }} - name: "Bump version, create changelog and publish" + name: "Publish to PyPi" environment: name: pypi url: https://pypi.org/p/postgrest + 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: Set up Python 3.11 uses: actions/setup-python@v5 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 2ffcdb3..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Run Tests - -on: - push: - branches: - - master - pull_request: - workflow_dispatch: - -jobs: - test: - name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: [3.9, '3.10', '3.11', '3.12'] - runs-on: ${{ matrix.os }} - steps: - - name: Clone Repository - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Set up Poetry - uses: abatilo/actions-poetry@v3.0.0 - with: - poetry-version: 1.7.1 - - name: Run Tests - run: make run_tests - - name: Upload Coverage - uses: codecov/codecov-action@v4.5.0 diff --git a/poetry.lock b/poetry.lock index 837731c..0f73e08 100644 --- a/poetry.lock +++ b/poetry.lock @@ -266,25 +266,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} -[[package]] -name = "click-option-group" -version = "0.5.6" -description = "Option groups missing in Click" -optional = false -python-versions = ">=3.6,<4" -files = [ - {file = "click-option-group-0.5.6.tar.gz", hash = "sha256:97d06703873518cc5038509443742b25069a3c7562d1ea72ff08bfadde1ce777"}, - {file = "click_option_group-0.5.6-py3-none-any.whl", hash = "sha256:38a26d963ee3ad93332ddf782f9259c5bdfe405e73408d943ef5e7d0c3767ec7"}, -] - -[package.dependencies] -Click = ">=7.0,<9" - -[package.extras] -docs = ["Pallets-Sphinx-Themes", "m2r2", "sphinx"] -tests = ["pytest"] -tests-cov = ["coverage", "coveralls", "pytest", "pytest-cov"] - [[package]] name = "colorama" version = "0.4.6" @@ -399,17 +380,6 @@ files = [ {file = "docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b"}, ] -[[package]] -name = "dotty-dict" -version = "1.3.1" -description = "Dictionary wrapper for quick access to deeply nested keys." -optional = false -python-versions = ">=3.5,<4.0" -files = [ - {file = "dotty_dict-1.3.1-py3-none-any.whl", hash = "sha256:5022d234d9922f13aa711b4950372a06a6d64cb6d6db9ba43d0ba133ebfce31f"}, - {file = "dotty_dict-1.3.1.tar.gz", hash = "sha256:4b016e03b8ae265539757a53eba24b9bfda506fb94fbce0bee843c6f05541a15"}, -] - [[package]] name = "exceptiongroup" version = "1.2.0" @@ -487,37 +457,6 @@ files = [ [package.extras] rewrite = ["tokenize-rt (>=3)"] -[[package]] -name = "gitdb" -version = "4.0.11" -description = "Git Object Database" -optional = false -python-versions = ">=3.7" -files = [ - {file = "gitdb-4.0.11-py3-none-any.whl", hash = "sha256:81a3407ddd2ee8df444cbacea00e2d038e40150acfa3001696fe0dcf1d3adfa4"}, - {file = "gitdb-4.0.11.tar.gz", hash = "sha256:bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b"}, -] - -[package.dependencies] -smmap = ">=3.0.1,<6" - -[[package]] -name = "gitpython" -version = "3.1.42" -description = "GitPython is a Python library used to interact with Git repositories" -optional = false -python-versions = ">=3.7" -files = [ - {file = "GitPython-3.1.42-py3-none-any.whl", hash = "sha256:1bf9cd7c9e7255f77778ea54359e54ac22a72a5b51288c457c881057b7bb9ecd"}, - {file = "GitPython-3.1.42.tar.gz", hash = "sha256:2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"}, -] - -[package.dependencies] -gitdb = ">=4.0.1,<5" - -[package.extras] -test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest (>=7.3.1)", "pytest-cov", "pytest-instafail", "pytest-mock", "pytest-sugar"] - [[package]] name = "h11" version = "0.14.0" @@ -667,24 +606,6 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.link perf = ["ipython"] testing = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-perf (>=0.9.2)", "pytest-ruff (>=0.2.1)"] -[[package]] -name = "importlib-resources" -version = "6.4.0" -description = "Read resources from Python packages" -optional = false -python-versions = ">=3.8" -files = [ - {file = "importlib_resources-6.4.0-py3-none-any.whl", hash = "sha256:50d10f043df931902d4194ea07ec57960f66a80449ff867bfe782b4c486ba78c"}, - {file = "importlib_resources-6.4.0.tar.gz", hash = "sha256:cdb2b453b8046ca4e3798eb1d84f3cce1446a0e8e7b5ef4efb600f19fc398145"}, -] - -[package.dependencies] -zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["jaraco.test (>=5.4)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"] - [[package]] name = "iniconfig" version = "2.0.0" @@ -727,30 +648,6 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] -[[package]] -name = "markdown-it-py" -version = "3.0.0" -description = "Python port of markdown-it. Markdown parsing, done right!" -optional = false -python-versions = ">=3.8" -files = [ - {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, - {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, -] - -[package.dependencies] -mdurl = ">=0.1,<1.0" - -[package.extras] -benchmarking = ["psutil", "pytest", "pytest-benchmark"] -code-style = ["pre-commit (>=3.0,<4.0)"] -compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] -linkify = ["linkify-it-py (>=1,<3)"] -plugins = ["mdit-py-plugins"] -profiling = ["gprof2dot"] -rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] -testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] - [[package]] name = "markupsafe" version = "2.1.5" @@ -831,17 +728,6 @@ files = [ {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, ] -[[package]] -name = "mdurl" -version = "0.1.2" -description = "Markdown URL utilities" -optional = false -python-versions = ">=3.7" -files = [ - {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, - {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, -] - [[package]] name = "mypy-extensions" version = "1.0.0" @@ -1190,57 +1076,6 @@ future-fstrings = "*" networkx = "*" pytest = ">=3" -[[package]] -name = "python-gitlab" -version = "4.4.0" -description = "A python wrapper for the GitLab API" -optional = false -python-versions = ">=3.8.0" -files = [ - {file = "python-gitlab-4.4.0.tar.gz", hash = "sha256:1d117bf7b433ae8255e5d74e72c660978f50ee85eb62248c9fb52ef43c3e3814"}, - {file = "python_gitlab-4.4.0-py3-none-any.whl", hash = "sha256:cdad39d016f59664cdaad0f878f194c79cb4357630776caa9a92c1da25c8d986"}, -] - -[package.dependencies] -requests = ">=2.25.0" -requests-toolbelt = ">=0.10.1" - -[package.extras] -autocompletion = ["argcomplete (>=1.10.0,<3)"] -yaml = ["PyYaml (>=6.0.1)"] - -[[package]] -name = "python-semantic-release" -version = "9.8.6" -description = "Automatic Semantic Versioning for Python projects" -optional = false -python-versions = ">=3.8" -files = [ - {file = "python_semantic_release-9.8.6-py3-none-any.whl", hash = "sha256:018729c09edbb1d4ad8b08af81bc2a42d002d54e37f87ed4b706fa283636ce3f"}, - {file = "python_semantic_release-9.8.6.tar.gz", hash = "sha256:6e2e4626112bdbf43e86aac4535557e8c0a9274a4ea5352f14623cbabbfe498a"}, -] - -[package.dependencies] -click = ">=8.0,<9.0" -click-option-group = ">=0.5,<1.0" -dotty-dict = ">=1.3,<2.0" -gitpython = ">=3.0,<4.0" -importlib-resources = ">=6.0,<7.0" -jinja2 = ">=3.1,<4.0" -pydantic = ">=2.0,<3.0" -python-gitlab = ">=4.0,<5.0" -requests = ">=2.25,<3.0" -rich = ">=13.0,<14.0" -shellingham = ">=1.5,<2.0" -tomlkit = ">=0.11,<1.0" - -[package.extras] -build = ["build (>=1.2,<2.0)"] -dev = ["pre-commit (>=3.5,<4.0)", "ruff (==0.5.0)", "tox (>=4.11,<5.0)"] -docs = ["Sphinx (>=6.0,<7.0)", "furo (>=2024.1,<2025.0)", "sphinx-autobuild (==2024.2.4)", "sphinxcontrib-apidoc (==0.5.0)"] -mypy = ["mypy (==1.10.1)", "types-requests (>=2.32.0,<2.33.0)"] -test = ["coverage[toml] (>=7.0,<8.0)", "pytest (>=7.0,<8.0)", "pytest-clarity (>=1.0,<2.0)", "pytest-cov (>=5.0,<6.0)", "pytest-env (>=1.0,<2.0)", "pytest-lazy-fixture (>=0.6.3,<0.7.0)", "pytest-mock (>=3.0,<4.0)", "pytest-pretty (>=1.2,<2.0)", "pytest-xdist (>=3.0,<4.0)", "requests-mock (>=1.10,<2.0)", "responses (>=0.25.0,<0.26.0)", "types-pytest-lazy-fixture (>=0.6.3,<0.7.0)"] - [[package]] name = "pytz" version = "2024.1" @@ -1333,39 +1168,6 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] -[[package]] -name = "requests-toolbelt" -version = "1.0.0" -description = "A utility belt for advanced users of python-requests" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -files = [ - {file = "requests-toolbelt-1.0.0.tar.gz", hash = "sha256:7681a0a3d047012b5bdc0ee37d7f8f07ebe76ab08caeccfc3921ce23c88d5bc6"}, - {file = "requests_toolbelt-1.0.0-py2.py3-none-any.whl", hash = "sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06"}, -] - -[package.dependencies] -requests = ">=2.0.1,<3.0.0" - -[[package]] -name = "rich" -version = "13.7.1" -description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -optional = false -python-versions = ">=3.7.0" -files = [ - {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"}, - {file = "rich-13.7.1.tar.gz", hash = "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"}, -] - -[package.dependencies] -markdown-it-py = ">=2.2.0" -pygments = ">=2.13.0,<3.0.0" -typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9\""} - -[package.extras] -jupyter = ["ipywidgets (>=7.5.1,<9)"] - [[package]] name = "setuptools" version = "58.5.3" @@ -1381,28 +1183,6 @@ files = [ docs = ["furo", "jaraco.packaging (>=8.2)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx", "sphinx-inline-tabs", "sphinxcontrib-towncrier"] testing = ["flake8-2020", "jaraco.envs", "jaraco.path (>=3.2.0)", "mock", "paver", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy", "pytest-virtualenv (>=1.2.7)", "pytest-xdist", "sphinx", "virtualenv (>=13.0.0)", "wheel"] -[[package]] -name = "shellingham" -version = "1.5.4" -description = "Tool to Detect Surrounding Shell" -optional = false -python-versions = ">=3.7" -files = [ - {file = "shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"}, - {file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"}, -] - -[[package]] -name = "smmap" -version = "5.0.1" -description = "A pure Python implementation of a sliding window memory map manager" -optional = false -python-versions = ">=3.7" -files = [ - {file = "smmap-5.0.1-py3-none-any.whl", hash = "sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da"}, - {file = "smmap-5.0.1.tar.gz", hash = "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62"}, -] - [[package]] name = "sniffio" version = "1.3.1" @@ -1604,17 +1384,6 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "tomlkit" -version = "0.12.4" -description = "Style preserving TOML library" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomlkit-0.12.4-py3-none-any.whl", hash = "sha256:5cd82d48a3dd89dee1f9d64420aa20ae65cfbd00668d6f094d7578a78efbb77b"}, - {file = "tomlkit-0.12.4.tar.gz", hash = "sha256:7ca1cfc12232806517a8515047ba66a19369e71edf2439d0f5824f91032b6cc3"}, -] - [[package]] name = "typer" version = "0.4.2" @@ -1728,4 +1497,4 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "97167cb510c134502eac2eb0a4ad83c4ce727ec39084ebad328e4e991b246248" +content-hash = "a64b98335456657b18b0c25dad4c4c3650e25f2764ec14aabe6ec0c193826542" diff --git a/pyproject.toml b/pyproject.toml index 7a1dfd9..e08e222 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,8 @@ name = "postgrest" version = "0.16.10" # {x-release-please-version} description = "PostgREST client for Python. This library provides an ORM interface to PostgREST." authors = ["Lương Quang Mạnh ", "Joel Lee ", "Anand", "Oliver Rice", "Andrew Smith "] -homepage = "https://github.com/supabase-community/postgrest-py" -repository = "https://github.com/supabase-community/postgrest-py" +homepage = "https://github.com/supabase/postgrest-py" +repository = "https://github.com/supabase/postgrest-py" documentation = "https://postgrest-py.rtfd.io" readme = "README.md" license = "MIT" @@ -34,7 +34,6 @@ pytest-cov = "^5.0.0" pytest-depends = "^1.0.1" pytest-asyncio = "^0.23.8" unasync-cli = "^0.0.9" -python-semantic-release = "^9.8.6" [tool.poetry.group.docs] optional = true @@ -43,16 +42,6 @@ optional = true sphinx = "^7.1.2" furo = ">=2023.9.10,<2025.0.0" -[tool.semantic_release] -version_variables = ["postgrest/__init__.py:__version__"] -version_toml = ["pyproject.toml:tool.poetry.version"] -major_on_zero = false -commit_message = "chore(release): bump version to v{version}" -build_command = "curl -sSL https://install.python-poetry.org | python - && export PATH=\"/github/home/.local/bin:$PATH\" && poetry install && poetry build" -upload_to_vcs_release = true -branch = "master" -changelog_components = "semantic_release.changelog.changelog_headers,semantic_release.changelog.compare_url" - [tool.pytest.ini_options] asyncio_mode = "auto"