Skip to content

Commit

Permalink
Add github workflow to build sdist and wheels, and publish to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-maarouf committed May 19, 2024
1 parent df7fa1b commit 13149db
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 3 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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
```
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ disallow_any_generics = false

[tool.setuptools]
zip-safe = false
include-package-data = true

[tool.setuptools_scm]

Expand Down

0 comments on commit 13149db

Please # to comment.