Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Publish to PyPI

on:
push:
tags:
- 'v*' # Triggers on version tags like v0.1.8, v1.0.0, etc.
workflow_dispatch: # Allow manual triggering

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
pip install cibuildwheel

- name: Build wheels
run: cibuildwheel --platform ${{ matrix.os == 'ubuntu-latest' && 'linux' || matrix.os == 'windows-latest' && 'windows' || 'macos' }}
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
CIBW_BEFORE_BUILD: pip install maturin
CIBW_BUILD_COMMAND: maturin build --release --interpreter {python}

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install maturin
run: |
python -m pip install --upgrade pip
pip install maturin

- name: Build sdist
run: maturin sdist

- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
environment: pypi # This requires you to set up a PyPI environment in GitHub

steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
name: wheels-ubuntu-latest
path: dist

- name: Download wheels (Windows)
uses: actions/download-artifact@v4
with:
name: wheels-windows-latest
path: dist

- name: Download wheels (macOS)
uses: actions/download-artifact@v4
with:
name: wheels-macos-latest
path: dist

- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist

- name: Install twine
run: |
python -m pip install --upgrade pip
pip install twine

- name: Check distributions
run: twine check dist/*

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Drainage helps you understand and optimize your data lake by identifying issues
pip install drainage
```

> **Note**: This package is automatically built and published to PyPI using GitHub Actions when version tags are pushed.

### From Source

```bash
Expand Down Expand Up @@ -862,6 +864,20 @@ Typical analysis times:
- [ ] CloudWatch/Datadog integration
- [ ] Table comparison and diff

## Releasing

To release a new version:

1. Update the version in `pyproject.toml` and `Cargo.toml`
2. Commit and push changes
3. Create and push a version tag:
```bash
git tag -a v0.1.8 -m "Release v0.1.8"
git push origin main
git push origin v0.1.8
```
4. GitHub Actions will automatically build and publish to PyPI

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
Expand Down