docs: Update projects #75
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
| # SPDX-FileCopyrightText: 2026 The RISE Project | |
| # SPDX-License-Identifier: MIT | |
| # | |
| # This workflow is based on: https://github.com/pola-rs/polars/blob/main/.github/workflows/release-python.yml | |
| name: Build polars-runtime wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version glob to (re)build; empty builds every version of docs/packages/polars-runtime-{32,64}.yaml not released yet' | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-polars-runtime.yml' | |
| - 'docs/packages/polars-runtime-32.yaml' | |
| - 'docs/packages/polars-runtime-64.yaml' | |
| - '.github/workflows/test-polars-runtime.yml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-polars-runtime.yml' | |
| - 'docs/packages/polars-runtime-32.yaml' | |
| - 'docs/packages/polars-runtime-64.yaml' | |
| - '.github/workflows/test-polars-runtime.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| PYTHON_VERSION: '3.12' | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| RUSTUP_MAX_RETRIES: 10 | |
| # `--profile dist-release` (see "Build wheel" below) inherits fat LTO + | |
| # codegen-units=1 from py-polars' Cargo.toml. Overriding it here keeps the | |
| # dist-release profile name/other settings intact without patching | |
| # Cargo.toml. | |
| CARGO_PROFILE_DIST_RELEASE_LTO: 'off' | |
| CARGO_PROFILE_DIST_RELEASE_CODEGEN_UNITS: '16' | |
| CARGO_PROFILE_DIST_RELEASE_OPT_LEVEL: '1' | |
| # Limit the number of build jobs to help avoid resource exhaustion. This may | |
| # need to be adjusted if the runners change. | |
| CARGO_BUILD_JOBS: '2' | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| # Both runtimes come out of one checkout, but each is its own package with | |
| # its own docs/packages/<package>.yaml, and the nightly declares a new | |
| # version in one at a time -- so resolve, build and publish them separately. | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| with: | |
| package: polars-runtime-32 | |
| version: ${{ inputs.version }} | |
| setup-64: | |
| uses: $/.github/workflows/_setup.yml | |
| with: | |
| package: polars-runtime-64 | |
| version: ${{ inputs.version }} | |
| plan: | |
| needs: [setup, setup-64] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| # [{"package": ..., "version": ...}, ...], one entry per wheel to build. | |
| builds: ${{ steps.plan.outputs.builds }} | |
| # The versions those wheels need a base package built from. | |
| versions: ${{ steps.plan.outputs.versions }} | |
| steps: | |
| - id: plan | |
| env: | |
| VERSIONS_32: ${{ needs.setup.outputs.versions || '[]' }} | |
| VERSIONS_64: ${{ needs.setup-64.outputs.versions || '[]' }} | |
| run: | | |
| set -euo pipefail | |
| builds=$(jq -cn --argjson v32 "$VERSIONS_32" --argjson v64 "$VERSIONS_64" \ | |
| '[$v32[] | {package: "polars-runtime-32", version: .}] | |
| + [$v64[] | {package: "polars-runtime-64", version: .}]') | |
| versions=$(jq -cn --argjson v32 "$VERSIONS_32" --argjson v64 "$VERSIONS_64" \ | |
| '$v32 + $v64 | unique') | |
| echo "builds=$builds" >> "$GITHUB_OUTPUT" | |
| echo "versions=$versions" >> "$GITHUB_OUTPUT" | |
| echo "Wheels to build: $builds" | |
| base-package: | |
| needs: [plan] | |
| if: needs.plan.outputs.versions != '[]' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.plan.outputs.versions) }} | |
| env: | |
| POLARS_VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout polars py-${{ env.POLARS_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: pola-rs/polars | |
| ref: py-${{ env.POLARS_VERSION }} | |
| persist-credentials: false | |
| - name: Install Python | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| activate-environment: true | |
| enable-cache: false | |
| - name: Install yq | |
| run: uv pip install yq | |
| - name: Check runtime versions | |
| env: | |
| POLARS_PYPROJECT_TOML: py-polars/pyproject.toml | |
| run: | | |
| set -e | |
| VERSION=$(tomlq '.project.version' "$POLARS_PYPROJECT_TOML" | tr -d '"') | |
| CARGO_32_VERSION=$(tomlq '.package.version' py-polars/runtime/polars-runtime-32/Cargo.toml | tr -d '"') | |
| CARGO_64_VERSION=$(tomlq '.package.version' py-polars/runtime/polars-runtime-64/Cargo.toml | tr -d '"') | |
| RT32_VERSION=($(tomlq '.project.dependencies[0]' "$POLARS_PYPROJECT_TOML" | tr -d '"')) | |
| RT64_VERSION=($(tomlq '.project."optional-dependencies".rt64[0]' "$POLARS_PYPROJECT_TOML" | tr -d '"')) | |
| [[ "$VERSION" == "$(echo $CARGO_32_VERSION | sed 's/-beta\./b/')" ]] || (echo "Incorrect cargo 32 version" && exit 1) | |
| [[ "$VERSION" == "$(echo $CARGO_64_VERSION | sed 's/-beta\./b/')" ]] || (echo "Incorrect cargo 64 version" && exit 1) | |
| [[ "$VERSION" == "${RT32_VERSION[2]}" ]] || (echo "Incorrect rt32 version" && exit 1) | |
| [[ "$VERSION" == "${RT64_VERSION[2]}" ]] || (echo "Incorrect rt64 version" && exit 1) | |
| - name: Build sdist and wheel | |
| run: uv build py-polars --out-dir dist | |
| - name: Upload base package | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: polars-${{ env.POLARS_VERSION }}-base | |
| path: dist | |
| build_wheels: | |
| needs: [plan, base-package] | |
| if: needs.plan.outputs.builds != '[]' | |
| name: Build ${{ matrix.build.package }} ${{ matrix.build.version }} ${{ matrix.job_config }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build: ${{ fromJSON(needs.plan.outputs.builds) }} | |
| job_config: [linux-riscv64] | |
| include: | |
| - job_config: linux-riscv64 | |
| os: ubuntu-24.04-riscv | |
| architecture: riscv64 | |
| target: riscv64gc-unknown-linux-gnu | |
| env: | |
| POLARS_VERSION: ${{ matrix.build.version }} | |
| steps: | |
| # Checked out at the workspace root: the runtime crate is a member of | |
| # the polars Cargo workspace and needs its sibling crates present. | |
| - name: Checkout polars py-${{ env.POLARS_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: pola-rs/polars | |
| ref: py-${{ env.POLARS_VERSION }} | |
| persist-credentials: false | |
| - name: Free some disk space (remove unused packages) | |
| uses: jlumbroso/free-disk-space@v1.3.1 | |
| if: ${{ runner.os == 'Linux' }} | |
| # Avoid potential out-of-memory errors | |
| - name: Set swap space for Linux | |
| if: runner.os == 'Linux' | |
| uses: pierotofy/set-swap-space@master | |
| with: | |
| swap-size-gb: 10 | |
| - name: Download base package | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: polars-${{ env.POLARS_VERSION }}-base | |
| path: dist | |
| merge-multiple: true | |
| - name: Install Python | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| activate-environment: true | |
| enable-cache: false | |
| - name: Install yq | |
| run: | | |
| uv pip install --force-reinstall --no-deps dist/polars-*.whl | |
| rm -rf dist/* | |
| uv pip install yq | |
| # The manylinux riscv64 support relied on below needs a maturin-action | |
| # newer than the `v1` tag upstream pins, and there's no `manylinux: auto` | |
| # mapping for riscv64 yet either - both pinned explicitly here. Left | |
| # `maturin-version` unset (upstream pins 1.8.3): unverified against the | |
| # newer action/riscv64 combination, so deferring to the action's default. | |
| - name: Build wheel | |
| uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 | |
| with: | |
| command: build | |
| target: ${{ matrix.target }} | |
| args: > | |
| --profile dist-release | |
| --manifest-path py-polars/runtime/${{ matrix.build.package }}/Cargo.toml | |
| --out dist | |
| manylinux: '2_39' | |
| before-script-linux: git config --global --add safe.directory "*" | |
| - name: Test wheel | |
| run: | | |
| uv pip install --force-reinstall --verbose dist/*.whl | |
| python -c 'import polars; polars.show_versions()' | |
| - name: Upload wheel | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ${{ matrix.build.package }}-${{ env.POLARS_VERSION }}-${{ matrix.job_config }} | |
| path: dist/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish ${{ matrix.build.package }} ${{ matrix.build.version }} | |
| needs: [plan, build_wheels] | |
| if: needs.plan.outputs.builds != '[]' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| uses: $/.github/workflows/_publish-wheel.yml | |
| secrets: | |
| app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build: ${{ fromJSON(needs.plan.outputs.builds) }} | |
| with: | |
| artifact-pattern: ${{ matrix.build.package }}-${{ matrix.build.version }}-* |