Skip to content

Merge pull request #1735 from wjones127/deprecation-cleanup #92

Merge pull request #1735 from wjones127/deprecation-cleanup

Merge pull request #1735 from wjones127/deprecation-cleanup #92

Workflow file for this run

name: Release to PyPI
on:
push:
tags: ["python-v*"]
defaults:
run:
working-directory: ./python
env:
# For ease of development, we make rustls default. But for release we should
# use native TLS.
FEATURES_FLAG: --no-default-features --features native-tls
jobs:
validate-release-tag:
name: Validate git tag
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: compare git tag with cargo metadata
run: |
PUSHED_TAG=${GITHUB_REF##*/}
CURR_VER=$( grep version Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' )
if [[ "${PUSHED_TAG}" != "python-v${CURR_VER}" ]]; then
echo "Cargo metadata has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}."
exit 1
fi
release-pypi-mac:
needs: validate-release-tag
name: PyPI release on Mac
strategy:
fail-fast: false
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
runs-on: macos-11
steps:
- uses: actions/checkout@v3
# We use extra recent Cargo.toml syntax, so we need at least Rust 1.71.0
- name: Install newer rust
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- name: Publish to pypi (without sdist)
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
target: ${{ matrix.target }}
command: publish
args: -m python/Cargo.toml --no-sdist ${{ env.FEATURES_FLAG }}
release-pypi-mac-universal2:
needs: validate-release-tag
name: PyPI release on Mac universal 2
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Publish to pypi (without sdist)
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
target: ${{ matrix.target }}
command: publish
args: --skip-existing -m python/Cargo.toml --no-sdist --universal2 ${{ env.FEATURES_FLAG }}
release-pypi-windows:
needs: validate-release-tag
name: PyPI release on Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Publish to pypi (without sdist)
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
target: x86_64-pc-windows-msvc
command: publish
args: --skip-existing -m python/Cargo.toml --no-sdist ${{ env.FEATURES_FLAG }}
release-pypi-manylinux:
needs: validate-release-tag
name: PyPI release manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Publish manylinux to pypi x86_64 (with sdist)
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
target: x86_64-unknown-linux-gnu
command: publish
args: --skip-existing -m python/Cargo.toml ${{ env.FEATURES_FLAG }}
# for openssl build
before-script-linux: yum install -y perl-IPC-Cmd
- name: Publish manylinux to pypi aarch64 (without sdist)
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
target: aarch64-unknown-linux-gnu
command: publish
args: --skip-existing -m python/Cargo.toml --no-sdist ${{ env.FEATURES_FLAG }}
release-docs:
needs:
[
validate-release-tag,
release-pypi-manylinux,
release-pypi-mac,
release-pypi-windows,
]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch full history for gh-pages branch checkout
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- name: Build and install deltalake
run: |
make install MATURIN_EXTRA_ARGS="--manylinux off"
- name: Build Sphinx documentation
run: |
make build-documentation
mv docs/build ~/build
echo "Configuring git..."
git config --global user.name 'Github Action'
git config --global user.email 'deltars@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
echo "Commit to gh-pages branch..."
git reset --hard HEAD
git clean -d -fx .
git checkout gh-pages
cd ..
cp -avr ~/build/html/. ./python
PUSHED_TAG=${GITHUB_REF##*/}
git status
git add ./python
git commit -m "doc update for tag `${PUSHED_TAG}`"
git push origin gh-pages