fix: sdist publish specific (#608) #346
Workflow file for this run
This file contains hidden or 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: Publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} for Python ${{matrix.python-version}}. | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macOS-latest] # TODO: add windows-2019, | |
| python-version: ["39", "310", "311", "312", "313"] | |
| env: | |
| CIBW_SKIP: "cp36-* pp* *-win32" | |
| CIBW_ARCHS_MACOS: x86_64 universal2 arm64 | |
| CIBW_ARCHS_LINUX: auto aarch64 | |
| CIBW_BEFORE_ALL_LINUX: "{package}/tools/cibw_before_all_linux.sh" | |
| CIBW_BUILD_VERBOSITY: 1 | |
| MACOSX_DEPLOYMENT_TARGET: 10.13 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| ~/.cargo/.crates.toml | |
| ~/.cargo/.crates2.json | |
| target/ | |
| key: ${{ matrix.os }}-cargo-${{matrix.python-version}}-${{ hashFiles('**/Cargo.lock') }} | |
| # Used to host cibuildwheel | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - if: runner.os == 'macOS' | |
| name: Install rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| targets: aarch64-apple-darwin, x86_64-apple-darwin | |
| toolchain: stable | |
| - if: runner.os != 'Linux' | |
| name: Setup env when not using docker | |
| run: | | |
| python -m pip install --upgrade build wheel setuptools setuptools-rust | |
| - if: runner.os == 'Linux' | |
| name: Set up QEMU | |
| id: qemu | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| image: tonistiigi/binfmt:latest | |
| platforms: arm64 | |
| - name: Build wheels for ${{matrix.python-version}} on ${{matrix.os}} | |
| uses: pypa/cibuildwheel@v2.22.0 | |
| env: | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
| CIBW_BUILD: "cp${{matrix.python-version}}-manylinux_x86_64 cp${{matrix.python-version}}-macosx_x86_64 cp${{matrix.python-version}}-macosx_universal2 cp${{matrix.python-version}}-macosx_arm64" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel-${{matrix.python-version}}-${{matrix.os}} | |
| path: ./wheelhouse/*.whl | |
| overwrite: true | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| name: Install Python | |
| with: | |
| python-version: "3.13" | |
| - name: Install setuptools and setuptools-rust | |
| run: | | |
| python -m pip install --upgrade build wheel setuptools setuptools-rust | |
| - name: Build wheel | |
| run: make build-sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel | |
| path: dist/*.tar.gz | |
| build_cc_wheels: | |
| name: Cross Build wheels for ${{ matrix.platform.name }} | |
| runs-on: ubuntu-latest | |
| env: | |
| CARGO: cross | |
| strategy: | |
| matrix: | |
| platform: | |
| [ | |
| { name: "linux_armv7l", target: "armv7-unknown-linux-gnueabihf" }, | |
| { name: "linux_armv6l", target: "arm-unknown-linux-gnueabihf" }, | |
| { | |
| name: "manylinux2014_aarch64", | |
| target: "aarch64-unknown-linux-gnu", | |
| }, | |
| ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| ~/.cargo/.crates.toml | |
| ~/.cargo/.crates2.json | |
| target/ | |
| key: ${{ matrix.platform.target }}-cargo-${{ matrix.platform.name }}-${{ hashFiles('**/Cargo.lock') }} | |
| - uses: actions/setup-python@v5 | |
| name: Install Python | |
| with: | |
| python-version: "3.13" | |
| - name: Install Rust ${{ matrix.platform.target }} | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| toolchain: stable | |
| - name: Install cross | |
| run: | | |
| cargo install cross --git https://github.com/fraidev/cross | |
| - name: Install setuptools and setuptools-rust | |
| run: | | |
| python -m pip install --upgrade build wheel setuptools setuptools-rust | |
| - name: Build cross image | |
| run: | | |
| docker build -f cross/Dockerfile.${{ matrix.platform.target }} -t fluvio-cross-python:${{ matrix.platform.target }} cross | |
| - name: Build wheel | |
| env: | |
| CARGO_BUILD_TARGET: ${{ matrix.platform.target }} | |
| CARGO_BUILD_TARGET_ARCH: ${{ matrix.platform.target }} | |
| PYO3_CROSS: 1 | |
| PYO3_CROSS_PYTHON_VERSION: 3.8 | |
| run: | | |
| python -m build \ | |
| --wheel \ | |
| --no-isolation \ | |
| -C--build-option=--py-limited-api=cp38 \ | |
| -C--build-option=--plat-name=${{ matrix.platform.name }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: dist/*.tar.gz | |
| overwrite: true | |
| upload_pypi: | |
| needs: [build_wheels, build_sdist, build_cc_wheels] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| # Wheel | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "wheel-*" | |
| path: dist | |
| merge-multiple: true | |
| # Sdist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*.tar.gz" | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_ACCESS_TOKEN }} | |
| skip_existing: true | |
| build_docs: | |
| name: build static docs | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ["3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
| fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Build docs | |
| run: | | |
| make docs-build | |
| touch docs/.nojekyll | |
| echo "FLUVIO_PYTHON_CLIENT_VERSION=$( | |
| venv/bin/python -c 'import pathlib, tomllib, sys; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])' | |
| )" >> "$GITHUB_ENV" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs | |
| path: docs | |
| publish_docs_to_pages: | |
| needs: [build_docs] | |
| name: push static docs | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| permissions: | |
| contents: write # 'write' access to repository contents | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
| fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: docs | |
| path: docs-latest | |
| - name: "Git Fetch & Checkout" | |
| run: | | |
| git config --local user.email "team@fluvio.io" | |
| git config --local user.name "Fluvio Authors" | |
| git fetch --all | |
| git checkout -b docs --track origin/docs | |
| git merge -X theirs origin/main -m "Merge remote-tracking branch 'origin/main into docs" --allow-unrelated-histories | |
| - name: Commit files | |
| run: | | |
| git add --force docs | |
| git commit -m "Updated Fluvio Python client docs" -a || true | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: docs |