docs: Update projects #54
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/ta-lib/ta-lib-python/blob/v0.7.1/.github/workflows/wheels.yml | |
| name: Build ta-lib wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version glob to (re)build; empty builds every version of docs/packages/ta-lib.yaml not released yet' | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-ta-lib.yml' | |
| - 'docs/packages/ta-lib.yaml' | |
| - 'patches/ta-lib/**' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-ta-lib.yml' | |
| - 'docs/packages/ta-lib.yaml' | |
| - 'patches/ta-lib/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| with: | |
| package: ta-lib | |
| version: ${{ inputs.version }} | |
| build_wheels: | |
| needs: [setup] | |
| if: needs.setup.outputs.versions != '[]' | |
| name: Build ta-lib ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| # Upstream's own CIBW_SKIP excludes cp313t/cp314t; the extension | |
| # isn't declared free-threading safe. | |
| python: ["cp312", "cp313", "cp314"] | |
| env: | |
| TA_LIB_VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout ta-lib-python v${{ env.TA_LIB_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: ta-lib/ta-lib-python | |
| ref: v${{ env.TA_LIB_VERSION }} | |
| persist-credentials: false | |
| - name: Checkout python-wheels | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| path: python-wheels | |
| persist-credentials: false | |
| - name: Patch ta-lib-python source | |
| run: git apply python-wheels/patches/ta-lib/${{ env.TA_LIB_VERSION }}/*.patch | |
| # The TA-Lib C library version tracked by each ta-lib-python release | |
| # changes independently of TA_LIB_VERSION (0.8.0 needs C 0.8.1, not | |
| # 0.7.1); read it straight from upstream's own workflow at this tag. | |
| - name: Determine the TA-Lib C library version this release needs | |
| run: | | |
| talib_c_ver="$(sed -n 's/^ TALIB_C_VER: *//p' .github/workflows/wheels.yml)" | |
| test -n "$talib_c_ver" | |
| echo "TALIB_C_VER=${talib_c_ver}" >> "$GITHUB_ENV" | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| output-dir: wheelhouse/ | |
| only: ${{ matrix.python }}-manylinux_riscv64 | |
| env: | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| CIBW_ENVIRONMENT_PASS_LINUX: TALIB_C_VER CFLAGS | |
| CFLAGS: -D_GNU_SOURCE | |
| CIBW_BEFORE_ALL_LINUX: | | |
| curl -fsSL -o talib-$TALIB_C_VER.tar.gz https://github.com/TA-Lib/ta-lib/archive/refs/tags/v$TALIB_C_VER.tar.gz | |
| mkdir -p ta-lib-$TALIB_C_VER | |
| tar xzf talib-$TALIB_C_VER.tar.gz --strip-components=1 -C ta-lib-$TALIB_C_VER | |
| cd ta-lib-$TALIB_C_VER | |
| mkdir -p include/ta-lib/ | |
| cp include/*.h include/ta-lib/ | |
| cmake -S . -B _build -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/project/ta-lib-install | |
| cmake --build _build -j"$(nproc)" | |
| cmake --install _build | |
| cp LICENSE /project/LICENSE.ta-lib-c | |
| CIBW_ENVIRONMENT_LINUX: >- | |
| TA_LIBRARY_PATH=/project/ta-lib-install/lib | |
| TA_INCLUDE_PATH=/project/ta-lib-install/include | |
| PIP_NO_BUILD_ISOLATION=false | |
| PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | |
| PIP_ONLY_BINARY=numpy,pandas | |
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: | | |
| LD_LIBRARY_PATH="/project/ta-lib-install/lib:$LD_LIBRARY_PATH" auditwheel repair -w {dest_dir} {wheel} | |
| CIBW_BUILD_FRONTEND: build | |
| # polars now has a riscv64 wheel on the registry; added so | |
| # test_stream.py::test_a_result_pickles' inline `import polars` | |
| # doesn't ModuleNotFoundError. test_polars.py itself stays | |
| # ignored below (untouched, out of scope for this fix). | |
| CIBW_TEST_REQUIRES: pytest pandas polars | |
| CIBW_TEST_COMMAND: >- | |
| cd .. && | |
| pytest -k "not RSI and not threading" --ignore={project}/tests/test_polars.py {project}/tests | |
| - name: Check the wheel ships the extension and both licences | |
| run: | | |
| python3 - wheelhouse/*.whl <<'EOF' | |
| import sys, zipfile | |
| for whl in sys.argv[1:]: | |
| names = zipfile.ZipFile(whl).namelist() | |
| assert any(n.startswith("talib/") and n.endswith(".so") for n in names), whl | |
| licences = {n.rsplit("/", 1)[1] for n in names if ".dist-info/licenses/" in n} - {""} | |
| assert licences == {"LICENSE", "LICENSE.ta-lib-c"}, (whl, licences) | |
| print(whl, "ok") | |
| EOF | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ta-lib-${{ env.TA_LIB_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish ta-lib ${{ matrix.version }} | |
| needs: [setup, build_wheels] | |
| if: needs.setup.outputs.versions != '[]' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| uses: $/.github/workflows/_publish-wheel.yml | |
| secrets: | |
| app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} | |
| with: | |
| artifact-pattern: ta-lib-${{ matrix.version }}-*-manylinux_riscv64 |