Skip to content

v0.2.2: Bugfixes, better Xarray support #16

v0.2.2: Bugfixes, better Xarray support

v0.2.2: Bugfixes, better Xarray support #16

Workflow file for this run

# Taken from Xee and modified: https://github.com/google/Xee/blob/main/.github/workflows/publish.yml
# Rust/maturin release adapted from https://github.com/apache/datafusion-python/blob/main/.github/workflows/build.yml
#
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Copyright 2022 Apache Software Foundation
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: Publish to PyPi
on:
release:
types: [published]
workflow_dispatch:
jobs:
build-artifacts-mac-win:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, macos-15-intel, windows-latest ]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Configure sccache
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Build wheels
run: |
uv sync --dev --no-install-package xarray-sql
uv run --no-project maturin build --release --strip
- uses: actions/upload-artifact@v6
with:
name: dist-${{ matrix.os }}
path: target/wheels/*
build-artifacts-manylinux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build wheels for manylinux x86_64
uses: PyO3/maturin-action@v1
env:
RUST_BACKTRACE: 1
with:
rust-toolchain: stable
target: x86_64-unknown-linux-gnu
manylinux: 2_28
rustup-components: rust-std rustfmt
sccache: 'true'
args: --release --strip --out dist -i python3.10 python3.11 python3.12 python3.13
- uses: actions/upload-artifact@v6
with:
name: dist-manylinux-x86_64
path: dist/*
build-artifacts-manylinux-arm64:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
- name: Build wheels for manylinux arm64
uses: PyO3/maturin-action@v1
env:
RUST_BACKTRACE: 1
with:
rust-toolchain: stable
target: aarch64-unknown-linux-gnu
manylinux: 2_28
rustup-components: rust-std rustfmt
sccache: 'true'
args: --release --strip --out dist -i python3.10 python3.11 python3.12 python3.13
- uses: actions/upload-artifact@v6
with:
name: dist-manylinux-aarch64
path: dist/*
build-sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
rust-toolchain: stable
manylinux: auto
rustup-components: rust-std rustfmt
args: --release --sdist --out dist
- name: Assert sdist build does not generate wheels
run: |
if [ -d "target/wheels" ] && [ "$(ls -A target/wheels)" ]; then
echo "Error: Sdist build generated wheels"
exit 1
else
echo "Directory is clean"
fi
- uses: actions/upload-artifact@v6
with:
name: dist-sdist
path: dist/*
merge-build-artifacts:
runs-on: ubuntu-latest
needs:
- build-artifacts-mac-win
- build-artifacts-manylinux-x86_64
- build-artifacts-manylinux-arm64
- build-sdist
steps:
- name: Merge Build Artifacts
uses: actions/upload-artifact/merge@v6
with:
name: dist
pattern: dist-*
verify-built-dist:
needs: merge-build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
name: dist
path: dist
- name: List contents of built dist
run: |
ls -ltrh
ls -ltrh dist
- name: Publish package to TestPyPI
if: github.event_name == 'push'
run: uv publish --token ${{ secrets.TESTPYPI_TOKEN }} --username __token__
- name: Check uploaded package
if: github.event_name == 'push'
run: |
sleep 3
uv pip install --extra-index-url https://test.pypi.org/simple --upgrade de
python -c "import xarray_sql; print(xarray_sql.__version__)"
upload-to-pypi:
needs: verify-built-dist
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
name: dist
path: dist
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Publish package to PyPI
run: uv publish --token ${{ secrets.PYPI_TOKEN }}