taos-connector-python merge main to 3.0 and modify stmt2_get_fields interface #720
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
name: taos-ws-py | |
on: | |
push: | |
branches: | |
- main | |
- '3.0' | |
tags: | |
- taos-ws-py-v* | |
pull_request: | |
branches: | |
- main | |
- '3.0' | |
env: | |
PYTHON_VERSION: "3.10" # to build abi3 wheels | |
jobs: | |
rebuild: | |
runs-on: ubuntu-latest | |
outputs: | |
status: ${{ steps.output.outputs.rebuild }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if file changes would trigger a rebuild | |
if: "!startsWith(github.ref, 'refs/tags/taos-ws-py')" | |
id: rebuild | |
uses: tj-actions/changed-files@v41 | |
with: | |
files: | | |
.github/workflows/taos-ws-py.yml | |
taos-ws-py/** | |
- name: Set Github Output | |
if: "!startsWith(github.ref, 'refs/tags/taos-ws-py')" | |
run: | | |
echo "rebuild=${{ steps.rebuild.outputs.any_changed }}" >> $GITHUB_ENV | |
- name: Set Github Output | |
if: "startsWith(github.ref, 'refs/tags/taos-ws-py')" | |
run: | | |
echo "rebuild=true" >> $GITHUB_ENV | |
- id: output | |
run: echo "rebuild=${{ env.rebuild }}" >> $GITHUB_OUTPUT | |
macos: | |
runs-on: macos-latest | |
needs: rebuild | |
if: needs.rebuild.outputs.status == 'true' | |
strategy: | |
matrix: | |
target: [x86_64] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
architecture: x64 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Build wheels - x86_64 | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: x86_64 | |
working-directory: taos-ws-py | |
args: --release --strip | |
- name: Install Homebrew | |
run: | | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
- name: Install gettext | |
run: | | |
brew install gettext | |
- name: Set DYLD_LIBRARY_PATH | |
run: | | |
echo "export DYLD_LIBRARY_PATH=/usr/local/opt/gettext/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV | |
- name: Install built wheel - x86_64 | |
run: | | |
pip install taos-ws-py --no-index --force-reinstall --find-links taos-ws-py/target/wheels | |
- name: Build wheels - universal2 | |
uses: PyO3/maturin-action@v1 | |
with: | |
working-directory: taos-ws-py | |
args: --release --strip --target universal2-apple-darwin | |
- name: Install built wheel - universal2 | |
run: | | |
pip install taos-ws-py --no-index --force-reinstall --find-links taos-ws-py/target/wheels | |
- name: Upload wheels x86_64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: taos-ws-py | |
path: taos-ws-py/target/wheels/** | |
windows: | |
runs-on: windows-latest | |
needs: rebuild | |
if: needs.rebuild.outputs.status == 'true' | |
strategy: | |
matrix: | |
target: [x64] #, x86 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
architecture: ${{ matrix.target }} | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
working-directory: taos-ws-py | |
args: --release --strip | |
- name: Install built wheel | |
run: | | |
pip install taos-ws-py --no-index --force-reinstall --find-links .\taos-ws-py\target\wheels | |
- name: Upload wheels windows | |
uses: actions/upload-artifact@v4 | |
with: | |
name: taos-ws-py-windows | |
path: taos-ws-py/target/wheels/** | |
linux: | |
runs-on: ubuntu-latest | |
needs: rebuild | |
if: needs.rebuild.outputs.status == 'true' | |
strategy: | |
matrix: | |
target: [x86_64] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
architecture: x64 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
rust-toolchain: stable | |
target: ${{ matrix.target }} | |
working-directory: taos-ws-py | |
manylinux: auto | |
args: --release --strip | |
- name: Install built wheel | |
run: | | |
pip install taos-ws-py --no-index --force-reinstall --find-links taos-ws-py/target/wheels | |
- name: Upload wheels linux | |
uses: actions/upload-artifact@v4 | |
with: | |
name: taos-ws-py | |
path: taos-ws-py/target/wheels/** | |
linux-cross: | |
runs-on: ubuntu-latest | |
needs: rebuild | |
if: needs.rebuild.outputs.status == 'true' | |
env: | |
#error "ARM assembler must define __ARM_ARCH" | |
CFLAGS: "-fno-builtin" | |
strategy: | |
matrix: | |
target: [aarch64, armv7] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- run: sudo apt-get install -y libc6-dev | |
- name: Build wheels | |
uses: messense/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
rust-toolchain: stable | |
working-directory: taos-ws-py | |
docker-options: -e "CFLAGS_aarch64_unknown_linux_gnu=-D__ARM_ARCH=8" -e "CFLAGS_armv7_unknown_linux_gnueabihf=-D__ARM_ARCH=7" | |
manylinux: auto | |
args: --release --strip | |
before-script-linux: | | |
apt-get install -y libc6-dev libc6-dev-arm64-cross libc6-dev-armhf-cross libc6-dev-armel-cross | |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-lang/rust-bindgen/releases/download/v0.69.5/bindgen-cli-installer.sh | sh | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Install built wheel | |
with: | |
arch: ${{ matrix.target }} | |
distro: ubuntu20.04 | |
githubToken: ${{ github.token }} | |
install: | | |
apt-get update | |
apt-get install -y --no-install-recommends python3 python3-pip | |
pip3 install -U pip | |
run: | | |
pip3 install taos-ws-py --no-index --find-links taos-ws-py/target/wheels/ --force-reinstall | |
- name: Upload wheels linux-cross | |
uses: actions/upload-artifact@v4 | |
with: | |
name: taos-ws-py-cross | |
path: taos-ws-py/target/wheels/** | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/taos-ws-py')" | |
needs: [macos, windows, linux, linux-cross] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: taos-ws-py | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Publish to PyPI | |
env: | |
MATURIN_USERNAME: ${{ secrets.MATURIN_USERNAME }} | |
MATURIN_PASSWORD: ${{ secrets.MATURIN_PASSWORD }} | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: upload | |
args: --skip-existing * |