Skip to content

Commit 6522dc3

Browse files
committed
promql-parser: Add version 0.10.0
Build the per-interpreter maturin/pyo3 extension for riscv64 from the 0.10.0 release commit (upstream pushed no tag; the tree matches the PyPI sdist byte for byte).
1 parent 5121315 commit 6522dc3

2 files changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on the `linux` job of
5+
# https://github.com/messense/py-promql-parser/blob/5d938c2891539759a7d19253ea0b0ca8b5c60e2f/.github/workflows/CI.yml
6+
name: Build promql-parser wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version glob to (re)build; empty builds every version of docs/packages/promql-parser.yaml not released yet'
13+
required: false
14+
default: ''
15+
pull_request:
16+
branches: [main]
17+
paths:
18+
- '.github/workflows/build-promql-parser.yml'
19+
- 'docs/packages/promql-parser.yaml'
20+
push:
21+
branches: [main]
22+
paths:
23+
- '.github/workflows/build-promql-parser.yml'
24+
- 'docs/packages/promql-parser.yaml'
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
28+
cancel-in-progress: true
29+
30+
permissions:
31+
contents: read # to fetch code (actions/checkout)
32+
33+
env:
34+
# Upstream pushed no v0.10.0 tag; this is "Update promql-parser to 0.10.0", whose
35+
# tree is byte-identical to the 0.10.0 PyPI sdist. Update it alongside the version.
36+
PROMQL_PARSER_REF: 5d938c2891539759a7d19253ea0b0ca8b5c60e2f
37+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
38+
39+
jobs:
40+
setup:
41+
uses: $/.github/workflows/_setup.yml
42+
with:
43+
package: promql-parser
44+
version: ${{ inputs.version }}
45+
46+
build_wheels:
47+
needs: [setup]
48+
if: needs.setup.outputs.versions != '[]'
49+
name: Build promql-parser ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
50+
runs-on: ubuntu-24.04-riscv
51+
timeout-minutes: 90
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
56+
# No abi3 feature on pyo3, so one wheel per interpreter; pp311 is dropped
57+
# (PyPy has no riscv64 port) and musllinux with it (no riscv64 musl rustup).
58+
python: ["cp312", "cp313", "cp314", "cp314t"]
59+
60+
env:
61+
PROMQL_PARSER_VERSION: ${{ matrix.version }}
62+
63+
steps:
64+
- name: Checkout promql-parser ${{ env.PROMQL_PARSER_VERSION }}
65+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
66+
with:
67+
repository: messense/py-promql-parser
68+
ref: ${{ env.PROMQL_PARSER_REF }}
69+
persist-credentials: false
70+
71+
- name: Build wheels
72+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
73+
with:
74+
only: ${{ matrix.python }}-manylinux_riscv64
75+
output-dir: wheelhouse/
76+
env:
77+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
78+
CIBW_BEFORE_ALL_LINUX: >-
79+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
80+
CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin"'
81+
# Upstream's CI runs no tests; run its example script and the README's examples.
82+
CIBW_TEST_SOURCES: test_promql_parser.py README.md
83+
CIBW_TEST_COMMAND: >-
84+
python -c "import promql_parser.promql_parser as m; assert m.__file__.endswith('.so'), m.__file__"
85+
&& python test_promql_parser.py
86+
&& python -c "import re, pathlib;
87+
blocks = re.findall(r'\x60{3}python\n(.*?)\x60{3}', pathlib.Path('README.md').read_text(), re.S);
88+
assert len(blocks) == 5, len(blocks);
89+
[exec(b, {}) for b in blocks];
90+
print(len(blocks), 'README examples OK')"
91+
92+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
93+
with:
94+
name: promql-parser-${{ env.PROMQL_PARSER_VERSION }}-${{ matrix.python }}-manylinux_riscv64
95+
path: wheelhouse/*.whl
96+
if-no-files-found: error
97+
98+
publish:
99+
name: Publish promql-parser ${{ matrix.version }}
100+
needs: [setup, build_wheels]
101+
if: needs.setup.outputs.versions != '[]'
102+
strategy:
103+
fail-fast: false
104+
matrix:
105+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
106+
permissions:
107+
contents: write
108+
pull-requests: write
109+
uses: $/.github/workflows/_publish-wheel.yml
110+
secrets:
111+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
112+
with:
113+
artifact-pattern: promql-parser-${{ matrix.version }}-*-manylinux_riscv64

‎docs/packages/promql-parser.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-name: promql-parser
2+
source-code: https://github.com/messense/py-promql-parser
3+
license: MIT
4+
versions:
5+
- version: 0.10.0

0 commit comments

Comments
 (0)