From 5d2cca708537fc4e1f900cd351c070c9d516835a Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 12 Sep 2026 08:35:31 +0200 Subject: [PATCH] hogql-parser-rs: add build-hogql-parser-rs.yml for riscv64 wheels --- .github/workflows/build-hogql-parser-rs.yml | 91 +++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/build-hogql-parser-rs.yml diff --git a/.github/workflows/build-hogql-parser-rs.yml b/.github/workflows/build-hogql-parser-rs.yml new file mode 100644 index 00000000000..f7b2f19a4d3 --- /dev/null +++ b/.github/workflows/build-hogql-parser-rs.yml @@ -0,0 +1,91 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/PostHog/posthog/blob/master/.github/workflows/build-hogql-parser-rs.yml +name: Build hogql-parser-rs wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'hogql-parser-rs version to build (posthog monorepo version, e.g. 1.3.109)' + required: true + default: '1.3.109' + pull_request: + paths: + - '.github/workflows/build-hogql-parser-rs.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '1.3.109' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # `inputs.version` is empty on pull_request events; default to 1.3.109 there. + HOGQL_PARSER_RS_VERSION: ${{ inputs.version || '1.3.109' }} + # PostHog/posthog never tags this crate; pin the commit that bumped + # Cargo.toml/pyproject.toml to 1.3.109 (matches the PyPI sdist, and current + # master). Update alongside HOGQL_PARSER_RS_VERSION. + HOGQL_PARSER_RS_REF: c30d2736928729ea424b08003c9cea2006b7606b + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build hogql-parser-rs ${{ inputs.version || '1.3.109' }} cp312-abi3-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 60 + + steps: + # The crate lives at rust/hogql/parser inside an ~80-member Cargo + # workspace (rust/Cargo.toml); sparse-checkout skips the rest of the + # multi-GB posthog monorepo (Django app, frontend, ...). + - name: Checkout posthog rust/ workspace + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: PostHog/posthog + ref: ${{ env.HOGQL_PARSER_RS_REF }} + sparse-checkout: rust + persist-credentials: false + + - name: Build wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + package-dir: rust/hogql/parser + output-dir: wheelhouse/ + # pyo3 carries abi3-py312 unconditionally, so one cp312-abi3 wheel + # covers every interpreter, matching upstream's own PyPI wheels. + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + only: cp312-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_BEFORE_ALL_LINUX: >- + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" + CIBW_TEST_COMMAND: >- + python -c "import hogql_parser_rs as m; + assert m.hogql_parser_rs.__file__.endswith('.so'), m.hogql_parser_rs.__file__; + import json; + r = json.loads(m.parse_expr_json('1 + 2')); + assert r.get('error') is not True, r" + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: hogql-parser-rs-${{ env.HOGQL_PARSER_RS_VERSION }}-cp312-abi3-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish hogql-parser-rs ${{ inputs.version || '1.3.109' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: hogql-parser-rs-${{ inputs.version || '1.3.109' }}-*-manylinux_riscv64