-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github workflow to build sdist and wheels, and publish to PyPI
- Loading branch information
1 parent
df7fa1b
commit 13149db
Showing
4 changed files
with
111 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters