diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..5a8d8b7 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,101 @@ +name: PyPI deploy + +on: + release: + types: [created] + +permissions: + contents: read + +jobs: + build-sdist: + name: Build source distribution + runs-on: ubuntu-latest + environment: + name: release + + env: + PIP_DISABLE_PIP_VERSION_CHECK: 1 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build . --sdist + - name: Upload source distribution + uses: actions/upload-artifact@v4 + with: + name: sdist + path: ./dist/*.tar.gz + + build-wheels: + name: Build ${{ matrix.os }}-${{ matrix.arch }} wheels + runs-on: ${{ matrix.os }} + environment: + name: release + + continue-on-error: true + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + env: + PIP_DISABLE_PIP_VERSION_CHECK: 1 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v3 + with: + platforms: all + - name: Build wheels + uses: pypa/cibuildwheel@v2.18.0 + env: + CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8" + CIBW_PRERELEASE_PYTHONS: "false" + CIBW_BUILD_FRONTEND: "build" + CIBW_BUILD_VERBOSITY: "1" + CIBW_ARCHS_LINUX: x86_64 aarch64 + CIBW_ARCHS_MACOS: x86_64 arm64 + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-for-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + publish-pypi: + name: Publish wheels to PyPI + needs: [build-sdist, build-wheels] + runs-on: ubuntu-latest + environment: + name: release + url: https://pypi.org/p/psqlparse2 + permissions: + id-token: write + + steps: + - name: Download wheels + uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist diff --git a/MANIFEST.in b/MANIFEST.in index 281496a..9a64466 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,8 @@ global-include *.pxd *.pyx *.pyi py.typed -exclude src/pg_query/*.py +recursive-exclude src *.c *.h +include Makefile LICENSE +graft libpg_query +graft tests +prune env +prune .github +prune .devcontainer diff --git a/README.md b/README.md index d150170..b461bec 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![PyPI deploy](https://github.com/dani-maarouf/psqlparse2/actions/workflows/workflow.yml/badge.svg)](https://github.com/dani-maarouf/psqlparse2/actions/workflows/workflow.yml) + # psqlparse2 Python wrapper for [libpg_query](https://github.com/pganalyze/libpg_query). @@ -20,5 +22,5 @@ and then manipulate the parse tree before converting it back into a SQL string. ## Installation ```bash -pip install 'psqlparse2 @ git+https://github.com/dani-maarouf/psqlparse2.git@v0.0.3' +pip install psqlparse2 ``` diff --git a/pyproject.toml b/pyproject.toml index 132e895..2550f98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,6 @@ disallow_any_generics = false [tool.setuptools] zip-safe = false -include-package-data = true [tool.setuptools_scm]