From 5c454d8914d73344f09f668d5f31ae51c7c0760d Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 20 Nov 2026 18:41:05 +0100 Subject: [PATCH] workflows: migrate pre-build cibuildwheel jobs --- .github/workflows/build-anycrc.yml | 51 +- .github/workflows/build-arro3-compute.yml | 92 ++-- .github/workflows/build-arro3-core.yml | 479 +++++++++--------- .github/workflows/build-arro3-io.yml | 94 ++-- .github/workflows/build-ast-grep-py.yml | 81 ++- .github/workflows/build-async-tiff.yml | 136 +++-- .github/workflows/build-bashkit.yml | 106 ++-- .github/workflows/build-clang-tidy.yml | 66 +-- .github/workflows/build-crcmod-plus.yml | 55 +- .github/workflows/build-cryptg.yml | 76 +-- .github/workflows/build-faster-fifo.yml | 157 +++--- .github/workflows/build-geoarrow-c.yml | 60 +-- .github/workflows/build-gpudb.yml | 96 ++-- .../workflows/build-graspologic-native.yml | 96 ++-- .github/workflows/build-h3.yml | 68 +-- .github/workflows/build-hdiffpatch.yml | 93 ++-- .github/workflows/build-jsoncompat.yml | 79 ++- .github/workflows/build-jsonschema-rs.yml | 87 ++-- .github/workflows/build-kernels-data.yml | 96 ++-- .github/workflows/build-kernels.yml | 174 +++---- .github/workflows/build-laszip.yml | 57 +-- .github/workflows/build-littlefs-python.yml | 56 +- .github/workflows/build-longbridge.yml | 79 ++- .github/workflows/build-minify-html.yml | 103 ++-- .github/workflows/build-mitmproxy-rs.yml | 269 +++++----- .github/workflows/build-moyopy.yml | 136 +++-- .../workflows/build-multi-storage-client.yml | 116 ++--- .github/workflows/build-obstore.yml | 122 ++--- .github/workflows/build-openexr.yml | 68 +-- .github/workflows/build-openlineage-sql.yml | 85 ++-- .github/workflows/build-pcodec.yml | 89 ++-- .github/workflows/build-pgtask.yml | 119 ++--- .github/workflows/build-polyglot-sql-chio.yml | 99 ++-- .github/workflows/build-poselib.yml | 201 ++++---- .github/workflows/build-primp.yml | 83 ++- .github/workflows/build-protobuf-py-ext.yml | 231 ++++----- .github/workflows/build-pyfaup-rs.yml | 72 +-- .github/workflows/build-pyffish.yml | 42 +- .github/workflows/build-pylibmagic.yml | 65 +-- .github/workflows/build-pyqwest.yml | 217 ++++---- .github/workflows/build-pysoem.yml | 60 +-- .../build-python-magic-standalone.yml | 66 +-- .github/workflows/build-python-rapidjson.yml | 52 +- .github/workflows/build-pyxirr.yml | 136 +++-- .github/workflows/build-readcon-db.yml | 74 +-- .github/workflows/build-robotpy-wpiutil.yml | 55 +- .github/workflows/build-sdbus.yml | 368 ++++++-------- .../build-semantic-text-splitter.yml | 86 ++-- .github/workflows/build-sherpa-onnx.yml | 171 +++---- .github/workflows/build-sqruff.yml | 108 ++-- .github/workflows/build-surrealdb.yml | 92 ++-- .github/workflows/build-sxtwl.yml | 71 +-- .github/workflows/build-tdewolff-minify.yml | 66 +-- .github/workflows/build-typedunits.yml | 60 +-- .github/workflows/build-vesin-torch.yml | 123 ++--- .github/workflows/build-vesin.yml | 88 ++-- .github/workflows/build-vina.yml | 86 ++-- .github/workflows/build-voyager.yml | 57 +-- .github/workflows/build-xa11y.yml | 77 ++- .github/workflows/build-yara-x.yml | 87 ++-- 60 files changed, 2662 insertions(+), 3872 deletions(-) diff --git a/.github/workflows/build-anycrc.yml b/.github/workflows/build-anycrc.yml index 471865d09a78..a86bd1ff208d 100644 --- a/.github/workflows/build-anycrc.yml +++ b/.github/workflows/build-anycrc.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build anycrc ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -66,39 +64,22 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - ANYCRC_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout anycrc ${{ env.ANYCRC_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: marzooqy/anycrc - ref: ${{ env.ANYCRC_VERSION }} - submodules: recursive - persist-credentials: false - - - name: Write a cibuildwheel config without upstream's `skip` - # Upstream's only [tool.cibuildwheel] setting is `skip = ["cp31[!01]-*"]`, - # which would drop cp312/cp313/cp314 from the abi3 build/test matrix below. - run: printf '[tool.cibuildwheel]\n' > "$RUNNER_TEMP/cibuildwheel.toml" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - config-file: ${{ runner.temp }}/cibuildwheel.toml - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_COMMAND: >- - python -c "import anycrc.crc as m; assert m.__file__.endswith('.so'), m.__file__" - && python {project}/test.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: anycrc-${{ env.ANYCRC_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # Upstream's only [tool.cibuildwheel] setting is `skip = ["cp31[!01]-*"]`, + # which would drop cp312/cp313/cp314 from the abi3 build/test matrix below. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "anycrc" + version: "${{ matrix.version }}" + repository: "marzooqy/anycrc" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + checkout-submodules: "recursive" + pre-build: "printf '[tool.cibuildwheel]\\n' > cibuildwheel.toml" + cibw-config-file: "cibuildwheel.toml" + cibw-build: "${{ matrix.build }}" + cibw-test-command: > + python -c "import anycrc.crc as m; assert m.__file__.endswith('.so'), m.__file__" + && python {project}/test.py publish: name: Publish anycrc ${{ matrix.version }} diff --git a/.github/workflows/build-arro3-compute.yml b/.github/workflows/build-arro3-compute.yml index 18136fb6e642..978e72ad0f73 100644 --- a/.github/workflows/build-arro3-compute.yml +++ b/.github/workflows/build-arro3-compute.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build arro3-compute ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -74,60 +72,42 @@ jobs: build: cp314t-manylinux_riscv64 features: --features extension-module - env: - ARRO3_COMPUTE_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout arro3 py-v${{ env.ARRO3_COMPUTE_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: kylebarron/arro3 - ref: py-v${{ env.ARRO3_COMPUTE_VERSION }} - persist-credentials: false - - - name: Stage the licences beside arro3-compute's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is arro3-compute/ -- so upstream's published wheels - # carry no licence text at all, only the License-Expression metadata. - run: cp LICENSE_MIT LICENSE_APACHE arro3-compute/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: arro3-compute - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # arro3 ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # Without it pip prefers PyPI's newer numpy/pyarrow/arro3-core, - # none of which has a riscv64 wheel on PyPI, and source-builds or - # fails to resolve them in the container. - CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy,pyarrow,arro3-core - CIBW_TEST_REQUIRES: pytest pyarrow - # cp311 has no riscv64 pyarrow wheel on our registry (pyarrow's - # own riscv64 builds start at cp312), so the wheel still builds - # on cp311 for the abi3 tag but isn't test-exercised there. - CIBW_TEST_SKIP: cp311-* - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: >- - python -m pytest -v - tests/compute/test_aggregate.py - tests/compute/test_arith.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: arro3-compute-${{ env.ARRO3_COMPUTE_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is arro3-compute/ -- so upstream's published wheels + # carry no licence text at all, only the License-Expression metadata. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "arro3-compute" + version: "${{ matrix.version }}" + repository: "kylebarron/arro3" + ref: "py-v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + pre-build: "cp LICENSE_MIT LICENSE_APACHE arro3-compute/" + cibw-package-dir: "arro3-compute" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # arro3 ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + # Without it pip prefers PyPI's newer numpy/pyarrow/arro3-core, + # none of which has a riscv64 wheel on PyPI, and source-builds or + # fails to resolve them in the container. + cibw-test-environment: "PIP_ONLY_BINARY=numpy,pyarrow,arro3-core" + cibw-test-requires: "pytest pyarrow" + # cp311 has no riscv64 pyarrow wheel on our registry (pyarrow's + # own riscv64 builds start at cp312), so the wheel still builds + # on cp311 for the abi3 tag but isn't test-exercised there. + cibw-test-skip: "cp311-*" + cibw-test-sources: "tests" + cibw-test-command: > + python -m pytest -v + tests/compute/test_aggregate.py + tests/compute/test_arith.py publish: name: Publish arro3-compute ${{ matrix.version }} diff --git a/.github/workflows/build-arro3-core.yml b/.github/workflows/build-arro3-core.yml index f404ff311bad..ac742ad11fa1 100644 --- a/.github/workflows/build-arro3-core.yml +++ b/.github/workflows/build-arro3-core.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build arro3-core ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -70,254 +68,235 @@ jobs: build: cp314t-manylinux_riscv64 features: --features extension-module - env: - ARRO3_CORE_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout arro3 py-v${{ env.ARRO3_CORE_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: kylebarron/arro3 - ref: py-v${{ env.ARRO3_CORE_VERSION }} - persist-credentials: false - - - name: Stage the licences beside arro3-core's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is arro3-core/ -- so upstream's published wheels - # carry no licence text at all, only the License-Expression metadata. - run: cp LICENSE_MIT LICENSE_APACHE arro3-core/ - - - name: Stage the riscv64 smoke tests - # Upstream's tests/core suite compares arro3 against pyarrow, which - # publishes no riscv64 wheel; only the two reader tests below run - # without it. These cover the same surface using arro3's own - # constructors, accessors and PyCapsule round trips. - run: | - cat > tests/test_riscv64_smoke.py <<'EOF' - import importlib.metadata - - import numpy as np - import pytest - from arro3.core import ( - Array, - Buffer, - ChunkedArray, - DataType, - Field, - RecordBatch, - RecordBatchReader, - Scalar, - Schema, - Table, - list_array, - list_flatten, - list_offsets, - struct_array, - struct_field, - ) - - - def test_extension_is_compiled(): - from arro3.core import _core - - assert _core.__file__.endswith(".so"), _core.__file__ - - - def test_data_type(): - assert DataType.int32().bit_width == 32 - assert DataType.float64().bit_width == 64 - assert DataType.int32() == DataType.int32() - assert DataType.int32() != DataType.int64() - assert DataType.is_integer(DataType.uint16()) - assert DataType.is_floating(DataType.float32()) - assert not DataType.is_integer(DataType.string()) - assert DataType.list(DataType.int32(), 2).list_size == 2 - assert DataType.from_arrow(DataType.int64()) == DataType.int64() - - - def test_array_from_python(): - arr = Array([1, 2, 3], DataType.int32()) - assert len(arr) == 3 - assert arr.type == DataType.int32() - assert arr[0].as_py() == 1 - assert arr.to_pylist() == [1, 2, 3] - assert arr.slice(1, 2).to_pylist() == [2, 3] - assert arr.null_count == 0 - - with_null = Array([1, None, 3], DataType.int32()) - assert with_null.null_count == 1 - assert with_null.to_pylist() == [1, None, 3] - - - def test_array_numpy_roundtrip(): - np_arr = np.array([1.5, 2.5, 3.5], dtype=np.float64) - arr = Array(np_arr) - assert arr.type == DataType.float64() - back = np.asarray(arr) - assert back.dtype == np.float64 - np.testing.assert_array_equal(back, np_arr) - np.testing.assert_array_equal(np.asarray(arr.to_numpy()), np_arr) - - - @pytest.mark.parametrize( - "dtype", - [np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, - np.uint32, np.uint64, np.float32, np.float64], - ) - def test_numpy_dtypes_roundtrip(dtype): - np_arr = np.arange(4, dtype=dtype) - back = np.asarray(Array(np_arr)) - assert back.dtype == np.dtype(dtype) - np.testing.assert_array_equal(back, np_arr) - - - def test_array_pycapsule_roundtrip(): - arr = Array([1, 2, 3], DataType.int64()) - assert Array.from_arrow(arr).to_pylist() == [1, 2, 3] - assert DataType.from_arrow(arr).equals(DataType.int64()) - - - def test_string_and_bool_arrays(): - strings = Array(["a", "bb", None], DataType.string()) - assert strings.to_pylist() == ["a", "bb", None] - assert strings.type == DataType.string() - - bools = Array([True, False, True], DataType.bool()) - assert bools.to_pylist() == [True, False, True] - - - def test_scalar(): - scalar = Scalar(7, DataType.int32()) - assert scalar.as_py() == 7 - assert scalar.type == DataType.int32() - - - def test_field_and_schema(): - field = Field("a", DataType.int32(), nullable=False) - assert field.name == "a" - assert field.type == DataType.int32() - assert not field.nullable - - schema = Schema([field, Field("b", DataType.string())]) - assert schema.names == ["a", "b"] - assert schema.field(0).name == "a" - assert schema.field("b").type == DataType.string() - assert len(schema) == 2 - assert Schema.from_arrow(schema).names == ["a", "b"] - - - def test_chunked_array(): - chunked = ChunkedArray( - [Array([1, 2], DataType.int32()), Array([3], DataType.int32())] - ) - assert len(chunked) == 3 - assert chunked.num_chunks == 2 - assert chunked.type == DataType.int32() - assert chunked.to_pylist() == [1, 2, 3] - combined = chunked.combine_chunks() - assert combined.to_pylist() == [1, 2, 3] - assert chunked.chunk(1).to_pylist() == [3] - assert chunked.rechunk(max_chunksize=1).num_chunks == 3 - - - def test_record_batch_and_table(): - batch = RecordBatch( - { - "a": Array([1, 2], DataType.int32()), - "b": Array(["x", "y"], DataType.string()), - } - ) - assert batch.num_rows == 2 - assert batch.num_columns == 2 - assert batch.schema.names == ["a", "b"] - assert batch.column("a").to_pylist() == [1, 2] - - table = Table.from_batches([batch, batch]) - assert table.num_rows == 4 - assert table.column_names == ["a", "b"] - assert table.column("b").to_pylist() == ["x", "y", "x", "y"] - assert Table.from_arrow(table).num_rows == 4 - - - def test_record_batch_reader(): - batch = RecordBatch({"a": Array([1, 2, 3], DataType.int32())}) - reader = RecordBatchReader.from_batches(batch.schema, [batch]) - assert reader.schema.names == ["a"] - table = reader.read_all() - assert table.num_rows == 3 - - - def test_list_helpers(): - values = Array([1, 2, 3, 4], DataType.int32()) - offsets = Array([0, 2, 4], DataType.int32()) - lists = list_array(offsets, values) - assert len(lists) == 2 - assert list_flatten(lists).to_pylist() == [1, 2, 3, 4] - assert list_offsets(lists).to_pylist() == [0, 2, 4] - - - def test_struct_helpers(): - a = Array([1, 2], DataType.int32()) - b = Array(["x", "y"], DataType.string()) - fields = [Field("a", DataType.int32()), Field("b", DataType.string())] - structs = struct_array([a, b], fields=fields) - assert len(structs) == 2 - assert struct_field(structs, 0).to_pylist() == [1, 2] - assert struct_field(structs, 1).to_pylist() == ["x", "y"] - - - def test_buffer_protocol(): - buffer = Buffer(b"hello") - assert len(buffer) == 5 - assert buffer.to_bytes() == b"hello" - assert bytes(memoryview(buffer)) == b"hello" - from_buffer = Array.from_buffer(Buffer(np.array([1, 2, 3], dtype=np.uint8))) - assert from_buffer.to_pylist() == [1, 2, 3] - - - def test_licenses_are_packaged(): - files = importlib.metadata.files("arro3-core") - licenses = sorted( - str(path).rsplit("/", 1)[-1] - for path in files - if ".dist-info/licenses/" in str(path) - ) - assert licenses == ["LICENSE_APACHE", "LICENSE_MIT"], licenses - EOF - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: arro3-core - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # arro3 ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # Without it pip prefers PyPI's newer numpy, which has no riscv64 - # wheel, and source-builds it in the container. - CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy - CIBW_TEST_REQUIRES: pytest numpy - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: >- - python -m pytest -v - tests/test_riscv64_smoke.py - tests/core/test_array_reader.py - tests/core/test_record_batch_reader.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: arro3-core-${{ env.ARRO3_CORE_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is arro3-core/ -- so upstream's published wheels + # carry no licence text at all, only the License-Expression metadata. + # Upstream's tests/core suite compares arro3 against pyarrow, which + # publishes no riscv64 wheel; only the two reader tests below run + # without it. These cover the same surface using arro3's own + # constructors, accessors and PyCapsule round trips. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "arro3-core" + version: "${{ matrix.version }}" + repository: "kylebarron/arro3" + ref: "py-v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + pre-build: |- + cp LICENSE_MIT LICENSE_APACHE arro3-core/ + + cat > tests/test_riscv64_smoke.py <<'EOF' + import importlib.metadata + + import numpy as np + import pytest + from arro3.core import ( + Array, + Buffer, + ChunkedArray, + DataType, + Field, + RecordBatch, + RecordBatchReader, + Scalar, + Schema, + Table, + list_array, + list_flatten, + list_offsets, + struct_array, + struct_field, + ) + + + def test_extension_is_compiled(): + from arro3.core import _core + + assert _core.__file__.endswith(".so"), _core.__file__ + + + def test_data_type(): + assert DataType.int32().bit_width == 32 + assert DataType.float64().bit_width == 64 + assert DataType.int32() == DataType.int32() + assert DataType.int32() != DataType.int64() + assert DataType.is_integer(DataType.uint16()) + assert DataType.is_floating(DataType.float32()) + assert not DataType.is_integer(DataType.string()) + assert DataType.list(DataType.int32(), 2).list_size == 2 + assert DataType.from_arrow(DataType.int64()) == DataType.int64() + + + def test_array_from_python(): + arr = Array([1, 2, 3], DataType.int32()) + assert len(arr) == 3 + assert arr.type == DataType.int32() + assert arr[0].as_py() == 1 + assert arr.to_pylist() == [1, 2, 3] + assert arr.slice(1, 2).to_pylist() == [2, 3] + assert arr.null_count == 0 + + with_null = Array([1, None, 3], DataType.int32()) + assert with_null.null_count == 1 + assert with_null.to_pylist() == [1, None, 3] + + + def test_array_numpy_roundtrip(): + np_arr = np.array([1.5, 2.5, 3.5], dtype=np.float64) + arr = Array(np_arr) + assert arr.type == DataType.float64() + back = np.asarray(arr) + assert back.dtype == np.float64 + np.testing.assert_array_equal(back, np_arr) + np.testing.assert_array_equal(np.asarray(arr.to_numpy()), np_arr) + + + @pytest.mark.parametrize( + "dtype", + [np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, + np.uint32, np.uint64, np.float32, np.float64], + ) + def test_numpy_dtypes_roundtrip(dtype): + np_arr = np.arange(4, dtype=dtype) + back = np.asarray(Array(np_arr)) + assert back.dtype == np.dtype(dtype) + np.testing.assert_array_equal(back, np_arr) + + + def test_array_pycapsule_roundtrip(): + arr = Array([1, 2, 3], DataType.int64()) + assert Array.from_arrow(arr).to_pylist() == [1, 2, 3] + assert DataType.from_arrow(arr).equals(DataType.int64()) + + + def test_string_and_bool_arrays(): + strings = Array(["a", "bb", None], DataType.string()) + assert strings.to_pylist() == ["a", "bb", None] + assert strings.type == DataType.string() + + bools = Array([True, False, True], DataType.bool()) + assert bools.to_pylist() == [True, False, True] + + + def test_scalar(): + scalar = Scalar(7, DataType.int32()) + assert scalar.as_py() == 7 + assert scalar.type == DataType.int32() + + + def test_field_and_schema(): + field = Field("a", DataType.int32(), nullable=False) + assert field.name == "a" + assert field.type == DataType.int32() + assert not field.nullable + + schema = Schema([field, Field("b", DataType.string())]) + assert schema.names == ["a", "b"] + assert schema.field(0).name == "a" + assert schema.field("b").type == DataType.string() + assert len(schema) == 2 + assert Schema.from_arrow(schema).names == ["a", "b"] + + + def test_chunked_array(): + chunked = ChunkedArray( + [Array([1, 2], DataType.int32()), Array([3], DataType.int32())] + ) + assert len(chunked) == 3 + assert chunked.num_chunks == 2 + assert chunked.type == DataType.int32() + assert chunked.to_pylist() == [1, 2, 3] + combined = chunked.combine_chunks() + assert combined.to_pylist() == [1, 2, 3] + assert chunked.chunk(1).to_pylist() == [3] + assert chunked.rechunk(max_chunksize=1).num_chunks == 3 + + + def test_record_batch_and_table(): + batch = RecordBatch( + { + "a": Array([1, 2], DataType.int32()), + "b": Array(["x", "y"], DataType.string()), + } + ) + assert batch.num_rows == 2 + assert batch.num_columns == 2 + assert batch.schema.names == ["a", "b"] + assert batch.column("a").to_pylist() == [1, 2] + + table = Table.from_batches([batch, batch]) + assert table.num_rows == 4 + assert table.column_names == ["a", "b"] + assert table.column("b").to_pylist() == ["x", "y", "x", "y"] + assert Table.from_arrow(table).num_rows == 4 + + + def test_record_batch_reader(): + batch = RecordBatch({"a": Array([1, 2, 3], DataType.int32())}) + reader = RecordBatchReader.from_batches(batch.schema, [batch]) + assert reader.schema.names == ["a"] + table = reader.read_all() + assert table.num_rows == 3 + + + def test_list_helpers(): + values = Array([1, 2, 3, 4], DataType.int32()) + offsets = Array([0, 2, 4], DataType.int32()) + lists = list_array(offsets, values) + assert len(lists) == 2 + assert list_flatten(lists).to_pylist() == [1, 2, 3, 4] + assert list_offsets(lists).to_pylist() == [0, 2, 4] + + + def test_struct_helpers(): + a = Array([1, 2], DataType.int32()) + b = Array(["x", "y"], DataType.string()) + fields = [Field("a", DataType.int32()), Field("b", DataType.string())] + structs = struct_array([a, b], fields=fields) + assert len(structs) == 2 + assert struct_field(structs, 0).to_pylist() == [1, 2] + assert struct_field(structs, 1).to_pylist() == ["x", "y"] + + + def test_buffer_protocol(): + buffer = Buffer(b"hello") + assert len(buffer) == 5 + assert buffer.to_bytes() == b"hello" + assert bytes(memoryview(buffer)) == b"hello" + from_buffer = Array.from_buffer(Buffer(np.array([1, 2, 3], dtype=np.uint8))) + assert from_buffer.to_pylist() == [1, 2, 3] + + + def test_licenses_are_packaged(): + files = importlib.metadata.files("arro3-core") + licenses = sorted( + str(path).rsplit("/", 1)[-1] + for path in files + if ".dist-info/licenses/" in str(path) + ) + assert licenses == ["LICENSE_APACHE", "LICENSE_MIT"], licenses + EOF + cibw-package-dir: "arro3-core" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # arro3 ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + # Without it pip prefers PyPI's newer numpy, which has no riscv64 + # wheel, and source-builds it in the container. + cibw-test-environment: "PIP_ONLY_BINARY=numpy" + cibw-test-requires: "pytest numpy" + cibw-test-sources: "tests" + cibw-test-command: > + python -m pytest -v + tests/test_riscv64_smoke.py + tests/core/test_array_reader.py + tests/core/test_record_batch_reader.py publish: name: Publish arro3-core ${{ matrix.version }} diff --git a/.github/workflows/build-arro3-io.yml b/.github/workflows/build-arro3-io.yml index c5cc6307cbee..0540211b215b 100644 --- a/.github/workflows/build-arro3-io.yml +++ b/.github/workflows/build-arro3-io.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build arro3-io ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -74,61 +72,43 @@ jobs: build: cp314t-manylinux_riscv64 features: --features extension-module - env: - ARRO3_IO_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout arro3 py-v${{ env.ARRO3_IO_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: kylebarron/arro3 - ref: py-v${{ env.ARRO3_IO_VERSION }} - persist-credentials: false - - - name: Stage the licences beside arro3-io's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is arro3-io/ -- so upstream's published wheels - # carry no licence text at all, only the License-Expression metadata. - run: cp LICENSE_MIT LICENSE_APACHE arro3-io/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: arro3-io - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # arro3 ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # Without it pip prefers PyPI's newer numpy/pyarrow, neither of - # which has a riscv64 wheel, and source-builds them in the - # container. - CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy,pyarrow - CIBW_TEST_REQUIRES: pytest pyarrow numpy - # cp311 has no riscv64 pyarrow wheel on our registry (pyarrow's - # own riscv64 builds start at cp312), so the wheel still builds - # on cp311 for the abi3 tag but isn't test-exercised there. - CIBW_TEST_SKIP: cp311-* - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: >- - python -m pytest -v - tests/io/test_ipc.py - tests/io/test_json.py - tests/io/test_parquet.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: arro3-io-${{ env.ARRO3_IO_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is arro3-io/ -- so upstream's published wheels + # carry no licence text at all, only the License-Expression metadata. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "arro3-io" + version: "${{ matrix.version }}" + repository: "kylebarron/arro3" + ref: "py-v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + pre-build: "cp LICENSE_MIT LICENSE_APACHE arro3-io/" + cibw-package-dir: "arro3-io" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # arro3 ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + # Without it pip prefers PyPI's newer numpy/pyarrow, neither of + # which has a riscv64 wheel, and source-builds them in the + # container. + cibw-test-environment: "PIP_ONLY_BINARY=numpy,pyarrow" + cibw-test-requires: "pytest pyarrow numpy" + # cp311 has no riscv64 pyarrow wheel on our registry (pyarrow's + # own riscv64 builds start at cp312), so the wheel still builds + # on cp311 for the abi3 tag but isn't test-exercised there. + cibw-test-skip: "cp311-*" + cibw-test-sources: "tests" + cibw-test-command: > + python -m pytest -v + tests/io/test_ipc.py + tests/io/test_json.py + tests/io/test_parquet.py publish: name: Publish arro3-io ${{ matrix.version }} diff --git a/.github/workflows/build-ast-grep-py.yml b/.github/workflows/build-ast-grep-py.yml index ea297a8968d2..fd115ddf8341 100644 --- a/.github/workflows/build-ast-grep-py.yml +++ b/.github/workflows/build-ast-grep-py.yml @@ -49,61 +49,42 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build ast-grep-py ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - AST_GREP_PY_VERSION: ${{ matrix.version }} - - steps: - # Checked out at the workspace root: crates/pyo3 is a member of the - # ast-grep Cargo workspace and builds against its sibling crates. - - name: Checkout ast-grep v${{ env.AST_GREP_PY_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ast-grep/ast-grep - ref: ${{ env.AST_GREP_PY_VERSION }} - persist-credentials: false - - - name: Stage LICENSE beside crates/pyo3's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, - # which is crates/pyo3 -- so upstream's published wheel carries no - # licence text at all. - run: cp LICENSE crates/pyo3/LICENSE - - - name: Build wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: crates/pyo3 - output-dir: wheelhouse/ - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # ast-grep ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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_REQUIRES: pytest - # test-sources resolves against the checkout root, not package-dir. - CIBW_TEST_SOURCES: crates/pyo3/tests crates/pyo3/pyproject.toml - CIBW_TEST_COMMAND: >- - cd crates/pyo3 && - python -c "import ast_grep_py.ast_grep_py as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - assert {p.name for p in md.files('ast-grep-py') if 'licenses' in str(p)} == {'LICENSE'}" && - python -m pytest -v tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: ast-grep-py-${{ env.AST_GREP_PY_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # Checked out at the workspace root: crates/pyo3 is a member of the + # ast-grep Cargo workspace and builds against its sibling crates. + # maturin globs LICEN[CS]E* relative to the pyproject directory, + # which is crates/pyo3 -- so upstream's published wheel carries no + # licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "ast-grep-py" + version: "${{ matrix.version }}" + repository: "ast-grep/ast-grep" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 360 + pre-build: "cp LICENSE crates/pyo3/LICENSE" + cibw-package-dir: "crates/pyo3" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # ast-grep ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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-requires: "pytest" + # test-sources resolves against the checkout root, not package-dir. + cibw-test-sources: "crates/pyo3/tests crates/pyo3/pyproject.toml" + cibw-test-command: > + cd crates/pyo3 && + python -c "import ast_grep_py.ast_grep_py as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + assert {p.name for p in md.files('ast-grep-py') if 'licenses' in str(p)} == {'LICENSE'}" && + python -m pytest -v tests publish: name: Publish ast-grep-py ${{ matrix.version }} diff --git a/.github/workflows/build-async-tiff.yml b/.github/workflows/build-async-tiff.yml index 48d73b330a3e..56a4aa7479c7 100644 --- a/.github/workflows/build-async-tiff.yml +++ b/.github/workflows/build-async-tiff.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build async-tiff ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -77,82 +75,64 @@ jobs: build: cp314t-manylinux_riscv64 features: --features extension-module - env: - ASYNC_TIFF_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout async-tiff py-v${{ env.ASYNC_TIFF_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: developmentseed/async-tiff - ref: py-v${{ env.ASYNC_TIFF_VERSION }} - submodules: recursive - persist-credentials: false - - - name: Stage the licence beside async-tiff's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is python/ -- so upstream's published wheels carry - # no licence text at all, only the classifiers. - run: cp LICENSE python/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # async-tiff ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. lerc-sys - # (the lerc feature, on by default) runs bindgen over its vendored - # C++ headers, which needs libclang. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && - dnf install -y clang-devel - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # PyPI's newest obstore (0.12.1) and numpy (2.5.4) are sdist-only on - # riscv64 while our registry hosts 0.12.0 / 2.5.3 wheels (gotcha 354). - # MATURIN_PEP517_ARGS is cleared so async-tiff's --features never - # reach another maturin sdist built here (gotcha 141): obstore has - # no extension-module feature. - CIBW_TEST_ENVIRONMENT: >- - PIP_PREFER_BINARY=1 - MATURIN_PEP517_ARGS="" - CIBW_TEST_REQUIRES: pytest pytest-asyncio numpy obstore rasterio - # cp311 has no riscv64 rasterio wheel on our registry (its riscv64 - # builds start at cp312), so the abi3 wheel is tested on cp312+. - CIBW_TEST_SKIP: cp311-* - CIBW_TEST_SOURCES: python/tests python/pyproject.toml fixtures - # test_cog_s3 reaches a real public S3 bucket; deselected like the - # other live-endpoint tests this fleet already excludes elsewhere. - # - # rasterio-uint8_1band_lzma_block64 opens the fixture through rasterio (pulled - # in only to cross-check async-tiff's own TIFF reads), whose riscv64 wheel - # vendors a libgdal linked against Rocky 10's system libtiff -- built without - # liblzma, same root cause as gotcha 368's imagecodecs case (CLAUDE.md gotcha - # 368: Rocky 10's libtiff carries no LZMA codec at all). Fixing it would mean - # rebuilding and republishing the already-merged rasterio wheel against an - # internal/lzma-enabled libtiff, well outside this package's own workflow, so - # this one case is deselected here the same way imagecodecs deselects its - # TIFF/lzma cases in build-imagecodecs.yml. async-tiff's own LZMA codec path is - # unaffected -- every other rasterio-comparison case still runs. - CIBW_TEST_COMMAND: >- - python -c "import async_tiff._async_tiff as m; assert m.__file__.endswith('.so'), m.__file__" - && cd python - && python -m pytest -v tests - --deselect tests/test_cog.py::test_cog_s3 - --deselect "tests/test_integration_rasterio.py::test_read[rasterio-uint8_1band_lzma_block64]" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: async-tiff-${{ env.ASYNC_TIFF_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is python/ -- so upstream's published wheels carry + # no licence text at all, only the classifiers. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "async-tiff" + version: "${{ matrix.version }}" + repository: "developmentseed/async-tiff" + ref: "py-v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + checkout-submodules: "recursive" + pre-build: "cp LICENSE python/LICENSE" + cibw-package-dir: "python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # async-tiff ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. lerc-sys + # (the lerc feature, on by default) runs bindgen over its vendored + # C++ headers, which needs libclang. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && + dnf install -y clang-devel + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + # PyPI's newest obstore (0.12.1) and numpy (2.5.4) are sdist-only on + # riscv64 while our registry hosts 0.12.0 / 2.5.3 wheels (gotcha 354). + # MATURIN_PEP517_ARGS is cleared so async-tiff's --features never + # reach another maturin sdist built here (gotcha 141): obstore has + # no extension-module feature. + cibw-test-environment: > + PIP_PREFER_BINARY=1 + MATURIN_PEP517_ARGS="" + cibw-test-requires: "pytest pytest-asyncio numpy obstore rasterio" + # cp311 has no riscv64 rasterio wheel on our registry (its riscv64 + # builds start at cp312), so the abi3 wheel is tested on cp312+. + cibw-test-skip: "cp311-*" + cibw-test-sources: "python/tests python/pyproject.toml fixtures" + # test_cog_s3 reaches a real public S3 bucket; deselected like the + # other live-endpoint tests this fleet already excludes elsewhere. + # + # rasterio-uint8_1band_lzma_block64 opens the fixture through rasterio (pulled + # in only to cross-check async-tiff's own TIFF reads), whose riscv64 wheel + # vendors a libgdal linked against Rocky 10's system libtiff -- built without + # liblzma, same root cause as gotcha 368's imagecodecs case (CLAUDE.md gotcha + # 368: Rocky 10's libtiff carries no LZMA codec at all). Fixing it would mean + # rebuilding and republishing the already-merged rasterio wheel against an + # internal/lzma-enabled libtiff, well outside this package's own workflow, so + # this one case is deselected here the same way imagecodecs deselects its + # TIFF/lzma cases in build-imagecodecs.yml. async-tiff's own LZMA codec path is + # unaffected -- every other rasterio-comparison case still runs. + cibw-test-command: > + python -c "import async_tiff._async_tiff as m; assert m.__file__.endswith('.so'), m.__file__" + && cd python + && python -m pytest -v tests + --deselect tests/test_cog.py::test_cog_s3 + --deselect "tests/test_integration_rasterio.py::test_read[rasterio-uint8_1band_lzma_block64]" publish: name: Publish async-tiff ${{ matrix.version }} diff --git a/.github/workflows/build-bashkit.yml b/.github/workflows/build-bashkit.yml index d7a59bd6c45a..077081df5818 100644 --- a/.github/workflows/build-bashkit.yml +++ b/.github/workflows/build-bashkit.yml @@ -50,74 +50,54 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build bashkit ${{ matrix.version }} cp39-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 1440 strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} - env: - BASHKIT_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout bashkit v${{ env.BASHKIT_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: everruns/bashkit - ref: v${{ env.BASHKIT_VERSION }} - persist-credentials: false - - - name: Stage the licence beside bashkit's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # is crates/bashkit-python/ -- upstream's published wheels carry none. - run: cp LICENSE crates/bashkit-python/ - - - name: Build wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: crates/bashkit-python - output-dir: wheelhouse/ - env: - # pyo3's abi3-py39 feature is on unconditionally: built once on cp39 - # and re-tested on the newer interpreters. No free-threaded wheel - # upstream. musllinux is dropped: rustup.rs ships no riscv64 musl - # toolchain. - CIBW_BUILD: >- - cp39-manylinux_riscv64 cp310-manylinux_riscv64 - cp311-manylinux_riscv64 cp312-manylinux_riscv64 - cp313-manylinux_riscv64 cp314-manylinux_riscv64 - 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" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # The integration-test deps have riscv64 wheels from cp312 only; their - # tests importorskip them. - CIBW_BEFORE_TEST: >- - pip install pytest pytest-asyncio - "langchain-core; python_version >= '3.12'" - "langgraph; python_version >= '3.12'" - "fastapi; python_version >= '3.12'" - "httpx; python_version >= '3.12'" && - pip install {project}/crates/bashkit-python/test-fixtures/random-fs - CIBW_TEST_SOURCES: >- - crates/bashkit-python/tests - crates/bashkit-python/bashkit/deepagents.py - crates/bashkit-python/pyproject.toml - CIBW_TEST_COMMAND: >- - python -c "import bashkit._bashkit as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - assert any(str(p).endswith('licenses/LICENSE') for p in md.files('bashkit'))" && - cd crates/bashkit-python && - pytest tests/ -v - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: bashkit-${{ env.BASHKIT_VERSION }}-cp39-abi3-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # is crates/bashkit-python/ -- upstream's published wheels carry none. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "bashkit" + version: "${{ matrix.version }}" + repository: "everruns/bashkit" + ref: "v${{ matrix.version }}" + artifact-tag: "cp39-abi3-manylinux_riscv64" + timeout-minutes: 1440 + pre-build: "cp LICENSE crates/bashkit-python/" + cibw-package-dir: "crates/bashkit-python" + # pyo3's abi3-py39 feature is on unconditionally: built once on cp39 + # and re-tested on the newer interpreters. No free-threaded wheel + # upstream. musllinux is dropped: rustup.rs ships no riscv64 musl + # toolchain. + cibw-build: > + cp39-manylinux_riscv64 cp310-manylinux_riscv64 + cp311-manylinux_riscv64 cp312-manylinux_riscv64 + cp313-manylinux_riscv64 cp314-manylinux_riscv64 + 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" + # The integration-test deps have riscv64 wheels from cp312 only; their + # tests importorskip them. + cibw-before-test: > + pip install pytest pytest-asyncio + "langchain-core; python_version >= '3.12'" + "langgraph; python_version >= '3.12'" + "fastapi; python_version >= '3.12'" + "httpx; python_version >= '3.12'" && + pip install {project}/crates/bashkit-python/test-fixtures/random-fs + cibw-test-sources: > + crates/bashkit-python/tests + crates/bashkit-python/bashkit/deepagents.py + crates/bashkit-python/pyproject.toml + cibw-test-command: > + python -c "import bashkit._bashkit as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + assert any(str(p).endswith('licenses/LICENSE') for p in md.files('bashkit'))" && + cd crates/bashkit-python && + pytest tests/ -v publish: name: Publish bashkit ${{ matrix.version }} diff --git a/.github/workflows/build-clang-tidy.yml b/.github/workflows/build-clang-tidy.yml index 1cbe09648cea..afd3b4870961 100644 --- a/.github/workflows/build-clang-tidy.yml +++ b/.github/workflows/build-clang-tidy.yml @@ -57,49 +57,29 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build clang-tidy ${{ matrix.version }} py2.py3-none-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 1440 # full LLVM/clang compile from source; unlike clang-format-wheel this - # upstream CMakeLists.txt does not restrict LLVM_TARGETS_TO_BUILD - - env: - CLANG_TIDY_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout clang-tidy-wheel - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ssciwr/clang-tidy-wheel - ref: ${{ env.CLANG_TIDY_WHEEL_REF }} - persist-credentials: false - - - name: Set clang-tidy_version.txt to ${{ env.CLANG_TIDY_VERSION }} - run: echo "${CLANG_TIDY_VERSION}" > clang-tidy_version.txt - - - name: Build wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - # wheel.py-api = "py2.py3", so one build serves every interpreter. - only: cp312-manylinux_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_TEST: rm -rf {package}/clang_tidy - # Upstream tests its Linux wheels with CI=1 so test_include_iostream skips - # (ssciwr/clang-tidy-wheel#30); here clang also cannot find the image's - # /usr/lib/gcc/riscv64-redhat-linux, which is not in its riscv64 triple list. - CIBW_TEST_ENVIRONMENT: CI=1 - # Repeats pyproject.toml's own `environment` table: CIBW_ENVIRONMENT replaces - # rather than merges with it (gotcha 107). - CIBW_ENVIRONMENT: >- - CMAKE_GENERATOR=Ninja - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: clang-tidy-${{ env.CLANG_TIDY_VERSION }}-py2.py3-none-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error - + # upstream CMakeLists.txt does not restrict LLVM_TARGETS_TO_BUILD + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "clang-tidy" + version: "${{ matrix.version }}" + repository: "ssciwr/clang-tidy-wheel" + ref: "0dc6a6edd1f404d5f0b84b59872f9b6d22211134" + artifact-tag: "py2.py3-none-manylinux_riscv64" + timeout-minutes: 1440 + pre-build: |- + export CLANG_TIDY_VERSION='${{ matrix.version }}' + echo "${CLANG_TIDY_VERSION}" > clang-tidy_version.txt + # wheel.py-api = "py2.py3", so one build serves every interpreter. + cibw-build: "cp312-manylinux_riscv64" + cibw-before-test: "rm -rf {package}/clang_tidy" + # Upstream tests its Linux wheels with CI=1 so test_include_iostream skips + # (ssciwr/clang-tidy-wheel#30); here clang also cannot find the image's + # /usr/lib/gcc/riscv64-redhat-linux, which is not in its riscv64 triple list. + cibw-test-environment: "CI=1" + # Repeats pyproject.toml's own `environment` table: CIBW_ENVIRONMENT replaces + # rather than merges with it (gotcha 107). + cibw-environment-linux: > + CMAKE_GENERATOR=Ninja publish: name: Publish clang-tidy ${{ matrix.version }} needs: [setup, build_wheels] diff --git a/.github/workflows/build-crcmod-plus.yml b/.github/workflows/build-crcmod-plus.yml index 1ab105fd44c5..bddf3ba17b0a 100644 --- a/.github/workflows/build-crcmod-plus.yml +++ b/.github/workflows/build-crcmod-plus.yml @@ -50,8 +50,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build crcmod-plus ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -72,41 +70,24 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - CRCMOD_PLUS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout crcmod-plus ${{ env.CRCMOD_PLUS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ntamas/crcmod-plus - ref: ${{ env.CRCMOD_PLUS_VERSION }} - persist-credentials: false - - - name: Write a cibuildwheel config without upstream's `enable` groups - # Upstream's only [tool.cibuildwheel] setting is - # `enable = ["cpython-freethreading", "pypy"]`; cibuildwheel 4 removed - # the free-threading group (it is always on) and refuses to parse it. - run: printf '[tool.cibuildwheel]\n' > "$RUNNER_TEMP/cibuildwheel.toml" - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - config-file: ${{ runner.temp }}/cibuildwheel.toml - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: >- - python -c "import crcmod._crcfunext as m; assert m.__file__.endswith('.so'), m.__file__" && - python -m pytest tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: crcmod-plus-${{ env.CRCMOD_PLUS_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # Upstream's only [tool.cibuildwheel] setting is + # `enable = ["cpython-freethreading", "pypy"]`; cibuildwheel 4 removed + # the free-threading group (it is always on) and refuses to parse it. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "crcmod-plus" + version: "${{ matrix.version }}" + repository: "ntamas/crcmod-plus" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + pre-build: "printf '[tool.cibuildwheel]\\n' > cibuildwheel.toml" + cibw-config-file: "cibuildwheel.toml" + cibw-build: "${{ matrix.build }}" + cibw-test-requires: "pytest" + cibw-test-sources: "tests" + cibw-test-command: > + python -c "import crcmod._crcfunext as m; assert m.__file__.endswith('.so'), m.__file__" && + python -m pytest tests publish: name: Publish crcmod-plus ${{ matrix.version }} diff --git a/.github/workflows/build-cryptg.yml b/.github/workflows/build-cryptg.yml index 5be005cf94cd..982450bf65b7 100644 --- a/.github/workflows/build-cryptg.yml +++ b/.github/workflows/build-cryptg.yml @@ -51,59 +51,39 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build cryptg ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - CRYPTG_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout cryptg v${{ env.CRYPTG_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: cher-nov/cryptg - ref: v${{ env.CRYPTG_VERSION }} - persist-credentials: false - - # setuptools' default LICEN[CS]E* glob only looks at the project root, so the - # vendored grammers-crypto/pyo3 licences under LICENSES/ never reach the wheel - # unless they are named LICENSE. there too (gotcha 44). - - name: Stage vendored dependency licences - run: | - cp LICENSES/LICENSE.grammers-crypto LICENSE.grammers-crypto - cp LICENSES/LICENSE.pyo3 LICENSE.pyo3 - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # No Rust in the manylinux image; install it and put cargo on PATH. - 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"' - # No upstream test suite; exercise the IGE round trip, factorize_pq_pair, and - # assert the vendored-licence staging step above actually landed in the wheel. - CIBW_TEST_COMMAND: >- - python -c "import cryptg, importlib.metadata, os; key = os.urandom(32); iv - = os.urandom(32); data = os.urandom(64); assert - cryptg.decrypt_ige(cryptg.encrypt_ige(data, key, iv), key, iv) == data; - assert cryptg.factorize_pq_pair(3247) == (17, 191); lic = {p.name for p in - importlib.metadata.files('cryptg') if '.dist-info/licenses/' in str(p)}; - assert lic == {'LICENSE.txt', 'LICENSE.grammers-crypto', 'LICENSE.pyo3'}, - lic; print('cryptg smoke test OK')" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: cryptg-${{ env.CRYPTG_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # setuptools' default LICEN[CS]E* glob only looks at the project root, so the + # vendored grammers-crypto/pyo3 licences under LICENSES/ never reach the wheel + # unless they are named LICENSE. there too (gotcha 44). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "cryptg" + version: "${{ matrix.version }}" + repository: "cher-nov/cryptg" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: |- + cp LICENSES/LICENSE.grammers-crypto LICENSE.grammers-crypto + cp LICENSES/LICENSE.pyo3 LICENSE.pyo3 + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # No Rust in the manylinux image; install it and put cargo on PATH. + 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" + # No upstream test suite; exercise the IGE round trip, factorize_pq_pair, and + # assert the vendored-licence staging step above actually landed in the wheel. + cibw-test-command: > + python -c "import cryptg, importlib.metadata, os; key = os.urandom(32); iv + = os.urandom(32); data = os.urandom(64); assert + cryptg.decrypt_ige(cryptg.encrypt_ige(data, key, iv), key, iv) == data; + assert cryptg.factorize_pq_pair(3247) == (17, 191); lic = {p.name for p in + importlib.metadata.files('cryptg') if '.dist-info/licenses/' in str(p)}; + assert lic == {'LICENSE.txt', 'LICENSE.grammers-crypto', 'LICENSE.pyo3'}, + lic; print('cryptg smoke test OK')" publish: name: Publish cryptg ${{ matrix.version }} diff --git a/.github/workflows/build-faster-fifo.yml b/.github/workflows/build-faster-fifo.yml index aa0c1f78682e..f291831c69aa 100644 --- a/.github/workflows/build-faster-fifo.yml +++ b/.github/workflows/build-faster-fifo.yml @@ -50,99 +50,80 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build faster-fifo ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - FASTER_FIFO_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout faster-fifo v${{ env.FASTER_FIFO_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: alex-petrenko/faster-fifo - ref: v${{ env.FASTER_FIFO_VERSION }} - persist-credentials: false - - - name: Stage riscv64 smoke test - # Upstream ships no test suite at all (make test's `python -m - # unittest` discovers zero files), so this drives the real - # PTHREAD_PROCESS_SHARED mutex/condvar path across two OS processes - # instead of settling for an import-only check. - run: | - cat > riscv64_smoke_test.py <<'PY' - import multiprocessing as mp - from queue import Empty, Full - - import faster_fifo - - assert faster_fifo.__file__.endswith(".so"), faster_fifo.__file__ - - q = faster_fifo.Queue(1000 * 1000) - assert q.empty() - - obj = dict(a=42, b=(1, 2, 3), c=[1, 2, 3], d="text", e=b"bytes") - q.put(obj) - assert q.qsize() == 1 - assert q.get() == obj - assert q.empty() - - q.put_many([1, 2, 3]) - assert q.get_many(max_messages_to_get=3) == [1, 2, 3] - - small_q = faster_fifo.Queue(64) - small_q.put(b"x" * 32) - try: - small_q.put_nowait(b"y" * 32) - raise AssertionError("expected Full") - except Full: - pass - assert small_q.get() == b"x" * 32 - try: - small_q.get(timeout=0.2) - raise AssertionError("expected Empty") - except Empty: - pass - - def producer(queue, n): - for i in range(n): - queue.put(i) - - if __name__ == "__main__": - n = 2000 - cross_q = faster_fifo.Queue(4 * 1000 * 1000) - proc = mp.Process(target=producer, args=(cross_q, n)) - proc.start() - - received = [] - while len(received) < n: - received.extend(cross_q.get_many(timeout=5)) - proc.join(timeout=10) - - assert proc.exitcode == 0, proc.exitcode - assert sorted(received) == list(range(n)) - print("faster-fifo riscv64 smoke test passed") - PY - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - CIBW_TEST_SOURCES: riscv64_smoke_test.py - CIBW_TEST_COMMAND: python {package}/riscv64_smoke_test.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: faster-fifo-${{ env.FASTER_FIFO_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # Upstream ships no test suite at all (make test's `python -m + # unittest` discovers zero files), so this drives the real + # PTHREAD_PROCESS_SHARED mutex/condvar path across two OS processes + # instead of settling for an import-only check. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "faster-fifo" + version: "${{ matrix.version }}" + repository: "alex-petrenko/faster-fifo" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: |- + cat > riscv64_smoke_test.py <<'PY' + import multiprocessing as mp + from queue import Empty, Full + + import faster_fifo + + assert faster_fifo.__file__.endswith(".so"), faster_fifo.__file__ + + q = faster_fifo.Queue(1000 * 1000) + assert q.empty() + + obj = dict(a=42, b=(1, 2, 3), c=[1, 2, 3], d="text", e=b"bytes") + q.put(obj) + assert q.qsize() == 1 + assert q.get() == obj + assert q.empty() + + q.put_many([1, 2, 3]) + assert q.get_many(max_messages_to_get=3) == [1, 2, 3] + + small_q = faster_fifo.Queue(64) + small_q.put(b"x" * 32) + try: + small_q.put_nowait(b"y" * 32) + raise AssertionError("expected Full") + except Full: + pass + assert small_q.get() == b"x" * 32 + try: + small_q.get(timeout=0.2) + raise AssertionError("expected Empty") + except Empty: + pass + + def producer(queue, n): + for i in range(n): + queue.put(i) + + if __name__ == "__main__": + n = 2000 + cross_q = faster_fifo.Queue(4 * 1000 * 1000) + proc = mp.Process(target=producer, args=(cross_q, n)) + proc.start() + + received = [] + while len(received) < n: + received.extend(cross_q.get_many(timeout=5)) + proc.join(timeout=10) + + assert proc.exitcode == 0, proc.exitcode + assert sorted(received) == list(range(n)) + print("faster-fifo riscv64 smoke test passed") + PY + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-musllinux-riscv64-image: "quay.io/pypa/musllinux_1_2_riscv64" + cibw-test-sources: "riscv64_smoke_test.py" + cibw-test-command: "python {package}/riscv64_smoke_test.py" publish: name: Publish faster-fifo ${{ matrix.version }} diff --git a/.github/workflows/build-geoarrow-c.yml b/.github/workflows/build-geoarrow-c.yml index 534378d8e4d1..ced791d7c705 100644 --- a/.github/workflows/build-geoarrow-c.yml +++ b/.github/workflows/build-geoarrow-c.yml @@ -48,51 +48,31 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build geoarrow-c ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - GEOARROW_C_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout geoarrow-c ${{ env.GEOARROW_C_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: geoarrow/geoarrow-c - ref: geoarrow-c-python-${{ env.GEOARROW_C_VERSION }} - persist-credentials: false - - - name: Ship the project LICENSE in the wheel - # Upstream's wheel carries no licence text: the package builds from a - # subdirectory, so setuptools' default license_files glob misses the root LICENSE. - run: cp LICENSE python/geoarrow-c/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python/geoarrow-c - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy,pyarrow - SETUPTOOLS_SCM_PRETEND_VERSION_FOR_GEOARROW_C=${{ env.GEOARROW_C_VERSION }} - # Upstream's wheel test installs only pytest, which skips test_geoarrow_lib.py; - # the test extra (as in upstream's python.yaml) runs it. - CIBW_TEST_EXTRAS: test - CIBW_TEST_COMMAND: pytest {package}/tests -vv - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: geoarrow-c-${{ env.GEOARROW_C_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # Upstream's wheel carries no licence text: the package builds from a + # subdirectory, so setuptools' default license_files glob misses the root LICENSE. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "geoarrow-c" + version: "${{ matrix.version }}" + repository: "geoarrow/geoarrow-c" + ref: "geoarrow-c-python-${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + pre-build: "cp LICENSE python/geoarrow-c/" + cibw-package-dir: "python/geoarrow-c" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-environment-linux: > + PIP_ONLY_BINARY=numpy,pyarrow + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_GEOARROW_C=${{ matrix.version }} + # Upstream's wheel test installs only pytest, which skips test_geoarrow_lib.py; + # the test extra (as in upstream's python.yaml) runs it. + cibw-test-extras: "test" + cibw-test-command: "pytest {package}/tests -vv" publish: name: Publish geoarrow-c ${{ matrix.version }} diff --git a/.github/workflows/build-gpudb.yml b/.github/workflows/build-gpudb.yml index 18d42e61c0a0..3d0ca41b5c06 100644 --- a/.github/workflows/build-gpudb.yml +++ b/.github/workflows/build-gpudb.yml @@ -47,71 +47,51 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build gpudb ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - GPUDB_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout gpudb v${{ env.GPUDB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: kineticadb/kinetica-api-python - ref: v${{ env.GPUDB_VERSION }} - persist-credentials: false - - # Upstream ships no tests that run without a Kinetica server; round-trip - # records through the compiled Avro codec instead. - - name: Write smoke test - run: | - cat > smoke_test.py <<'PY' - import gpudb - from gpudb import GPUdbColumnProperty, GPUdbRecord, GPUdbRecordColumn, GPUdbRecordType - - assert gpudb.protocol.__file__.endswith(".so"), gpudb.protocol.__file__ - - T = GPUdbRecordColumn._ColumnType - columns = [ - GPUdbRecordColumn("i", T.INT), - GPUdbRecordColumn("l", T.LONG), - GPUdbRecordColumn("d", T.DOUBLE), - GPUdbRecordColumn("s", T.STRING), - GPUdbRecordColumn("n", T.STRING, [GPUdbColumnProperty.NULLABLE]), - ] - record_type = GPUdbRecordType(columns, label="smoke") - rows = [ - [-7, 2**40, 3.5, "héllo", None], - [2**31 - 1, -(2**63), -0.25, "", "x"], - ] - encoded = [GPUdbRecord(record_type, row).binary_data for row in rows] - decoded = GPUdbRecord.decode_binary_data(record_type.record_type, encoded) - got = [[record[name] for name in "ildsn"] for record in decoded] - assert got == rows, got - print("gpudb", gpudb.__file__, "round-trip OK") - PY + # Upstream ships no tests that run without a Kinetica server; round-trip + # records through the compiled Avro codec instead. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "gpudb" + version: "${{ matrix.version }}" + repository: "kineticadb/kinetica-api-python" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: |- + cat > smoke_test.py <<'PY' + import gpudb + from gpudb import GPUdbColumnProperty, GPUdbRecord, GPUdbRecordColumn, GPUdbRecordType - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 - # pyzmq's cp314t riscv64 wheel is only on our registry. - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_ENVIRONMENT: 'PIP_ONLY_BINARY=:all:' - CIBW_TEST_SOURCES: smoke_test.py - CIBW_TEST_COMMAND: python smoke_test.py + assert gpudb.protocol.__file__.endswith(".so"), gpudb.protocol.__file__ - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: gpudb-${{ env.GPUDB_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + T = GPUdbRecordColumn._ColumnType + columns = [ + GPUdbRecordColumn("i", T.INT), + GPUdbRecordColumn("l", T.LONG), + GPUdbRecordColumn("d", T.DOUBLE), + GPUdbRecordColumn("s", T.STRING), + GPUdbRecordColumn("n", T.STRING, [GPUdbColumnProperty.NULLABLE]), + ] + record_type = GPUdbRecordType(columns, label="smoke") + rows = [ + [-7, 2**40, 3.5, "héllo", None], + [2**31 - 1, -(2**63), -0.25, "", "x"], + ] + encoded = [GPUdbRecord(record_type, row).binary_data for row in rows] + decoded = GPUdbRecord.decode_binary_data(record_type.record_type, encoded) + got = [[record[name] for name in "ildsn"] for record in decoded] + assert got == rows, got + print("gpudb", gpudb.__file__, "round-trip OK") + PY + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # pyzmq's cp314t riscv64 wheel is only on our registry. + cibw-test-environment: "PIP_ONLY_BINARY=:all:" + cibw-test-sources: "smoke_test.py" + cibw-test-command: "python smoke_test.py" publish: name: Publish gpudb ${{ matrix.version }} diff --git a/.github/workflows/build-graspologic-native.yml b/.github/workflows/build-graspologic-native.yml index eb3b11691bdc..f525999234d1 100644 --- a/.github/workflows/build-graspologic-native.yml +++ b/.github/workflows/build-graspologic-native.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build graspologic-native ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: @@ -60,62 +58,44 @@ jobs: # under Py_GIL_DISABLED, giving the free-threaded build its own wheel. tag: [cp39-abi3, cp314t] - env: - GRASPOLOGIC_NATIVE_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout graspologic-native v${{ env.GRASPOLOGIC_NATIVE_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: graspologic-org/graspologic-native - ref: v${{ env.GRASPOLOGIC_NATIVE_VERSION }} - persist-credentials: false - - - name: Stage the licence beside graspologic-native's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this workspace is packages/pyo3/ -- so upstream's published wheels - # carry no licence text at all. - run: cp LICENSE packages/pyo3/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: packages/pyo3 - output-dir: wheelhouse/ - env: - # Built on cp39 -- the oldest interpreter the abi3 tag claims -- and - # re-tested on the newer ones via find_compatible_wheel. - CIBW_BUILD: >- - ${{ matrix.tag == 'cp39-abi3' && 'cp39-manylinux_riscv64 cp310-manylinux_riscv64 cp311-manylinux_riscv64 cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64' || 'cp314t-manylinux_riscv64' }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # graspologic-native ships no [tool.cibuildwheel], so the Rust - # toolchain its maturin backend needs is installed in-container here. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # numpy and scipy are runtime requirements only our registry has for - # riscv64; only-binary keeps a newer PyPI release from winning the - # resolution and then compiling from sdist. musllinux is dropped: - # our registry has no musllinux_riscv64 wheel for either, so the - # installed wheel's own runtime deps can't resolve there. - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy,scipy - CIBW_TEST_SOURCES: >- - packages/pyo3/tests - packages/network_partitions/tests - CIBW_TEST_COMMAND: >- - cd packages/pyo3 && - python -c "import graspologic_native as m, importlib.metadata as md; - assert m.graspologic_native.__file__.endswith('.so'), m.graspologic_native.__file__; - assert any(str(p).endswith('licenses/LICENSE') for p in md.files('graspologic-native'))" && - python -m unittest - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: graspologic-native-${{ env.GRASPOLOGIC_NATIVE_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this workspace is packages/pyo3/ -- so upstream's published wheels + # carry no licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "graspologic-native" + version: "${{ matrix.version }}" + repository: "graspologic-org/graspologic-native" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 90 + pre-build: "cp LICENSE packages/pyo3/" + cibw-package-dir: "packages/pyo3" + # Built on cp39 -- the oldest interpreter the abi3 tag claims -- and + # re-tested on the newer ones via find_compatible_wheel. + cibw-build: > + ${{ matrix.tag == 'cp39-abi3' && 'cp39-manylinux_riscv64 cp310-manylinux_riscv64 cp311-manylinux_riscv64 cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64' || 'cp314t-manylinux_riscv64' }} + # graspologic-native ships no [tool.cibuildwheel], so the Rust + # toolchain its maturin backend needs is installed in-container here. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # numpy and scipy are runtime requirements only our registry has for + # riscv64; only-binary keeps a newer PyPI release from winning the + # resolution and then compiling from sdist. musllinux is dropped: + # our registry has no musllinux_riscv64 wheel for either, so the + # installed wheel's own runtime deps can't resolve there. + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + PIP_ONLY_BINARY=numpy,scipy + cibw-test-sources: > + packages/pyo3/tests + packages/network_partitions/tests + cibw-test-command: > + cd packages/pyo3 && + python -c "import graspologic_native as m, importlib.metadata as md; + assert m.graspologic_native.__file__.endswith('.so'), m.graspologic_native.__file__; + assert any(str(p).endswith('licenses/LICENSE') for p in md.files('graspologic-native'))" && + python -m unittest publish: name: Publish graspologic-native ${{ matrix.version }} diff --git a/.github/workflows/build-h3.yml b/.github/workflows/build-h3.yml index e18911595bca..5e44f81d884e 100644 --- a/.github/workflows/build-h3.yml +++ b/.github/workflows/build-h3.yml @@ -48,55 +48,35 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build h3 ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - H3_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout h3-py ${{ env.H3_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: uber/h3-py - ref: v${{ env.H3_VERSION }} - # The H3 C library is a submodule and is compiled into the extensions. - submodules: recursive - persist-credentials: false - - # Apache-2.0 4(d): the vendored H3 C library ships a NOTICE that h3-py carries - # nowhere, so no published wheel has it. At the project root it is picked up by - # scikit-build-core's default licence glob with no packaging change. - - name: Stage the H3 C library's NOTICE - run: cp src/h3lib/NOTICE NOTICE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Upstream uses `build[uv]`, which crashes cibuildwheel's audit step on the - # self-hosted riscv64 runner (no host `uv`). - CIBW_BUILD_FRONTEND: build - CIBW_TEST_REQUIRES: pytest pytest-cov numpy - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as m; f = {p.name for p in m.files('h3') if '.dist-info/licenses/' in str(p)}; assert f == {'LICENSE', 'NOTICE'}, f" - && pytest {project}/tests - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # numpy has no riscv64 wheel on public PyPI; keep pip on our registry's copy. - CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: h3-${{ env.H3_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The H3 C library is a submodule and is compiled into the extensions. + # Apache-2.0 4(d): the vendored H3 C library ships a NOTICE that h3-py carries + # nowhere, so no published wheel has it. At the project root it is picked up by + # scikit-build-core's default licence glob with no packaging change. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "h3" + version: "${{ matrix.version }}" + repository: "uber/h3-py" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + checkout-submodules: "recursive" + pre-build: "cp src/h3lib/NOTICE NOTICE" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # Upstream uses `build[uv]`, which crashes cibuildwheel's audit step on the + # self-hosted riscv64 runner (no host `uv`). + cibw-build-frontend: "build" + cibw-test-requires: "pytest pytest-cov numpy" + cibw-test-command: > + python -c "import importlib.metadata as m; f = {p.name for p in m.files('h3') if '.dist-info/licenses/' in str(p)}; assert f == {'LICENSE', 'NOTICE'}, f" + && pytest {project}/tests + # numpy has no riscv64 wheel on public PyPI; keep pip on our registry's copy. + cibw-test-environment: "PIP_ONLY_BINARY=numpy" publish: name: Publish h3 ${{ matrix.version }} diff --git a/.github/workflows/build-hdiffpatch.yml b/.github/workflows/build-hdiffpatch.yml index e51e9aaee63c..7c471553d46b 100644 --- a/.github/workflows/build-hdiffpatch.yml +++ b/.github/workflows/build-hdiffpatch.yml @@ -49,66 +49,49 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build hdiffpatch ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - HDIFFPATCH_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout hdiffpatch v${{ env.HDIFFPATCH_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: BrianPugh/hdiffpatch-python - ref: v${{ env.HDIFFPATCH_VERSION }} - submodules: recursive - persist-credentials: false - - # setup.py compiles HDiffPatch core, zstd, tinyuz, brotli, lzham_codec, - # tamp, lzma, bzip2, zlib, lz4 and libdeflate straight from their - # vendored submodules, but the wheel ships only hdiffpatch-python's own - # Apache-2.0 LICENSE at the project root. The default LICEN[CS]E*/ - # COPYING* glob (PEP 639, no license-files override in pyproject.toml) - # picks up anything added here with no packaging change. - - name: Stage the vendored dependencies' licences - run: | - set -euo pipefail - cp hdiffpatch/_c_src/HDiffPatch/LICENSE LICENSE.hdiffpatch-core - cp hdiffpatch/_c_src/zstd/LICENSE LICENSE.zstd - cp hdiffpatch/_c_src/zstd/COPYING COPYING.zstd - cp hdiffpatch/_c_src/tinyuz/LICENSE LICENSE.tinyuz - cp hdiffpatch/_c_src/brotli/LICENSE LICENSE.brotli - cp hdiffpatch/_c_src/lzham_codec/LICENSE LICENSE.lzham-codec - cp hdiffpatch/_c_src/tamp/LICENSE LICENSE.tamp - cp hdiffpatch/_c_src/bzip2/LICENSE LICENSE.bzip2 - cp hdiffpatch/_c_src/zlib/LICENSE LICENSE.zlib - cp hdiffpatch/_c_src/lz4/LICENSE LICENSE.lz4 - cp hdiffpatch/_c_src/libdeflate/COPYING COPYING.libdeflate - # libmd5 and the lzma submodule carry no standalone LICENSE file; - # reproduce the notice each actually carries (zlib-style header - # comment, LZMA SDK's public-domain doc section). - sed -n '1,21p' hdiffpatch/_c_src/libmd5/md5.h > LICENSE.libmd5 - sed -n '27,38p' hdiffpatch/_c_src/lzma/DOC/lzma-sdk.txt > LICENSE.lzma - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: >- - python -c "import hdiffpatch._c_extension as m; assert m.__file__.endswith('.so'), m.__file__" && - python -m pytest {package}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: hdiffpatch-${{ env.HDIFFPATCH_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # setup.py compiles HDiffPatch core, zstd, tinyuz, brotli, lzham_codec, + # tamp, lzma, bzip2, zlib, lz4 and libdeflate straight from their + # vendored submodules, but the wheel ships only hdiffpatch-python's own + # Apache-2.0 LICENSE at the project root. The default LICEN[CS]E*/ + # COPYING* glob (PEP 639, no license-files override in pyproject.toml) + # picks up anything added here with no packaging change. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "hdiffpatch" + version: "${{ matrix.version }}" + repository: "BrianPugh/hdiffpatch-python" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + checkout-submodules: "recursive" + pre-build: |- + set -euo pipefail + cp hdiffpatch/_c_src/HDiffPatch/LICENSE LICENSE.hdiffpatch-core + cp hdiffpatch/_c_src/zstd/LICENSE LICENSE.zstd + cp hdiffpatch/_c_src/zstd/COPYING COPYING.zstd + cp hdiffpatch/_c_src/tinyuz/LICENSE LICENSE.tinyuz + cp hdiffpatch/_c_src/brotli/LICENSE LICENSE.brotli + cp hdiffpatch/_c_src/lzham_codec/LICENSE LICENSE.lzham-codec + cp hdiffpatch/_c_src/tamp/LICENSE LICENSE.tamp + cp hdiffpatch/_c_src/bzip2/LICENSE LICENSE.bzip2 + cp hdiffpatch/_c_src/zlib/LICENSE LICENSE.zlib + cp hdiffpatch/_c_src/lz4/LICENSE LICENSE.lz4 + cp hdiffpatch/_c_src/libdeflate/COPYING COPYING.libdeflate + # libmd5 and the lzma submodule carry no standalone LICENSE file; + # reproduce the notice each actually carries (zlib-style header + # comment, LZMA SDK's public-domain doc section). + sed -n '1,21p' hdiffpatch/_c_src/libmd5/md5.h > LICENSE.libmd5 + sed -n '27,38p' hdiffpatch/_c_src/lzma/DOC/lzma-sdk.txt > LICENSE.lzma + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-test-requires: "pytest" + cibw-test-command: > + python -c "import hdiffpatch._c_extension as m; assert m.__file__.endswith('.so'), m.__file__" && + python -m pytest {package}/tests publish: name: Publish hdiffpatch ${{ matrix.version }} diff --git a/.github/workflows/build-jsoncompat.yml b/.github/workflows/build-jsoncompat.yml index b490bc8a0b72..bd890c7bd1dd 100644 --- a/.github/workflows/build-jsoncompat.yml +++ b/.github/workflows/build-jsoncompat.yml @@ -49,60 +49,41 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build jsoncompat ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 120 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - JSONCOMPAT_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout jsoncompat v${{ env.JSONCOMPAT_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ostrowr/jsoncompat - ref: v${{ env.JSONCOMPAT_VERSION }} - persist-credentials: false - - - name: Stage the licence beside jsoncompat's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # is pybindings/ in this workspace -- the licence file lives at the - # repo root instead (semantic-text-splitter/moyopy hit the same gap). - run: cp LICENSE pybindings/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: pybindings - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # jsoncompat ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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 importlib.metadata as md, jsoncompat as jsc, jsoncompat._native as native; - assert native.__file__.endswith('.so'), native.__file__; - assert any(str(p).endswith('licenses/LICENSE') for p in md.files('jsoncompat')); - schema = '{\"type\": \"string\", \"minLength\": 1}'; - assert jsc.check_compat(schema, schema, jsc.Role.BOTH) is True; - validator = jsc.validator_for(schema); - assert validator.is_valid_json('\"hello\"') is True; - assert validator.is_valid_json('42') is False; - generator = jsc.generator_for(schema); - assert validator.is_valid_json(generator.generate_value(depth=3)) is True" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: jsoncompat-${{ env.JSONCOMPAT_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # is pybindings/ in this workspace -- the licence file lives at the + # repo root instead (semantic-text-splitter/moyopy hit the same gap). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "jsoncompat" + version: "${{ matrix.version }}" + repository: "ostrowr/jsoncompat" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 120 + pre-build: "cp LICENSE pybindings/" + cibw-package-dir: "pybindings" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # jsoncompat ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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 importlib.metadata as md, jsoncompat as jsc, jsoncompat._native as native; + assert native.__file__.endswith('.so'), native.__file__; + assert any(str(p).endswith('licenses/LICENSE') for p in md.files('jsoncompat')); + schema = '{\"type\": \"string\", \"minLength\": 1}'; + assert jsc.check_compat(schema, schema, jsc.Role.BOTH) is True; + validator = jsc.validator_for(schema); + assert validator.is_valid_json('\"hello\"') is True; + assert validator.is_valid_json('42') is False; + generator = jsc.generator_for(schema); + assert validator.is_valid_json(generator.generate_value(depth=3)) is True" publish: name: Publish jsoncompat ${{ matrix.version }} diff --git a/.github/workflows/build-jsonschema-rs.yml b/.github/workflows/build-jsonschema-rs.yml index c0f4b839f362..bf68de7323f6 100644 --- a/.github/workflows/build-jsonschema-rs.yml +++ b/.github/workflows/build-jsonschema-rs.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build jsonschema-rs ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -70,57 +68,40 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - JSONSCHEMA_RS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout jsonschema python-v${{ env.JSONSCHEMA_RS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Stranger6667/jsonschema - ref: python-v${{ env.JSONSCHEMA_RS_VERSION }} - submodules: true - persist-credentials: false - - - name: Stage the licence beside jsonschema-py's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is crates/jsonschema-py/ -- so upstream's published - # wheels carry no licence text at all. - run: cp LICENSE crates/jsonschema-py/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: crates/jsonschema-py - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # jsonschema-py ships no [tool.cibuildwheel], so the Rust toolchain - # its maturin backend needs is installed in-container here. - 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_REQUIRES: pytest hypothesis flask - CIBW_BEFORE_TEST: pip install {project}/crates/jsonschema-testsuite-pyo3 - CIBW_TEST_SOURCES: >- - crates/jsonschema-py/tests-py crates/jsonschema-py/pyproject.toml - crates/jsonschema-py/README.md crates/jsonschema/tests/suite - # test_http_fetch_external_schema needs a live json-schema.org - # endpoint; every other test is self-contained. - CIBW_TEST_COMMAND: >- - cd crates/jsonschema-py && - python -c "import jsonschema_rs.jsonschema_rs as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - assert any(str(p).endswith('licenses/LICENSE') for p in md.files('jsonschema_rs'))" && - python -m pytest -v tests-py --deselect tests-py/test_http_options.py::test_http_fetch_external_schema - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: jsonschema_rs-${{ env.JSONSCHEMA_RS_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is crates/jsonschema-py/ -- so upstream's published + # wheels carry no licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "jsonschema_rs" + version: "${{ matrix.version }}" + repository: "Stranger6667/jsonschema" + ref: "python-v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + checkout-submodules: "true" + pre-build: "cp LICENSE crates/jsonschema-py/LICENSE" + cibw-package-dir: "crates/jsonschema-py" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # jsonschema-py ships no [tool.cibuildwheel], so the Rust toolchain + # its maturin backend needs is installed in-container here. + 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-requires: "pytest hypothesis flask" + cibw-before-test: "pip install {project}/crates/jsonschema-testsuite-pyo3" + cibw-test-sources: > + crates/jsonschema-py/tests-py crates/jsonschema-py/pyproject.toml + crates/jsonschema-py/README.md crates/jsonschema/tests/suite + # test_http_fetch_external_schema needs a live json-schema.org + # endpoint; every other test is self-contained. + cibw-test-command: > + cd crates/jsonschema-py && + python -c "import jsonschema_rs.jsonschema_rs as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + assert any(str(p).endswith('licenses/LICENSE') for p in md.files('jsonschema_rs'))" && + python -m pytest -v tests-py --deselect tests-py/test_http_options.py::test_http_fetch_external_schema publish: name: Publish jsonschema-rs ${{ matrix.version }} diff --git a/.github/workflows/build-kernels-data.yml b/.github/workflows/build-kernels-data.yml index 71839304e70a..d839915570e8 100644 --- a/.github/workflows/build-kernels-data.yml +++ b/.github/workflows/build-kernels-data.yml @@ -50,8 +50,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build kernels-data ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 120 strategy: fail-fast: false matrix: @@ -73,62 +71,44 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - KERNELS_DATA_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout kernels v${{ env.KERNELS_DATA_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: huggingface/kernels - ref: v${{ env.KERNELS_DATA_VERSION }} - persist-credentials: false - - - name: Stage the licence beside kernels-data's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # is kernels-data/bindings/python/ in this workspace, and ignores the - # `include ../../../LICENSE` in the MANIFEST.in next to it -- so - # upstream's own wheels carry no licence file at all. - run: cp LICENSE kernels-data/bindings/python/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: kernels-data/bindings/python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # kernels-data ships no [tool.cibuildwheel], so the Rust toolchain - # its maturin backend needs is installed in-container here. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # mypy, which upstream's stubtest check needs, publishes no riscv64 - # wheel on public PyPI; ours does. - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_REQUIRES: pytest mypy - CIBW_TEST_SOURCES: >- - kernels-data/bindings/python/tests - kernels-data/bindings/python/stubtest-allowlist.txt - # maturin synthesises kernels_data/__init__.py as a re-export shim, so - # the compiled module is the kernels_data.kernels_data submodule. - CIBW_TEST_COMMAND: >- - python -c "import kernels_data.kernels_data as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - files = md.files('kernels-data'); - assert any(str(p).endswith('licenses/LICENSE') for p in files), files" && - cd kernels-data/bindings/python && - python -m pytest -v tests && - python -m mypy.stubtest kernels_data --allowlist stubtest-allowlist.txt - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: kernels-data-${{ env.KERNELS_DATA_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # is kernels-data/bindings/python/ in this workspace, and ignores the + # `include ../../../LICENSE` in the MANIFEST.in next to it -- so + # upstream's own wheels carry no licence file at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "kernels-data" + version: "${{ matrix.version }}" + repository: "huggingface/kernels" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 120 + pre-build: "cp LICENSE kernels-data/bindings/python/" + cibw-package-dir: "kernels-data/bindings/python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # kernels-data ships no [tool.cibuildwheel], so the Rust toolchain + # its maturin backend needs is installed in-container here. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # mypy, which upstream's stubtest check needs, publishes no riscv64 + # wheel on public PyPI; ours does. + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + cibw-test-requires: "pytest mypy" + cibw-test-sources: > + kernels-data/bindings/python/tests + kernels-data/bindings/python/stubtest-allowlist.txt + # maturin synthesises kernels_data/__init__.py as a re-export shim, so + # the compiled module is the kernels_data.kernels_data submodule. + cibw-test-command: > + python -c "import kernels_data.kernels_data as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + files = md.files('kernels-data'); + assert any(str(p).endswith('licenses/LICENSE') for p in files), files" && + cd kernels-data/bindings/python && + python -m pytest -v tests && + python -m mypy.stubtest kernels_data --allowlist stubtest-allowlist.txt publish: name: Publish kernels-data ${{ matrix.version }} diff --git a/.github/workflows/build-kernels.yml b/.github/workflows/build-kernels.yml index 816a33d2c225..94cf92546ac4 100644 --- a/.github/workflows/build-kernels.yml +++ b/.github/workflows/build-kernels.yml @@ -50,8 +50,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build kernels ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 240 strategy: fail-fast: false matrix: @@ -89,101 +87,83 @@ jobs: --deselect tests/test_variants.py::test_resolve_tagless_preferred_over_abi_tagged --deselect tests/test_variants.py::test_resolve_mixed_abi_tags - env: - KERNELS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout kernels v${{ env.KERNELS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: huggingface/kernels - ref: v${{ env.KERNELS_VERSION }} - persist-credentials: false - - # maturin globs LICEN[CS]E* relative to kernels/pyproject.toml, so upstream's - # own wheels carry no licence file at all. - - name: Stage the licence beside kernels' pyproject.toml - run: cp LICENSE kernels/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: kernels - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - 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" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # sigstore's Rust deps, and matplotlib's pillow dependency: without this - # pip picks a newer PyPI sdist over the registry's riscv64 wheel and - # builds it from source (pillow's needs libjpeg-devel, which this image - # doesn't have: RequiredDependencyException: jpeg). - CIBW_TEST_ENVIRONMENT: >- - HF_HUB_DOWNLOAD_TIMEOUT=60 - PIP_ONLY_BINARY=cryptography,rfc3161-client,pillow - # upstream's uv.lock tests against huggingface-hub 1.x, whose httpx - # dependency tests/test_cli_describe_api.py imports; 2.x moved to httpx2. - CIBW_TEST_REQUIRES: >- - pytest pytest-benchmark mktestdocs mypy setuptools torch - einops matplotlib numpy tabulate "huggingface-hub<2" - CIBW_TEST_SOURCES: kernels/tests kernels/pytest.ini kernels/pyproject.toml - # test_tvm_ffi.py is ignored: kernels-test/relu-tvm-ffi has x86_64 builds - # only, and apache-tvm-ffi has no riscv64 wheel for cp313/cp314. The - # deselected tests download Hub kernels (kernels-community/relu, - # kernels-test-untrusted/ci-test-kernel) published only for x86_64/aarch64 - # or CUDA, or kernelize on "cuda": upstream runs them on GPU runners only. - # pytest exercises torch enough that it writes files into its own - # site-packages/torch tree; pip's uninstall only removes what it - # installed, leaving that tree as an empty-but-importable namespace - # package and breaking the "no torch" check below with AttributeError: - # module 'torch' has no attribute 'version'. Force it gone first. - CIBW_TEST_COMMAND: >- - python -c "import kernels._rust as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - files = md.files('kernels'); - assert any(str(p).endswith('licenses/LICENSE') for p in files), files" && - cd kernels && - python -m mypy.stubtest kernels._rust && - python -m pytest -v -rfEs tests --ignore tests/test_tvm_ffi.py - --deselect tests/test_basic.py::test_local_overrides - --deselect tests/test_basic.py::test_install_kernel_offline_with_revision - --deselect tests/test_basic.py::test_install_kernel_offline_avoids_network - --deselect tests/test_basic.py::test_install_kernel_offline_with_version - --deselect tests/test_basic.py::test_trust_remote_code_allows_trusted_org - --deselect tests/test_basic.py::test_trust_remote_code_flag_allows_untrusted - --deselect tests/test_basic.py::test_trust_remote_code_allowlist_allows_untrusted - --deselect tests/test_layer.py::test_missing_kernel_build_falls_back - --deselect tests/test_loaded_kernels.py::test_get_loaded_kernels_returns_copy - --deselect tests/test_loaded_kernels.py::test_get_kernel_registers_loaded_kernel - --deselect tests/test_loaded_kernels.py::test_repeated_get_kernel_is_cached - --deselect tests/test_loaded_kernels.py::test_get_local_kernel_registers_with_null_repo_info - --deselect tests/test_loaded_kernels.py::test_install_kernel_plus_import_does_not_set_repo_info - --deselect tests/test_resolver.py::test_hub_resolver_resolves_remote_kernel - --deselect tests/test_resolver.py::test_hub_resolver_resolves_revision_to_commit - --deselect tests/test_resolver.py::test_hub_cache_resolver_resolves_cached_kernel - --deselect tests/test_resolver.py::test_hub_cache_resolver_revision_passthrough - --deselect tests/test_resolver.py::test_locked_hub_cache_resolver_resolves_locked_kernel - --deselect tests/test_resolver.py::test_locked_hub_resolver_resolves_locked_revision - --deselect tests/test_verify.py::test_correctly_signed_kernel_passes_with_default_policy - --deselect tests/test_versions.py::test_a_downloaded_revision_resolves_offline - --deselect tests/test_versions.py::test_a_downloaded_version_resolves_offline - ${{ matrix.test-deselect }} && - python -m pip uninstall -y torch && - python -c "import pathlib, shutil, sysconfig; - shutil.rmtree(pathlib.Path(sysconfig.get_paths()['purelib'], 'torch'), ignore_errors=True)" && - python -c "import kernels" && - kernels versions kernels-community/activation - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: kernels-${{ env.KERNELS_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to kernels/pyproject.toml, so upstream's + # own wheels carry no licence file at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "kernels" + version: "${{ matrix.version }}" + repository: "huggingface/kernels" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 240 + pre-build: "cp LICENSE kernels/" + cibw-package-dir: "kernels" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + 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" + # sigstore's Rust deps, and matplotlib's pillow dependency: without this + # pip picks a newer PyPI sdist over the registry's riscv64 wheel and + # builds it from source (pillow's needs libjpeg-devel, which this image + # doesn't have: RequiredDependencyException: jpeg). + cibw-test-environment: > + HF_HUB_DOWNLOAD_TIMEOUT=60 + PIP_ONLY_BINARY=cryptography,rfc3161-client,pillow + # upstream's uv.lock tests against huggingface-hub 1.x, whose httpx + # dependency tests/test_cli_describe_api.py imports; 2.x moved to httpx2. + cibw-test-requires: > + pytest pytest-benchmark mktestdocs mypy setuptools torch + einops matplotlib numpy tabulate "huggingface-hub<2" + cibw-test-sources: "kernels/tests kernels/pytest.ini kernels/pyproject.toml" + # test_tvm_ffi.py is ignored: kernels-test/relu-tvm-ffi has x86_64 builds + # only, and apache-tvm-ffi has no riscv64 wheel for cp313/cp314. The + # deselected tests download Hub kernels (kernels-community/relu, + # kernels-test-untrusted/ci-test-kernel) published only for x86_64/aarch64 + # or CUDA, or kernelize on "cuda": upstream runs them on GPU runners only. + # pytest exercises torch enough that it writes files into its own + # site-packages/torch tree; pip's uninstall only removes what it + # installed, leaving that tree as an empty-but-importable namespace + # package and breaking the "no torch" check below with AttributeError: + # module 'torch' has no attribute 'version'. Force it gone first. + cibw-test-command: > + python -c "import kernels._rust as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + files = md.files('kernels'); + assert any(str(p).endswith('licenses/LICENSE') for p in files), files" && + cd kernels && + python -m mypy.stubtest kernels._rust && + python -m pytest -v -rfEs tests --ignore tests/test_tvm_ffi.py + --deselect tests/test_basic.py::test_local_overrides + --deselect tests/test_basic.py::test_install_kernel_offline_with_revision + --deselect tests/test_basic.py::test_install_kernel_offline_avoids_network + --deselect tests/test_basic.py::test_install_kernel_offline_with_version + --deselect tests/test_basic.py::test_trust_remote_code_allows_trusted_org + --deselect tests/test_basic.py::test_trust_remote_code_flag_allows_untrusted + --deselect tests/test_basic.py::test_trust_remote_code_allowlist_allows_untrusted + --deselect tests/test_layer.py::test_missing_kernel_build_falls_back + --deselect tests/test_loaded_kernels.py::test_get_loaded_kernels_returns_copy + --deselect tests/test_loaded_kernels.py::test_get_kernel_registers_loaded_kernel + --deselect tests/test_loaded_kernels.py::test_repeated_get_kernel_is_cached + --deselect tests/test_loaded_kernels.py::test_get_local_kernel_registers_with_null_repo_info + --deselect tests/test_loaded_kernels.py::test_install_kernel_plus_import_does_not_set_repo_info + --deselect tests/test_resolver.py::test_hub_resolver_resolves_remote_kernel + --deselect tests/test_resolver.py::test_hub_resolver_resolves_revision_to_commit + --deselect tests/test_resolver.py::test_hub_cache_resolver_resolves_cached_kernel + --deselect tests/test_resolver.py::test_hub_cache_resolver_revision_passthrough + --deselect tests/test_resolver.py::test_locked_hub_cache_resolver_resolves_locked_kernel + --deselect tests/test_resolver.py::test_locked_hub_resolver_resolves_locked_revision + --deselect tests/test_verify.py::test_correctly_signed_kernel_passes_with_default_policy + --deselect tests/test_versions.py::test_a_downloaded_revision_resolves_offline + --deselect tests/test_versions.py::test_a_downloaded_version_resolves_offline + ${{ matrix.test-deselect }} && + python -m pip uninstall -y torch && + python -c "import pathlib, shutil, sysconfig; + shutil.rmtree(pathlib.Path(sysconfig.get_paths()['purelib'], 'torch'), ignore_errors=True)" && + python -c "import kernels" && + kernels versions kernels-community/activation publish: name: Publish kernels ${{ matrix.version }} diff --git a/.github/workflows/build-laszip.yml b/.github/workflows/build-laszip.yml index d97822460f39..e26cdf507265 100644 --- a/.github/workflows/build-laszip.yml +++ b/.github/workflows/build-laszip.yml @@ -49,50 +49,29 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build laszip ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - LASZIP_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout laszip-python ${{ env.LASZIP_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: tmontaigu/laszip-python - ref: ${{ env.LASZIP_VERSION }} - persist-credentials: false - - # The vendored LASzip (Apache-2.0) sources live under src/vendor/ rather than - # at the project root, so scikit-build-core's default LICEN[CS]E* glob misses - # it; stage a copy at the root for the glob to pick up (gotcha 32/44). - - name: Stage the vendored LASzip licence - run: cp src/vendor/LASzip-*/COPYING.txt LICENSE.laszip-core - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # scikit-build-core fetches cmake/ninja from PyPI when missing on PATH, - # and pybind11's headers need pip to resolve. - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # laszip/__init__.py is a pure-Python `from .laszip_core import *` shim; - # probe the compiled extension module directly (gotcha 56). - CIBW_TEST_COMMAND: >- - python -c "import laszip.laszip_core as m; assert m.__file__.endswith('.so'), m.__file__; import laszip; laszip.LasZipHeader(); laszip.LasZipDll()" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: laszip-${{ env.LASZIP_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The vendored LASzip (Apache-2.0) sources live under src/vendor/ rather than + # at the project root, so scikit-build-core's default LICEN[CS]E* glob misses + # it; stage a copy at the root for the glob to pick up (gotcha 32/44). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "laszip" + version: "${{ matrix.version }}" + repository: "tmontaigu/laszip-python" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: "cp src/vendor/LASzip-*/COPYING.txt LICENSE.laszip-core" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # scikit-build-core fetches cmake/ninja from PyPI when missing on PATH, + # and pybind11's headers need pip to resolve. + # laszip/__init__.py is a pure-Python `from .laszip_core import *` shim; + # probe the compiled extension module directly (gotcha 56). + cibw-test-command: > + python -c "import laszip.laszip_core as m; assert m.__file__.endswith('.so'), m.__file__; import laszip; laszip.LasZipHeader(); laszip.LasZipDll()" publish: name: Publish laszip ${{ matrix.version }} diff --git a/.github/workflows/build-littlefs-python.yml b/.github/workflows/build-littlefs-python.yml index dd87b5f07adf..3c4f55bc224f 100644 --- a/.github/workflows/build-littlefs-python.yml +++ b/.github/workflows/build-littlefs-python.yml @@ -50,48 +50,30 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build littlefs-python ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - LITTLEFS_PYTHON_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout littlefs-python v${{ env.LITTLEFS_PYTHON_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: jrast/littlefs-python - ref: v${{ env.LITTLEFS_PYTHON_VERSION }} - submodules: recursive - fetch-depth: 0 - persist-credentials: false - - # setup.py has no explicit license_files, so setuptools' default LICEN[CS]E* - # root glob is still active; the extension compiles the vendored littlefs C - # sources in, so stage its licence next to ours (gotcha 44). - - name: Stage the littlefs licence - run: cp littlefs/LICENSE.md LICENSE.littlefs - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as md; got = sorted(p.name for p in md.files('littlefs-python') if '.dist-info/licenses/' in str(p) and p.name); assert got == ['LICENSE', 'LICENSE.littlefs'], got" - && pytest {project}/test - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: littlefs-python-${{ env.LITTLEFS_PYTHON_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # setup.py has no explicit license_files, so setuptools' default LICEN[CS]E* + # root glob is still active; the extension compiles the vendored littlefs C + # sources in, so stage its licence next to ours (gotcha 44). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "littlefs-python" + version: "${{ matrix.version }}" + repository: "jrast/littlefs-python" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + checkout-submodules: "recursive" + checkout-fetch-depth: 0 + pre-build: "cp littlefs/LICENSE.md LICENSE.littlefs" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-musllinux-riscv64-image: "quay.io/pypa/musllinux_1_2_riscv64" + cibw-test-requires: "pytest" + cibw-test-command: > + python -c "import importlib.metadata as md; got = sorted(p.name for p in md.files('littlefs-python') if '.dist-info/licenses/' in str(p) and p.name); assert got == ['LICENSE', 'LICENSE.littlefs'], got" + && pytest {project}/test publish: name: Publish littlefs-python ${{ matrix.version }} diff --git a/.github/workflows/build-longbridge.yml b/.github/workflows/build-longbridge.yml index 95646eb5e300..7c84a5980fb1 100644 --- a/.github/workflows/build-longbridge.yml +++ b/.github/workflows/build-longbridge.yml @@ -49,60 +49,41 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build longbridge ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 240 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - LONGBRIDGE_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout longbridge v${{ env.LONGBRIDGE_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: longbridge/openapi - ref: v${{ env.LONGBRIDGE_VERSION }} - submodules: true - persist-credentials: false - - - name: Stage the licences beside longbridge's pyproject.toml - run: cp LICENSE-APACHE LICENSE-MIT python/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python - output-dir: wheelhouse/ - # musllinux is dropped: the riscv64 musl-hosted rustc segfaulted or hung on the - # cdylib's final compile in 6 of 9 legs; the glibc-hosted one is reliable. - only: ${{ matrix.python }}-${{ matrix.platform }}_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 - # The workspace's fat `lto = true` compile of the cdylib (~1 h in one rustc) aborted - # rustc with heap corruption on 1 of 5 manylinux legs; thin LTO went 4 of 4. - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - CARGO_PROFILE_RELEASE_LTO=thin - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as md, longbridge; - from longbridge.openapi import Config, Market; - files = [str(p) for p in md.files('longbridge')]; - assert any(p.endswith('.so') for p in files), files; - assert any(p.endswith('licenses/LICENSE-MIT') for p in files), files; - assert any(p.endswith('licenses/LICENSE-APACHE') for p in files), files; - Config.from_apikey('app-key', 'app-secret', 'access-token'); - print(Market.US)" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: longbridge-${{ env.LONGBRIDGE_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "longbridge" + version: "${{ matrix.version }}" + repository: "longbridge/openapi" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 240 + checkout-submodules: "true" + pre-build: "cp LICENSE-APACHE LICENSE-MIT python/" + cibw-package-dir: "python" + # musllinux is dropped: the riscv64 musl-hosted rustc segfaulted or hung on the + # cdylib's final compile in 6 of 9 legs; the glibc-hosted one is reliable. + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # The workspace's fat `lto = true` compile of the cdylib (~1 h in one rustc) aborted + # rustc with heap corruption on 1 of 5 manylinux legs; thin LTO went 4 of 4. + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + CARGO_PROFILE_RELEASE_LTO=thin + cibw-test-command: > + python -c "import importlib.metadata as md, longbridge; + from longbridge.openapi import Config, Market; + files = [str(p) for p in md.files('longbridge')]; + assert any(p.endswith('.so') for p in files), files; + assert any(p.endswith('licenses/LICENSE-MIT') for p in files), files; + assert any(p.endswith('licenses/LICENSE-APACHE') for p in files), files; + Config.from_apikey('app-key', 'app-secret', 'access-token'); + print(Market.US)" publish: name: Publish longbridge ${{ matrix.version }} diff --git a/.github/workflows/build-minify-html.yml b/.github/workflows/build-minify-html.yml index eb3b061f52be..7599ddfc0dc8 100644 --- a/.github/workflows/build-minify-html.yml +++ b/.github/workflows/build-minify-html.yml @@ -49,74 +49,53 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build minify-html ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - MINIFY_HTML_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout minify-html v${{ env.MINIFY_HTML_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: wilsonzlin/minify-html - ref: v${{ env.MINIFY_HTML_VERSION }} - persist-credentials: false - - - name: Rename Cargo package to minify_html - # Mirrors upstream's own release workflow (python.yml "Patches" step): - # the crate is named minify-html-python in the Cargo workspace (member - # names must be unique), but maturin derives the wheel/module name from - # Cargo.toml's `name`, and the #[pymodule] fn in src/lib.rs is literally - # named `minify_html` -- so the package must be renamed to match. - run: | - sed -i 's/^name = ".*"$/name = "minify_html"/' minify-html-python/Cargo.toml - grep -qx 'name = "minify_html"' minify-html-python/Cargo.toml - - - name: Bundle LICENSE into the wheel - # minify-html-python/pyproject.toml has no [project] table (metadata - # comes straight from Cargo.toml), so maturin's dir-glob license - # auto-discovery (gotcha 146) never runs; only an explicit Cargo - # `license-file` key gets a licence file into dist-info/licenses/. - # The crate has no LICENSE of its own, so copy the repo-root one in. - run: | - cp LICENSE minify-html-python/LICENSE - sed -i '/^license = /a license-file = "LICENSE"' minify-html-python/Cargo.toml - grep -qx 'license-file = "LICENSE"' minify-html-python/Cargo.toml - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: minify-html-python - output-dir: wheelhouse/ - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # minify-html-python ships no [tool.cibuildwheel], so the Rust - # toolchain its maturin backend needs is installed in-container here. - 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" - # minify_html/__init__.py is maturin's own pyi-stub re-export shim - # ('from .minify_html import *', matching the official PyPI wheel) -- - # the compiled extension is the minify_html.minify_html submodule. - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata, minify_html; - assert minify_html.minify_html.__file__.endswith('.so'), minify_html.minify_html.__file__; - out = minify_html.minify('

Hello world!

', minify_css=True, minify_js=True); - assert out == '

Hello world!', out; - files = {str(p) for p in importlib.metadata.files('minify_html') if '.dist-info/' in str(p)}; - assert any('LICENSE' in f for f in files), files" + # Mirrors upstream's own release workflow (python.yml "Patches" step): + # the crate is named minify-html-python in the Cargo workspace (member + # names must be unique), but maturin derives the wheel/module name from + # Cargo.toml's `name`, and the #[pymodule] fn in src/lib.rs is literally + # named `minify_html` -- so the package must be renamed to match. + # minify-html-python/pyproject.toml has no [project] table (metadata + # comes straight from Cargo.toml), so maturin's dir-glob license + # auto-discovery (gotcha 146) never runs; only an explicit Cargo + # `license-file` key gets a licence file into dist-info/licenses/. + # The crate has no LICENSE of its own, so copy the repo-root one in. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "minify-html" + version: "${{ matrix.version }}" + repository: "wilsonzlin/minify-html" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + pre-build: |- + sed -i 's/^name = ".*"$/name = "minify_html"/' minify-html-python/Cargo.toml + grep -qx 'name = "minify_html"' minify-html-python/Cargo.toml - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: minify-html-${{ env.MINIFY_HTML_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + cp LICENSE minify-html-python/LICENSE + sed -i '/^license = /a license-file = "LICENSE"' minify-html-python/Cargo.toml + grep -qx 'license-file = "LICENSE"' minify-html-python/Cargo.toml + cibw-package-dir: "minify-html-python" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # minify-html-python ships no [tool.cibuildwheel], so the Rust + # toolchain its maturin backend needs is installed in-container here. + 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" + # minify_html/__init__.py is maturin's own pyi-stub re-export shim + # ('from .minify_html import *', matching the official PyPI wheel) -- + # the compiled extension is the minify_html.minify_html submodule. + cibw-test-command: > + python -c "import importlib.metadata, minify_html; + assert minify_html.minify_html.__file__.endswith('.so'), minify_html.minify_html.__file__; + out = minify_html.minify('

Hello world!

', minify_css=True, minify_js=True); + assert out == '

Hello world!', out; + files = {str(p) for p in importlib.metadata.files('minify_html') if '.dist-info/' in str(p)}; + assert any('LICENSE' in f for f in files), files" publish: name: Publish minify-html ${{ matrix.version }} diff --git a/.github/workflows/build-mitmproxy-rs.yml b/.github/workflows/build-mitmproxy-rs.yml index 0d2d03e101b2..1e9037c996bb 100644 --- a/.github/workflows/build-mitmproxy-rs.yml +++ b/.github/workflows/build-mitmproxy-rs.yml @@ -53,151 +53,130 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build mitmproxy-rs ${{ matrix.version }} cp312-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 - - env: - MITMPROXY_RS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout mitmproxy_rs v${{ env.MITMPROXY_RS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: mitmproxy/mitmproxy_rs - ref: v${{ env.MITMPROXY_RS_VERSION }} - persist-credentials: false - - - name: Stage the licence beside mitmproxy-rs's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is mitmproxy-rs/ -- so upstream's own non-x86_64 - # wheels ship no licence text at all (only the x86_64 Linux one does). - run: cp LICENSE mitmproxy-rs/ - - - name: Stage the riscv64 smoke tests - # mitmproxy-rs ships no Python-level test suite of its own -- its - # bindings are exercised by the separate mitmproxy/mitmproxy repo. - # This exercises the compiled extension's non-privileged surface - # directly, mirroring the behaviour asserted by the crate's own - # `#[test]`s (hex_dump, msgpack, syntax_highlight, intercept_conf). - run: | - mkdir -p tests - cat > tests/test_riscv64_smoke.py <<'EOF' - import types - - import pytest - - import mitmproxy_rs - from mitmproxy_rs import certs, contentviews, dns, local, process_info, syntax_highlight, tun, wireguard - - - def test_extension_is_compiled(): - assert mitmproxy_rs.mitmproxy_rs.__file__.endswith(".so"), mitmproxy_rs.mitmproxy_rs.__file__ - - - def test_wireguard_keys(): - private_key = wireguard.genkey() - assert len(private_key) == 44 - public_key = wireguard.pubkey(private_key) - assert len(public_key) == 44 - assert wireguard.pubkey(private_key) == public_key - assert wireguard.genkey() != private_key - - - def test_syntax_highlight(): - assert "yaml" in syntax_highlight.languages() - assert {"name", "number"} <= set(syntax_highlight.tags()) - assert syntax_highlight.highlight("key: 42", "yaml") == [ - ("name", "key"), - ("", ": "), - ("number", "42"), - ] - - - def test_contentviews_hex_dump(): - meta = types.SimpleNamespace() - assert contentviews.hex_dump.prettify(b"abcd", meta) == ( - "0000: 61 62 63 64 abcd" - ) - assert contentviews.hex_dump.prettify(b"", meta) == "" - - - def test_local_redirector_describe_spec(): - assert local.LocalRedirector.describe_spec("") == "Intercept nothing." - assert ( - local.LocalRedirector.describe_spec("curl") - == 'Include processes matching "curl".' - ) - with pytest.raises(ValueError): - local.LocalRedirector.describe_spec(",") - - - def test_unavailable_reason_types(): - assert local.LocalRedirector.unavailable_reason() is None or isinstance( - local.LocalRedirector.unavailable_reason(), str - ) - assert tun.TunInterface.unavailable_reason() is None or isinstance( - tun.TunInterface.unavailable_reason(), str - ) - - - def test_certs_are_macos_only(): - with pytest.raises(NotImplementedError): - certs.add_cert("not a real cert") - with pytest.raises(NotImplementedError): - certs.remove_cert() - - - def test_process_info(): - assert isinstance(process_info.active_executables(), list) - - - def test_dns_system_servers(): - assert isinstance(dns.get_system_dns_servers(), list) - EOF - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: mitmproxy-rs - output-dir: wheelhouse/ - env: - # pyo3's abi3-py312 feature (set unconditionally in - # mitmproxy-rs/Cargo.toml) makes this one wheel; it is built on - # cp312, the oldest interpreter its tag claims and our floor, and - # re-tested on cp313/cp314 via find_compatible_wheel. musllinux is - # dropped: rustup.rs ships no riscv64 musl toolchain. Upstream - # publishes no cp314t wheel for this package either. - CIBW_BUILD: >- - cp312-manylinux_riscv64 cp313-manylinux_riscv64 - cp314-manylinux_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # mitmproxy-rs ships no [tool.cibuildwheel], so the Rust toolchain - # its maturin backend needs is installed in-container here. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # The `docs` feature skips lib.rs's eager `import mitmproxy_linux` - # at module init (no riscv64 wheel exists for it); everything but - # local.start_local_redirector() works without it, and that - # function re-imports mitmproxy_linux itself and raises the same - # error at call time. - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - MATURIN_PEP517_ARGS="--features pyo3/extension-module,docs" - # mitmproxy_rs unconditionally requires mitmproxy_linux on Linux, - # which has no riscv64 wheel or sdist we can build here; skip - # dependency resolution for the wheel install and satisfy pytest - # separately (gotcha 122). - CIBW_TEST_ENVIRONMENT: PIP_NO_DEPS=1 - CIBW_BEFORE_TEST_LINUX: PIP_NO_DEPS=0 pip install pytest - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: tests - CIBW_TEST_COMMAND: python -m pytest -v tests/test_riscv64_smoke.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: mitmproxy-rs-${{ env.MITMPROXY_RS_VERSION }}-cp312-abi3-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is mitmproxy-rs/ -- so upstream's own non-x86_64 + # wheels ship no licence text at all (only the x86_64 Linux one does). + # mitmproxy-rs ships no Python-level test suite of its own -- its + # bindings are exercised by the separate mitmproxy/mitmproxy repo. + # This exercises the compiled extension's non-privileged surface + # directly, mirroring the behaviour asserted by the crate's own + # `#[test]`s (hex_dump, msgpack, syntax_highlight, intercept_conf). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "mitmproxy-rs" + version: "${{ matrix.version }}" + repository: "mitmproxy/mitmproxy_rs" + ref: "v${{ matrix.version }}" + artifact-tag: "cp312-abi3-manylinux_riscv64" + timeout-minutes: 360 + pre-build: |- + cp LICENSE mitmproxy-rs/ + + mkdir -p tests + cat > tests/test_riscv64_smoke.py <<'EOF' + import types + + import pytest + + import mitmproxy_rs + from mitmproxy_rs import certs, contentviews, dns, local, process_info, syntax_highlight, tun, wireguard + + + def test_extension_is_compiled(): + assert mitmproxy_rs.mitmproxy_rs.__file__.endswith(".so"), mitmproxy_rs.mitmproxy_rs.__file__ + + + def test_wireguard_keys(): + private_key = wireguard.genkey() + assert len(private_key) == 44 + public_key = wireguard.pubkey(private_key) + assert len(public_key) == 44 + assert wireguard.pubkey(private_key) == public_key + assert wireguard.genkey() != private_key + + + def test_syntax_highlight(): + assert "yaml" in syntax_highlight.languages() + assert {"name", "number"} <= set(syntax_highlight.tags()) + assert syntax_highlight.highlight("key: 42", "yaml") == [ + ("name", "key"), + ("", ": "), + ("number", "42"), + ] + + + def test_contentviews_hex_dump(): + meta = types.SimpleNamespace() + assert contentviews.hex_dump.prettify(b"abcd", meta) == ( + "0000: 61 62 63 64 abcd" + ) + assert contentviews.hex_dump.prettify(b"", meta) == "" + + + def test_local_redirector_describe_spec(): + assert local.LocalRedirector.describe_spec("") == "Intercept nothing." + assert ( + local.LocalRedirector.describe_spec("curl") + == 'Include processes matching "curl".' + ) + with pytest.raises(ValueError): + local.LocalRedirector.describe_spec(",") + + + def test_unavailable_reason_types(): + assert local.LocalRedirector.unavailable_reason() is None or isinstance( + local.LocalRedirector.unavailable_reason(), str + ) + assert tun.TunInterface.unavailable_reason() is None or isinstance( + tun.TunInterface.unavailable_reason(), str + ) + + + def test_certs_are_macos_only(): + with pytest.raises(NotImplementedError): + certs.add_cert("not a real cert") + with pytest.raises(NotImplementedError): + certs.remove_cert() + + + def test_process_info(): + assert isinstance(process_info.active_executables(), list) + + + def test_dns_system_servers(): + assert isinstance(dns.get_system_dns_servers(), list) + EOF + cibw-package-dir: "mitmproxy-rs" + # pyo3's abi3-py312 feature (set unconditionally in + # mitmproxy-rs/Cargo.toml) makes this one wheel; it is built on + # cp312, the oldest interpreter its tag claims and our floor, and + # re-tested on cp313/cp314 via find_compatible_wheel. musllinux is + # dropped: rustup.rs ships no riscv64 musl toolchain. Upstream + # publishes no cp314t wheel for this package either. + cibw-build: > + cp312-manylinux_riscv64 cp313-manylinux_riscv64 + cp314-manylinux_riscv64 + # mitmproxy-rs ships no [tool.cibuildwheel], so the Rust toolchain + # its maturin backend needs is installed in-container here. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # The `docs` feature skips lib.rs's eager `import mitmproxy_linux` + # at module init (no riscv64 wheel exists for it); everything but + # local.start_local_redirector() works without it, and that + # function re-imports mitmproxy_linux itself and raises the same + # error at call time. + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + MATURIN_PEP517_ARGS="--features pyo3/extension-module,docs" + # mitmproxy_rs unconditionally requires mitmproxy_linux on Linux, + # which has no riscv64 wheel or sdist we can build here; skip + # dependency resolution for the wheel install and satisfy pytest + # separately (gotcha 122). + cibw-test-environment: "PIP_NO_DEPS=1" + cibw-before-test-linux: "PIP_NO_DEPS=0 pip install pytest" + cibw-test-requires: "pytest" + cibw-test-sources: "tests" + cibw-test-command: "python -m pytest -v tests/test_riscv64_smoke.py" publish: name: Publish mitmproxy-rs ${{ matrix.version }} diff --git a/.github/workflows/build-moyopy.yml b/.github/workflows/build-moyopy.yml index c5a89bf65ed1..e16c1de2bef0 100644 --- a/.github/workflows/build-moyopy.yml +++ b/.github/workflows/build-moyopy.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build moyopy ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 120 strategy: fail-fast: false matrix: @@ -82,82 +80,64 @@ jobs: test-requires: pytest numpy test-ignore: --ignore=moyopy/python/tests/test_interface.py - env: - MOYOPY_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout moyo v${{ env.MOYOPY_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: spglib/moyo - ref: v${{ env.MOYOPY_VERSION }} - persist-credentials: false - - - name: Stage the dual licence beside moyopy's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # is moyopy/ in this workspace -- the licence files live at the repo - # root instead, so upstream's own published wheels carry no licence - # text at all (build-primp.yml hits the same gap). - run: cp LICENSE-APACHE LICENSE-MIT moyopy/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: moyopy - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # moyopy's pyproject.toml carries no [tool.cibuildwheel], so the Rust - # toolchain its maturin backend needs is installed in-container here. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # numpy/scipy/pandas/orjson are pymatgen-core's own runtime deps, - # and matplotlib (also pymatgen-core, dragging in contourpy/ - # kiwisolver/pillow) is one too -- none of these eight has a - # riscv64 wheel on public PyPI's newest release, but all do on our - # registry; pymatgen and ase are otherwise pure-Python - # (py3-none-any) and resolve from public PyPI either way. Without - # PIP_ONLY_BINARY, pip picks the highest version across both indexes - # regardless of whether it has a riscv64 wheel, so it reaches past - # our registry's build to PyPI's newer sdist-only release and - # compiles it from source -- scipy needs OpenBLAS headers the - # container lacks, pillow needs libjpeg headers it also lacks, and - # so on (dependencies-and-registry.md gotcha 67/84/291). spglib - # (also pymatgen-core) is deliberately left OUT of this list: our - # registry only carries cp312+ spglib wheels (build-spglib.yml's - # own matrix), so forcing it wheel-only starves cp310/cp311 of any - # candidate at all and sends pip's resolver backtracking through - # every pymatgen release ever published looking for one old enough - # to not depend on spglib -- eventually reaching one (4.4.11) whose - # numpy-distutils-era setup.py hard-crashes under modern numpy - # (gotcha 291's addendum below). Leaving spglib unpinned lets pip - # take our registry's wheel where one exists (cp312+, same version - # as PyPI's so the wheel still wins the tie) and fall back to - # building the sdist where it doesn't (cp310/cp311) -- spglib's - # sdist has no riscv64-specific build step upstream doesn't already - # exercise for other architectures. - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy,scipy,pandas,orjson,pillow,matplotlib,contourpy,kiwisolver - # Mirrors upstream's own `py-test` (moyopy[testing,interface] + pytest - # -v moyopy/python/tests); prek (also in the testing extra) is a - # pre-commit lint runner the suite itself never imports, so it's - # dropped. - CIBW_TEST_REQUIRES: ${{ matrix.test-requires }} - # Stage only the test tree, not the sibling `moyopy/python/moyopy` - # source package, so pytest imports the installed wheel rather than - # shadowing it with the local source (testing-and-shadowing gotchas). - CIBW_TEST_SOURCES: moyopy/python/tests - CIBW_TEST_COMMAND: python -m pytest -v moyopy/python/tests ${{ matrix.test-ignore }} - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: moyopy-${{ env.MOYOPY_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # is moyopy/ in this workspace -- the licence files live at the repo + # root instead, so upstream's own published wheels carry no licence + # text at all (build-primp.yml hits the same gap). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "moyopy" + version: "${{ matrix.version }}" + repository: "spglib/moyo" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 120 + pre-build: "cp LICENSE-APACHE LICENSE-MIT moyopy/" + cibw-package-dir: "moyopy" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # moyopy's pyproject.toml carries no [tool.cibuildwheel], so the Rust + # toolchain its maturin backend needs is installed in-container here. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # numpy/scipy/pandas/orjson are pymatgen-core's own runtime deps, + # and matplotlib (also pymatgen-core, dragging in contourpy/ + # kiwisolver/pillow) is one too -- none of these eight has a + # riscv64 wheel on public PyPI's newest release, but all do on our + # registry; pymatgen and ase are otherwise pure-Python + # (py3-none-any) and resolve from public PyPI either way. Without + # PIP_ONLY_BINARY, pip picks the highest version across both indexes + # regardless of whether it has a riscv64 wheel, so it reaches past + # our registry's build to PyPI's newer sdist-only release and + # compiles it from source -- scipy needs OpenBLAS headers the + # container lacks, pillow needs libjpeg headers it also lacks, and + # so on (dependencies-and-registry.md gotcha 67/84/291). spglib + # (also pymatgen-core) is deliberately left OUT of this list: our + # registry only carries cp312+ spglib wheels (build-spglib.yml's + # own matrix), so forcing it wheel-only starves cp310/cp311 of any + # candidate at all and sends pip's resolver backtracking through + # every pymatgen release ever published looking for one old enough + # to not depend on spglib -- eventually reaching one (4.4.11) whose + # numpy-distutils-era setup.py hard-crashes under modern numpy + # (gotcha 291's addendum below). Leaving spglib unpinned lets pip + # take our registry's wheel where one exists (cp312+, same version + # as PyPI's so the wheel still wins the tie) and fall back to + # building the sdist where it doesn't (cp310/cp311) -- spglib's + # sdist has no riscv64-specific build step upstream doesn't already + # exercise for other architectures. + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + PIP_ONLY_BINARY=numpy,scipy,pandas,orjson,pillow,matplotlib,contourpy,kiwisolver + # Mirrors upstream's own `py-test` (moyopy[testing,interface] + pytest + # -v moyopy/python/tests); prek (also in the testing extra) is a + # pre-commit lint runner the suite itself never imports, so it's + # dropped. + cibw-test-requires: "${{ matrix.test-requires }}" + # Stage only the test tree, not the sibling `moyopy/python/moyopy` + # source package, so pytest imports the installed wheel rather than + # shadowing it with the local source (testing-and-shadowing gotchas). + cibw-test-sources: "moyopy/python/tests" + cibw-test-command: "python -m pytest -v moyopy/python/tests ${{ matrix.test-ignore }}" publish: name: Publish moyopy ${{ matrix.version }} diff --git a/.github/workflows/build-multi-storage-client.yml b/.github/workflows/build-multi-storage-client.yml index 2d2e28dab6e1..64456692573b 100644 --- a/.github/workflows/build-multi-storage-client.yml +++ b/.github/workflows/build-multi-storage-client.yml @@ -49,79 +49,59 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build multi-storage-client ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 120 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - MULTI_STORAGE_CLIENT_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout multi-storage-client ${{ env.MULTI_STORAGE_CLIENT_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: NVIDIA/multi-storage-client - ref: ${{ env.MULTI_STORAGE_CLIENT_VERSION }} - persist-credentials: false - - - name: Stage LICENSE beside multi-storage-client's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # is multi-storage-client/ -- upstream's published wheel carries no - # licence text at all. - run: cp LICENSE multi-storage-client/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: multi-storage-client - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # multi-storage-client ships no [tool.cibuildwheel]; the Rust - # toolchain its maturin backend needs is installed in-container here. - 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" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_REQUIRES: pytest pytest-asyncio boto3 - # test-sources resolves against the checkout root, not package-dir. - CIBW_TEST_SOURCES: >- - multi-storage-client/tests - multi-storage-client/pyproject.toml - # The Rust client's own tests and the cloud-provider tests need a - # local S3-compatible gateway (versitygw) or real cloud credentials - # that CI has neither of, so this runs the provider-agnostic and - # POSIX/mocked-S3 slice of the suite instead. - CIBW_TEST_COMMAND: >- - cd multi-storage-client && - python -c "import multistorageclient_rust.multistorageclient_rust as m; assert m.__file__.endswith('.so'), m.__file__" && - python -m pytest -v - tests/test_multistorageclient/unit/providers/test_base_storage_provider.py - tests/test_multistorageclient/unit/providers/test_file_credentials_provider.py - tests/test_multistorageclient/unit/providers/test_manifest_formats.py - tests/test_multistorageclient/unit/providers/test_manifest_metadata.py - tests/test_multistorageclient/unit/providers/test_metadata_rewrite.py - tests/test_multistorageclient/unit/providers/test_outdated_storage_providers.py - tests/test_multistorageclient/unit/providers/test_posix_file.py - tests/test_multistorageclient/unit/providers/test_symlinks.py - tests/test_multistorageclient/unit/providers/test_s3_checksum_algorithm.py - tests/test_multistorageclient/unit/providers/test_s3_error_translation.py - tests/test_multistorageclient/unit/client - tests/test_multistorageclient/unit/generators - -k "not AWSS3 and not SwiftStack and not GoogleCloudStorage and not AzureBlobStorage and not AIStore and not to_s3_to_posix" - --import-mode=importlib - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: multi-storage-client-${{ env.MULTI_STORAGE_CLIENT_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # is multi-storage-client/ -- upstream's published wheel carries no + # licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "multi-storage-client" + version: "${{ matrix.version }}" + repository: "NVIDIA/multi-storage-client" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 120 + pre-build: "cp LICENSE multi-storage-client/LICENSE" + cibw-package-dir: "multi-storage-client" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # multi-storage-client ships no [tool.cibuildwheel]; the Rust + # toolchain its maturin backend needs is installed in-container here. + 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-requires: "pytest pytest-asyncio boto3" + # test-sources resolves against the checkout root, not package-dir. + cibw-test-sources: > + multi-storage-client/tests + multi-storage-client/pyproject.toml + # The Rust client's own tests and the cloud-provider tests need a + # local S3-compatible gateway (versitygw) or real cloud credentials + # that CI has neither of, so this runs the provider-agnostic and + # POSIX/mocked-S3 slice of the suite instead. + cibw-test-command: > + cd multi-storage-client && + python -c "import multistorageclient_rust.multistorageclient_rust as m; assert m.__file__.endswith('.so'), m.__file__" && + python -m pytest -v + tests/test_multistorageclient/unit/providers/test_base_storage_provider.py + tests/test_multistorageclient/unit/providers/test_file_credentials_provider.py + tests/test_multistorageclient/unit/providers/test_manifest_formats.py + tests/test_multistorageclient/unit/providers/test_manifest_metadata.py + tests/test_multistorageclient/unit/providers/test_metadata_rewrite.py + tests/test_multistorageclient/unit/providers/test_outdated_storage_providers.py + tests/test_multistorageclient/unit/providers/test_posix_file.py + tests/test_multistorageclient/unit/providers/test_symlinks.py + tests/test_multistorageclient/unit/providers/test_s3_checksum_algorithm.py + tests/test_multistorageclient/unit/providers/test_s3_error_translation.py + tests/test_multistorageclient/unit/client + tests/test_multistorageclient/unit/generators + -k "not AWSS3 and not SwiftStack and not GoogleCloudStorage and not AzureBlobStorage and not AIStore and not to_s3_to_posix" + --import-mode=importlib publish: name: Publish multi-storage-client ${{ matrix.version }} diff --git a/.github/workflows/build-obstore.yml b/.github/workflows/build-obstore.yml index 06bc2dd53f7a..5366e730d7cb 100644 --- a/.github/workflows/build-obstore.yml +++ b/.github/workflows/build-obstore.yml @@ -101,82 +101,62 @@ jobs: needs: [setup, plan] if: needs.setup.outputs.versions != '[]' name: Build obstore ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - # 360 wasn't enough: cp311-abi3 stalled compiling the full arrow + - # object_store + reqwest/rustls stack under runner contention and hit - # the job timeout mid-build (still running, not crashed). - timeout-minutes: 480 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.plan.outputs.matrix) }} - env: - OBSTORE_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout obstore py-v${{ env.OBSTORE_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: developmentseed/obstore - ref: py-v${{ env.OBSTORE_VERSION }} - persist-credentials: false - - - name: Stage the licence beside obstore's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is obstore/ -- so upstream's published wheels carry - # no licence text at all, only the classifier. - run: cp LICENSE obstore/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: obstore - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # obstore ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # arro3-core (used by tests/test_list.py) has no riscv64 wheel on - # public PyPI, only on our own registry. - CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=arro3-core - CIBW_TEST_REQUIRES: pytest pytest-asyncio docker minio requests arro3-core - CIBW_TEST_SOURCES: tests - # tests/test_fsspec.py and tests/auth/ need a live Planetary - # Computer/minio endpoint (fsspec, pystac); the handful of other - # tests needing a running minio container are deselected below -- - # everything else runs against MemoryStore/LocalStore or constructs - # requests without ever reaching a server. matrix.test_ignore (from - # the plan job) additionally drops tests/test_list.py below 0.9.0: - # it imports polars/pyarrow at module scope and polars has no - # riscv64 wheel on either index. - CIBW_TEST_COMMAND: >- - python -c "import obstore._obstore as m; assert m.__file__.endswith('.so'), m.__file__" - && python -m pytest -v tests - --ignore=tests/test_fsspec.py - --ignore=tests/auth - ${{ matrix.test_ignore }} - --deselect tests/test_delete.py::test_delete_prefix - --deselect tests/test_buffered.py::test_open_reader_with_prefix - --deselect tests/test_head.py::test_head_with_prefix - --deselect tests/store/test_s3.py::test_list_async - --deselect tests/store/test_s3.py::test_get_async - --deselect tests/store/test_sign.py::test_sign_roundtrip_with_prefix - --deselect tests/store/test_sign.py::test_sign_batch_roundtrip_with_prefix - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: obstore-${{ env.OBSTORE_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # 360 wasn't enough: cp311-abi3 stalled compiling the full arrow + + # object_store + reqwest/rustls stack under runner contention and hit + # the job timeout mid-build (still running, not crashed). + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is obstore/ -- so upstream's published wheels carry + # no licence text at all, only the classifier. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "obstore" + version: "${{ matrix.version }}" + repository: "developmentseed/obstore" + ref: "py-v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 480 + pre-build: "cp LICENSE obstore/LICENSE" + cibw-package-dir: "obstore" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # obstore ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + # arro3-core (used by tests/test_list.py) has no riscv64 wheel on + # public PyPI, only on our own registry. + cibw-test-environment: "PIP_ONLY_BINARY=arro3-core" + cibw-test-requires: "pytest pytest-asyncio docker minio requests arro3-core" + cibw-test-sources: "tests" + # tests/test_fsspec.py and tests/auth/ need a live Planetary + # Computer/minio endpoint (fsspec, pystac); the handful of other + # tests needing a running minio container are deselected below -- + # everything else runs against MemoryStore/LocalStore or constructs + # requests without ever reaching a server. matrix.test_ignore (from + # the plan job) additionally drops tests/test_list.py below 0.9.0: + # it imports polars/pyarrow at module scope and polars has no + # riscv64 wheel on either index. + cibw-test-command: > + python -c "import obstore._obstore as m; assert m.__file__.endswith('.so'), m.__file__" + && python -m pytest -v tests + --ignore=tests/test_fsspec.py + --ignore=tests/auth + ${{ matrix.test_ignore }} + --deselect tests/test_delete.py::test_delete_prefix + --deselect tests/test_buffered.py::test_open_reader_with_prefix + --deselect tests/test_head.py::test_head_with_prefix + --deselect tests/store/test_s3.py::test_list_async + --deselect tests/store/test_s3.py::test_get_async + --deselect tests/store/test_sign.py::test_sign_roundtrip_with_prefix + --deselect tests/store/test_sign.py::test_sign_batch_roundtrip_with_prefix publish: name: Publish obstore ${{ matrix.version }} diff --git a/.github/workflows/build-openexr.yml b/.github/workflows/build-openexr.yml index b0e831ba5626..be62eff8c6da 100644 --- a/.github/workflows/build-openexr.yml +++ b/.github/workflows/build-openexr.yml @@ -52,55 +52,35 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build openexr ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - OPENEXR_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout openexr v${{ env.OPENEXR_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: AcademySoftwareFoundation/openexr - ref: v${{ env.OPENEXR_VERSION }} - persist-credentials: false - - # Imath, libdeflate and OpenJPH are statically linked in (OPENEXR_FORCE_INTERNAL_*), - # but upstream's own wheel only ships LICENSE.md; libdeflate/OpenJPH are vendored - # under external/ while Imath is git-fetched at configure time (gotcha 53), so none - # of the three licences reach dist-info without staging them at the project root. - - name: Stage vendored licences - run: | - cp external/deflate/COPYING LICENSE.deflate - cp external/OpenJPH/LICENSE LICENSE.openjph - curl -fsSL --retry 5 "https://raw.githubusercontent.com/AcademySoftwareFoundation/Imath/${{ env.IMATH_TAG }}/LICENSE.md" -o LICENSE.imath - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # OpenEXR's compiled extension has no Py_mod_gil slot, so cp314t - # re-enables the GIL at import and the test suite's warnings-as-errors - # config turns that into a collection error (gotcha 127). - CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy PYTHON_GIL=1 - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as m; f = sorted(str(p).split('licenses/', 1)[1] for p in m.files('openexr') if '.dist-info/licenses/' in str(p)); assert f == ['LICENSE.deflate', 'LICENSE.imath', 'LICENSE.md', 'LICENSE.openjph'], f" && - pytest -s {project}/src/wrappers/python/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: openexr-${{ env.OPENEXR_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # Imath, libdeflate and OpenJPH are statically linked in (OPENEXR_FORCE_INTERNAL_*), + # but upstream's own wheel only ships LICENSE.md; libdeflate/OpenJPH are vendored + # under external/ while Imath is git-fetched at configure time (gotcha 53), so none + # of the three licences reach dist-info without staging them at the project root. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "openexr" + version: "${{ matrix.version }}" + repository: "AcademySoftwareFoundation/openexr" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + pre-build: |- + cp external/deflate/COPYING LICENSE.deflate + cp external/OpenJPH/LICENSE LICENSE.openjph + curl -fsSL --retry 5 "https://raw.githubusercontent.com/AcademySoftwareFoundation/Imath/v3.2.2/LICENSE.md" -o LICENSE.imath + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # OpenEXR's compiled extension has no Py_mod_gil slot, so cp314t + # re-enables the GIL at import and the test suite's warnings-as-errors + # config turns that into a collection error (gotcha 127). + cibw-test-environment: "PIP_ONLY_BINARY=numpy PYTHON_GIL=1" + cibw-test-command: > + python -c "import importlib.metadata as m; f = sorted(str(p).split('licenses/', 1)[1] for p in m.files('openexr') if '.dist-info/licenses/' in str(p)); assert f == ['LICENSE.deflate', 'LICENSE.imath', 'LICENSE.md', 'LICENSE.openjph'], f" && + pytest -s {project}/src/wrappers/python/tests publish: name: Publish openexr ${{ matrix.version }} diff --git a/.github/workflows/build-openlineage-sql.yml b/.github/workflows/build-openlineage-sql.yml index f2aa579ec5b3..bbdc4bcffa03 100644 --- a/.github/workflows/build-openlineage-sql.yml +++ b/.github/workflows/build-openlineage-sql.yml @@ -80,8 +80,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build openlineage-sql ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: @@ -98,56 +96,39 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - OPENLINEAGE_SQL_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout OpenLineage ${{ env.OPENLINEAGE_SQL_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: OpenLineage/OpenLineage - ref: ${{ env.OPENLINEAGE_SQL_VERSION }} - persist-credentials: false - - - name: Stage LICENSE and NOTICE beside iface-py's pyproject.toml - # maturin globs LICEN[CS]E*/NOTICE* relative to the pyproject - # directory, which is integration/sql/iface-py -- so upstream's - # published wheel carries no licence text at all. - run: cp LICENSE NOTICE.txt integration/sql/iface-py/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: integration/sql/iface-py - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # openlineage-sql ships no [tool.cibuildwheel], so the Rust - # toolchain its maturin backend needs is installed in-container - # here, matching iface-py/script/build.sh. - 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" - CARGO_INCREMENTAL=0 - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: >- - integration/sql/iface-py/tests - integration/sql/iface-py/pyproject.toml - CIBW_TEST_COMMAND: >- - cd integration/sql/iface-py && - python -c "import openlineage_sql.openlineage_sql as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - assert {p.name for p in md.files('openlineage_sql') if 'licenses' in str(p)} == {'LICENSE', 'NOTICE.txt'}" && - python -m pytest -v tests/python - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: openlineage-sql-${{ env.OPENLINEAGE_SQL_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E*/NOTICE* relative to the pyproject + # directory, which is integration/sql/iface-py -- so upstream's + # published wheel carries no licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "openlineage-sql" + version: "${{ matrix.version }}" + repository: "OpenLineage/OpenLineage" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 90 + pre-build: "cp LICENSE NOTICE.txt integration/sql/iface-py/" + cibw-package-dir: "integration/sql/iface-py" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # openlineage-sql ships no [tool.cibuildwheel], so the Rust + # toolchain its maturin backend needs is installed in-container + # here, matching iface-py/script/build.sh. + 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" + CARGO_INCREMENTAL=0 + cibw-test-requires: "pytest" + cibw-test-sources: > + integration/sql/iface-py/tests + integration/sql/iface-py/pyproject.toml + cibw-test-command: > + cd integration/sql/iface-py && + python -c "import openlineage_sql.openlineage_sql as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + assert {p.name for p in md.files('openlineage_sql') if 'licenses' in str(p)} == {'LICENSE', 'NOTICE.txt'}" && + python -m pytest -v tests/python publish: name: Publish openlineage-sql ${{ matrix.version }} diff --git a/.github/workflows/build-pcodec.yml b/.github/workflows/build-pcodec.yml index 211e9e178bf8..e10a7dea0f71 100644 --- a/.github/workflows/build-pcodec.yml +++ b/.github/workflows/build-pcodec.yml @@ -49,66 +49,45 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pcodec ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PCODEC_VERSION: ${{ matrix.version }} - - steps: - # Checked out at the workspace root: pco_python is a member of pcodec's - # Cargo workspace and builds against its sibling pco/better_io crates. - - name: Checkout pcodec Python_v${{ env.PCODEC_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: pcodec/pcodec - ref: Python_v${{ env.PCODEC_VERSION }} - persist-credentials: false - - - name: Stage the licence beside pco_python's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is pco_python/ -- so upstream's published wheels - # carry no licence text at all, only the classifier. - run: cp LICENSE pco_python/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: pco_python - output-dir: wheelhouse/ - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # pco_python ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # numpy is a runtime dependency; public PyPI's newest release always - # outranks our registry's version and has no riscv64 wheel, so pin - # resolution to a binary to avoid a from-source numpy build. - CIBW_TEST_ENVIRONMENT_LINUX: PIP_ONLY_BINARY=numpy - CIBW_TEST_REQUIRES: pytest - # test-sources resolves against the checkout root, not package-dir. - # pco/assets holds the .pco fixture files test_standalone.py reads - # via a ../../pco/assets/*.pco relative path. - CIBW_TEST_SOURCES: pco_python/test pco_python/README.md pco/assets - CIBW_TEST_COMMAND: >- - python -c "import pcodec.pcodec as m; assert m.__file__.endswith('.so'), m.__file__" - && cd pco_python && python -m pytest -v --doctest-glob=*.md test README.md - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pcodec-${{ env.PCODEC_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # Checked out at the workspace root: pco_python is a member of pcodec's + # Cargo workspace and builds against its sibling pco/better_io crates. + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is pco_python/ -- so upstream's published wheels + # carry no licence text at all, only the classifier. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pcodec" + version: "${{ matrix.version }}" + repository: "pcodec/pcodec" + ref: "Python_v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: "cp LICENSE pco_python/LICENSE" + cibw-package-dir: "pco_python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # pco_python ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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" + # numpy is a runtime dependency; public PyPI's newest release always + # outranks our registry's version and has no riscv64 wheel, so pin + # resolution to a binary to avoid a from-source numpy build. + cibw-test-environment-linux: "PIP_ONLY_BINARY=numpy" + cibw-test-requires: "pytest" + # test-sources resolves against the checkout root, not package-dir. + # pco/assets holds the .pco fixture files test_standalone.py reads + # via a ../../pco/assets/*.pco relative path. + cibw-test-sources: "pco_python/test pco_python/README.md pco/assets" + cibw-test-command: > + python -c "import pcodec.pcodec as m; assert m.__file__.endswith('.so'), m.__file__" + && cd pco_python && python -m pytest -v --doctest-glob=*.md test README.md publish: name: Publish pcodec ${{ matrix.version }} diff --git a/.github/workflows/build-pgtask.yml b/.github/workflows/build-pgtask.yml index e771682db3b4..c5c6701229e9 100644 --- a/.github/workflows/build-pgtask.yml +++ b/.github/workflows/build-pgtask.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pgtask ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 180 strategy: fail-fast: false matrix: @@ -83,74 +81,57 @@ jobs: # exercises through its pure-Python API. test_requires: pytest anyio psycopg - env: - PGTASK_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pgtask v${{ env.PGTASK_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Kludex/pgtask - ref: v${{ env.PGTASK_VERSION }} - persist-credentials: false - - - name: Set the release version - # The tagged Cargo.toml still says 0.1.0; upstream's release.yml runs - # scripts/set-release-version.sh before building. Only its workspace - # and path-dependency version edits matter for the wheel (the rest - # needs cargo/jq on the host and touches npm/helm files), so they are - # repeated here. No --locked build, so Cargo.lock is refreshed in-build. - run: | - set -eux - export PGTASK_RELEASE_VERSION="$PGTASK_VERSION" - perl -0pi -e 's/(\[workspace\.package\].*?\nversion = ")[^"]*(")/$1$ENV{PGTASK_RELEASE_VERSION}$2/s' Cargo.toml - for manifest in crates/*/Cargo.toml sdks/python/Cargo.toml; do - perl -pi -e 's/^(pgtask[a-z-]* = \{ path = "[^"]*", version = ")[^"]*(")/$1$ENV{PGTASK_RELEASE_VERSION}$2/' "$manifest" - done - grep -q "^version = \"$PGTASK_VERSION\"" Cargo.toml - - - name: Stage the licence beside pgtask's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, - # which in this workspace is sdks/python/ -- so upstream's published - # wheels carry no licence text at all. - run: cp LICENSE sdks/python/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: sdks/python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # pgtask ships no [tool.cibuildwheel]; the Rust toolchain its - # maturin backend needs is installed in-container here, plus a - # local PostgreSQL server for the test suite (upstream's own - # `python` CI job gets one via a `services:` container, - # unavailable here). - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && - dnf -y install postgresql-server && - install -d -o postgres -g postgres /run/postgresql /var/lib/pgsql/data && - su postgres -c "/usr/bin/initdb -A trust -D /var/lib/pgsql/data" && - su postgres -c "/usr/bin/pg_ctl -D /var/lib/pgsql/data -l /tmp/pg.log -o '-c listen_addresses=127.0.0.1' -w start" && - su postgres -c "/usr/bin/createuser -s pgtask" && - su postgres -c "/usr/bin/createdb -O pgtask pgtask" - CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" - CIBW_TEST_REQUIRES: ${{ matrix.test_requires }} - CIBW_TEST_SOURCES: sdks/python/tests - CIBW_TEST_ENVIRONMENT: PGTASK_DATABASE_URL=postgresql://pgtask:pgtask@127.0.0.1:5432/pgtask - CIBW_TEST_COMMAND: >- - python -c "import pgtask._native as m; - assert m.__file__.endswith('.so'), m.__file__" && - cd sdks/python && python -m pytest -v tests + # The tagged Cargo.toml still says 0.1.0; upstream's release.yml runs + # scripts/set-release-version.sh before building. Only its workspace + # and path-dependency version edits matter for the wheel (the rest + # needs cargo/jq on the host and touches npm/helm files), so they are + # repeated here. No --locked build, so Cargo.lock is refreshed in-build. + # maturin globs LICEN[CS]E* relative to the pyproject directory, + # which in this workspace is sdks/python/ -- so upstream's published + # wheels carry no licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pgtask" + version: "${{ matrix.version }}" + repository: "Kludex/pgtask" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 180 + pre-build: |- + export PGTASK_VERSION='${{ matrix.version }}' + set -eux + export PGTASK_RELEASE_VERSION="$PGTASK_VERSION" + perl -0pi -e 's/(\[workspace\.package\].*?\nversion = ")[^"]*(")/$1$ENV{PGTASK_RELEASE_VERSION}$2/s' Cargo.toml + for manifest in crates/*/Cargo.toml sdks/python/Cargo.toml; do + perl -pi -e 's/^(pgtask[a-z-]* = \{ path = "[^"]*", version = ")[^"]*(")/$1$ENV{PGTASK_RELEASE_VERSION}$2/' "$manifest" + done + grep -q "^version = \"$PGTASK_VERSION\"" Cargo.toml - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pgtask-${{ env.PGTASK_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + cp LICENSE sdks/python/ + cibw-package-dir: "sdks/python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # pgtask ships no [tool.cibuildwheel]; the Rust toolchain its + # maturin backend needs is installed in-container here, plus a + # local PostgreSQL server for the test suite (upstream's own + # `python` CI job gets one via a `services:` container, + # unavailable here). + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && + dnf -y install postgresql-server && + install -d -o postgres -g postgres /run/postgresql /var/lib/pgsql/data && + su postgres -c "/usr/bin/initdb -A trust -D /var/lib/pgsql/data" && + su postgres -c "/usr/bin/pg_ctl -D /var/lib/pgsql/data -l /tmp/pg.log -o '-c listen_addresses=127.0.0.1' -w start" && + su postgres -c "/usr/bin/createuser -s pgtask" && + su postgres -c "/usr/bin/createdb -O pgtask pgtask" + cibw-environment-linux: PATH="$PATH:$HOME/.cargo/bin" + cibw-test-requires: "${{ matrix.test_requires }}" + cibw-test-sources: "sdks/python/tests" + cibw-test-environment: "PGTASK_DATABASE_URL=postgresql://pgtask:pgtask@127.0.0.1:5432/pgtask" + cibw-test-command: > + python -c "import pgtask._native as m; + assert m.__file__.endswith('.so'), m.__file__" && + cd sdks/python && python -m pytest -v tests publish: name: Publish pgtask ${{ matrix.version }} diff --git a/.github/workflows/build-polyglot-sql-chio.yml b/.github/workflows/build-polyglot-sql-chio.yml index 0414fdb35c03..1f0d89f8adde 100644 --- a/.github/workflows/build-polyglot-sql-chio.yml +++ b/.github/workflows/build-polyglot-sql-chio.yml @@ -53,70 +53,49 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build polyglot-sql-chio ${{ matrix.version }} cp312-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv # Real CI (run 43900677814) hit the previous 180-minute cap exactly - # cibuildwheel builds cp312/cp313/cp314 sequentially in one job, each a # full from-scratch maturin/cargo build (plus a fresh rustup install), # with no cache shared across interpreters despite the abi3 target. - timeout-minutes: 360 - - env: - POLYGLOT_SQL_CHIO_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout polyglot python-v${{ env.POLYGLOT_SQL_CHIO_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: chio-labs/polyglot - ref: python-v${{ env.POLYGLOT_SQL_CHIO_VERSION }} - persist-credentials: false - - - name: Stage the licence beside polyglot-sql-python's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is crates/polyglot-sql-python/ -- so upstream's - # published wheels carry no licence text at all, only the MIT - # classifier (confirmed against the real PyPI wheel's dist-info). - run: cp LICENSE crates/polyglot-sql-python/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: crates/polyglot-sql-python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: 'cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64' - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # polyglot-sql-python ships no [tool.cibuildwheel]; the Rust - # toolchain its maturin backend needs is installed in-container. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # Upstream's own CI builds this exact wheel with - # `--features abi3 --manifest-path crates/polyglot-sql-python/Cargo.toml`; - # abi3 selects pyo3's abi3-py312 feature (requires-python is >=3.12). - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - MATURIN_PEP517_ARGS="--features abi3" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: crates/polyglot-sql-python/tests crates/polyglot-sql-python/pyproject.toml - # test_duckdb_datafusion_execution.py self-skips without the - # optional duckdb/datafusion engines installed; test_compat.py - # self-skips without POLYGLOT_API_CONTRACT set. Both are upstream's - # own dev test suite (not run against the wheel in upstream's own - # CI, which only smoke-tests one parse call), run here in full per - # this repo's own testing convention. - CIBW_TEST_COMMAND: >- - python -c "import polyglot_sql._polyglot_sql as m; assert m.__file__.endswith('.so'), m.__file__" - && python -c "import polyglot_sql; assert polyglot_sql.parse_one('SELECT 1', dialect='postgres')" - && cd crates/polyglot-sql-python - && python -m pytest -v tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: polyglot-sql-chio-${{ env.POLYGLOT_SQL_CHIO_VERSION }}-cp312-abi3-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is crates/polyglot-sql-python/ -- so upstream's + # published wheels carry no licence text at all, only the MIT + # classifier (confirmed against the real PyPI wheel's dist-info). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "polyglot-sql-chio" + version: "${{ matrix.version }}" + repository: "chio-labs/polyglot" + ref: "python-v${{ matrix.version }}" + artifact-tag: "cp312-abi3-manylinux_riscv64" + timeout-minutes: 360 + pre-build: "cp LICENSE crates/polyglot-sql-python/LICENSE" + cibw-package-dir: "crates/polyglot-sql-python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64" + # polyglot-sql-python ships no [tool.cibuildwheel]; the Rust + # toolchain its maturin backend needs is installed in-container. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # Upstream's own CI builds this exact wheel with + # `--features abi3 --manifest-path crates/polyglot-sql-python/Cargo.toml`; + # abi3 selects pyo3's abi3-py312 feature (requires-python is >=3.12). + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + MATURIN_PEP517_ARGS="--features abi3" + cibw-test-requires: "pytest" + cibw-test-sources: "crates/polyglot-sql-python/tests crates/polyglot-sql-python/pyproject.toml" + # test_duckdb_datafusion_execution.py self-skips without the + # optional duckdb/datafusion engines installed; test_compat.py + # self-skips without POLYGLOT_API_CONTRACT set. Both are upstream's + # own dev test suite (not run against the wheel in upstream's own + # CI, which only smoke-tests one parse call), run here in full per + # this repo's own testing convention. + cibw-test-command: > + python -c "import polyglot_sql._polyglot_sql as m; assert m.__file__.endswith('.so'), m.__file__" + && python -c "import polyglot_sql; assert polyglot_sql.parse_one('SELECT 1', dialect='postgres')" + && cd crates/polyglot-sql-python + && python -m pytest -v tests publish: name: Publish polyglot-sql-chio ${{ matrix.version }} diff --git a/.github/workflows/build-poselib.yml b/.github/workflows/build-poselib.yml index d1d5c1653c30..0aac75e9e04d 100644 --- a/.github/workflows/build-poselib.yml +++ b/.github/workflows/build-poselib.yml @@ -48,121 +48,102 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build poselib ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - POSELIB_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout PoseLib v${{ env.POSELIB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: PoseLib/PoseLib - ref: v${{ env.POSELIB_VERSION }} - submodules: recursive - persist-credentials: false - - - name: Fix hardcoded version and stage riscv64 smoke test - # The v2.0.5 tag never bumped its hardcoded "2.0.4" version literals - # (setup.py, CMakeLists.txt), so this reproduces the version-injection - # step upstream's own release process evidently runs out-of-band - # (same fix shape as build-stream-unzip.yml's placeholder sed). - # The upstream `tests/test_poselib.py` pulls in posebench, whose - # pyproject.toml now floats to `poselib @ git+...` HEAD (3.0.0-dev), - # conflicting with the 2.0.5 wheel under test; a self-contained smoke - # test avoids that drift (see gotcha precedent for third-party test - # helpers with unpinned dependencies). - run: | - sed -i -E "s/version=\"[0-9]+\.[0-9]+\.[0-9]+\"/version=\"${POSELIB_VERSION}\"/" setup.py - sed -i -E "s/project\(PoseLib VERSION [0-9]+\.[0-9]+\.[0-9]+\)/project(PoseLib VERSION ${POSELIB_VERSION})/" CMakeLists.txt - cat > riscv64_test_poselib.py <<'EOF' - import numpy as np - import poselib - - - def _random_pose(rng): - axis = rng.normal(size=3) - axis /= np.linalg.norm(axis) - angle = rng.uniform(-0.3, 0.3) - K = np.array([[0, -axis[2], axis[1]], [axis[2], 0, -axis[0]], [-axis[1], axis[0], 0]]) - R = np.eye(3) + np.sin(angle) * K + (1 - np.cos(angle)) * (K @ K) - t = np.array([0.1, -0.05, 0.2]) - return R, t - - - def test_version(): - assert poselib.__version__ - - - def test_estimate_absolute_pose_recovers_known_pose(): - rng = np.random.default_rng(42) - n_points = 50 - X = rng.uniform(-2.0, 2.0, size=(n_points, 3)) - X[:, 2] += 6.0 - - R_true, t_true = _random_pose(rng) - - camera = {"model": "SIMPLE_PINHOLE", "width": 1280, "height": 720, "params": [1000.0, 640.0, 360.0]} - f, cx, cy = camera["params"] - - Xc = (R_true @ X.T).T + t_true - assert np.all(Xc[:, 2] > 0) - p2d = np.stack([f * Xc[:, 0] / Xc[:, 2] + cx, f * Xc[:, 1] / Xc[:, 2] + cy], axis=1) - - pose, info = poselib.estimate_absolute_pose(list(p2d), list(X), camera, {"max_reproj_error": 4.0}, {}) - - assert info["num_inliers"] >= n_points - 2 - np.testing.assert_allclose(pose.R, R_true, atol=1e-3) - np.testing.assert_allclose(pose.t, t_true, atol=1e-3) - - - def test_p3p_minimal_solver(): - rng = np.random.default_rng(7) - X = rng.uniform(-1.0, 1.0, size=(3, 3)) - X[:, 2] += 4.0 - - R_true, t_true = _random_pose(rng) - Xc = (R_true @ X.T).T + t_true - x = Xc / np.linalg.norm(Xc, axis=1, keepdims=True) - - poses = poselib.p3p(list(x), list(X)) - assert poses - best = min(poses, key=lambda p: np.linalg.norm(p.R - R_true) + np.linalg.norm(p.t - t_true)) - np.testing.assert_allclose(best.R, R_true, atol=1e-6) - np.testing.assert_allclose(best.t, t_true, atol=1e-6) - EOF - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL_LINUX: yum install -y eigen3-devel - CIBW_ENVIRONMENT: >- - BUILD_SHARED_LIBS=OFF - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy - # Clears upstream's own [tool.cibuildwheel] test-extras = ["test"] - # (env vars fully replace, not merge, pyproject.toml cibuildwheel - # options) - it would otherwise still pull in posebench regardless - # of CIBW_TEST_COMMAND below. - CIBW_TEST_EXTRAS: "" - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: riscv64_test_poselib.py - CIBW_TEST_COMMAND: python -m pytest {project}/riscv64_test_poselib.py -v - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: poselib-${{ env.POSELIB_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The v2.0.5 tag never bumped its hardcoded "2.0.4" version literals + # (setup.py, CMakeLists.txt), so this reproduces the version-injection + # step upstream's own release process evidently runs out-of-band + # (same fix shape as build-stream-unzip.yml's placeholder sed). + # The upstream `tests/test_poselib.py` pulls in posebench, whose + # pyproject.toml now floats to `poselib @ git+...` HEAD (3.0.0-dev), + # conflicting with the 2.0.5 wheel under test; a self-contained smoke + # test avoids that drift (see gotcha precedent for third-party test + # helpers with unpinned dependencies). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "poselib" + version: "${{ matrix.version }}" + repository: "PoseLib/PoseLib" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + checkout-submodules: "recursive" + pre-build: |- + export POSELIB_VERSION='${{ matrix.version }}' + sed -i -E "s/version=\"[0-9]+\.[0-9]+\.[0-9]+\"/version=\"${POSELIB_VERSION}\"/" setup.py + sed -i -E "s/project\(PoseLib VERSION [0-9]+\.[0-9]+\.[0-9]+\)/project(PoseLib VERSION ${POSELIB_VERSION})/" CMakeLists.txt + cat > riscv64_test_poselib.py <<'EOF' + import numpy as np + import poselib + + + def _random_pose(rng): + axis = rng.normal(size=3) + axis /= np.linalg.norm(axis) + angle = rng.uniform(-0.3, 0.3) + K = np.array([[0, -axis[2], axis[1]], [axis[2], 0, -axis[0]], [-axis[1], axis[0], 0]]) + R = np.eye(3) + np.sin(angle) * K + (1 - np.cos(angle)) * (K @ K) + t = np.array([0.1, -0.05, 0.2]) + return R, t + + + def test_version(): + assert poselib.__version__ + + + def test_estimate_absolute_pose_recovers_known_pose(): + rng = np.random.default_rng(42) + n_points = 50 + X = rng.uniform(-2.0, 2.0, size=(n_points, 3)) + X[:, 2] += 6.0 + + R_true, t_true = _random_pose(rng) + + camera = {"model": "SIMPLE_PINHOLE", "width": 1280, "height": 720, "params": [1000.0, 640.0, 360.0]} + f, cx, cy = camera["params"] + + Xc = (R_true @ X.T).T + t_true + assert np.all(Xc[:, 2] > 0) + p2d = np.stack([f * Xc[:, 0] / Xc[:, 2] + cx, f * Xc[:, 1] / Xc[:, 2] + cy], axis=1) + + pose, info = poselib.estimate_absolute_pose(list(p2d), list(X), camera, {"max_reproj_error": 4.0}, {}) + + assert info["num_inliers"] >= n_points - 2 + np.testing.assert_allclose(pose.R, R_true, atol=1e-3) + np.testing.assert_allclose(pose.t, t_true, atol=1e-3) + + + def test_p3p_minimal_solver(): + rng = np.random.default_rng(7) + X = rng.uniform(-1.0, 1.0, size=(3, 3)) + X[:, 2] += 4.0 + + R_true, t_true = _random_pose(rng) + Xc = (R_true @ X.T).T + t_true + x = Xc / np.linalg.norm(Xc, axis=1, keepdims=True) + + poses = poselib.p3p(list(x), list(X)) + assert poses + best = min(poses, key=lambda p: np.linalg.norm(p.R - R_true) + np.linalg.norm(p.t - t_true)) + np.testing.assert_allclose(best.R, R_true, atol=1e-6) + np.testing.assert_allclose(best.t, t_true, atol=1e-6) + EOF + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-before-all-linux: "yum install -y eigen3-devel" + cibw-environment-linux: > + BUILD_SHARED_LIBS=OFF + PIP_ONLY_BINARY=numpy + # Clears upstream's own [tool.cibuildwheel] test-extras = ["test"] + # (env vars fully replace, not merge, pyproject.toml cibuildwheel + # options) - it would otherwise still pull in posebench regardless + # of CIBW_TEST_COMMAND below. + cibw-test-extras: '' + cibw-test-requires: "pytest" + cibw-test-sources: "riscv64_test_poselib.py" + cibw-test-command: "python -m pytest {project}/riscv64_test_poselib.py -v" publish: name: Publish poselib ${{ matrix.version }} diff --git a/.github/workflows/build-primp.yml b/.github/workflows/build-primp.yml index d3b8bef9f438..fea259328eb7 100644 --- a/.github/workflows/build-primp.yml +++ b/.github/workflows/build-primp.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build primp ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -70,55 +68,38 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - PRIMP_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout primp v${{ env.PRIMP_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: deedy5/primp - ref: v${{ env.PRIMP_VERSION }} - persist-credentials: false - - - name: Stage the licence beside primp's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this workspace is crates/primp-python/ -- so upstream's published - # wheels carry no licence text at all. - run: cp LICENSE crates/primp-python/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: crates/primp-python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # primp ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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_REQUIRES: pytest pytest-asyncio certifi - CIBW_TEST_SOURCES: >- - crates/primp-python/tests - crates/primp-python/pyproject.toml - # `internet` marks two tests that assert TLS fingerprints returned by - # an external service. - CIBW_TEST_COMMAND: >- - cd crates/primp-python && - python -c "import primp.primp as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - assert any(str(p).endswith('licenses/LICENSE') for p in md.files('primp'))" && - python -m pytest -v -m "not internet" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: primp-${{ env.PRIMP_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this workspace is crates/primp-python/ -- so upstream's published + # wheels carry no licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "primp" + version: "${{ matrix.version }}" + repository: "deedy5/primp" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + pre-build: "cp LICENSE crates/primp-python/" + cibw-package-dir: "crates/primp-python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # primp ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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-requires: "pytest pytest-asyncio certifi" + cibw-test-sources: > + crates/primp-python/tests + crates/primp-python/pyproject.toml + # `internet` marks two tests that assert TLS fingerprints returned by + # an external service. + cibw-test-command: > + cd crates/primp-python && + python -c "import primp.primp as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + assert any(str(p).endswith('licenses/LICENSE') for p in md.files('primp'))" && + python -m pytest -v -m "not internet" publish: name: Publish primp ${{ matrix.version }} diff --git a/.github/workflows/build-protobuf-py-ext.yml b/.github/workflows/build-protobuf-py-ext.yml index c306a743346a..c353f843697e 100644 --- a/.github/workflows/build-protobuf-py-ext.yml +++ b/.github/workflows/build-protobuf-py-ext.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build protobuf-py-ext ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -79,132 +77,111 @@ jobs: build: cp314t-manylinux_riscv64 features: '' - env: - PROTOBUF_PY_EXT_VERSION: ${{ matrix.version }} + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this monorepo is packages/protobuf-py-ext/ -- so upstream's + # published wheels carry no licence text at all, only the + # License-Expression classifier. + # Newer releases already link the root LICENSE into the package directory, + # where cp refuses to copy a file onto itself. + # Upstream's own tests/ directory exercises protobuf-py-ext only through + # the parent protobuf-py package's descriptor/codegen pipeline (buf/protoc, + # neither available for riscv64). test_ext_marshaler.py is the one upstream + # test that needs neither: it asserts protobuf._native_message.NativeMessageClass + # is wired once protobuf-py-ext is importable. This mirrors that test plus + # direct checks of the extension's public, descriptor-free surface. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "protobuf-py-ext" + version: "${{ matrix.version }}" + repository: "bufbuild/protobuf-py" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + pre-build: |- + [ LICENSE -ef packages/protobuf-py-ext/LICENSE ] || cp LICENSE packages/protobuf-py-ext/ + + cat > riscv64_smoke.ini <<'EOF' + [pytest] + EOF + + cat > test_riscv64_smoke.py <<'EOF' + import importlib.metadata + + import pytest + + + def test_extension_is_compiled(): + from protobuf_ext import _protobuf_ext + + assert _protobuf_ext.__file__.endswith(".so"), _protobuf_ext.__file__ + + + def test_license_is_packaged(): + files = importlib.metadata.files("protobuf-py-ext") + licenses = [ + str(path) for path in files if ".dist-info/licenses/" in str(path) + ] + assert licenses, "no licence file packaged in the wheel" + + + def test_oneof(): + from protobuf_ext import Oneof + + oneof = Oneof("kind", 42) + assert oneof.field == "kind" + assert oneof.value == 42 + assert oneof == Oneof("kind", 42) + assert oneof != Oneof("other", 42) + assert repr(oneof) == "Oneof(field='kind', value=42)" + + + def test_generic_setattr(): + from protobuf_ext import generic_setattr + + class Slotted: + __slots__ = ("value",) + + obj = Slotted() + generic_setattr(obj, "value", 7) + assert obj.value == 7 + + with pytest.raises(AttributeError): + generic_setattr(obj, "missing", 1) + + + def test_native_message_class_shape(): + # Constructing a bare NativeMessage() hangs indefinitely on riscv64 + # (reproduced twice in CI): its __new__ is only ever exercised by + # protobuf-py's own protoc-generated subclasses, which always wire + # a marshaler first via initialize_message_type -- a descriptor + # pool that needs buf/protoc, unavailable here. Check its shape + # without instantiating it. + from protobuf_ext import NativeMessage + + assert NativeMessage.__module__ == "protobuf_ext" + assert NativeMessage.to_binary + assert NativeMessage.to_json + + + def test_marshaler_implementation_is_native(): + from protobuf._native_message import NativeMessageClass - steps: - - name: Checkout protobuf-py v${{ env.PROTOBUF_PY_EXT_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: bufbuild/protobuf-py - ref: v${{ env.PROTOBUF_PY_EXT_VERSION }} - persist-credentials: false - - - name: Stage the licence beside protobuf-py-ext's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this monorepo is packages/protobuf-py-ext/ -- so upstream's - # published wheels carry no licence text at all, only the - # License-Expression classifier. - # Newer releases already link the root LICENSE into the package directory, - # where cp refuses to copy a file onto itself. - run: | - [ LICENSE -ef packages/protobuf-py-ext/LICENSE ] || cp LICENSE packages/protobuf-py-ext/ - - - name: Stage the riscv64 smoke tests - # Upstream's own tests/ directory exercises protobuf-py-ext only through - # the parent protobuf-py package's descriptor/codegen pipeline (buf/protoc, - # neither available for riscv64). test_ext_marshaler.py is the one upstream - # test that needs neither: it asserts protobuf._native_message.NativeMessageClass - # is wired once protobuf-py-ext is importable. This mirrors that test plus - # direct checks of the extension's public, descriptor-free surface. - run: | - cat > riscv64_smoke.ini <<'EOF' - [pytest] - EOF - - cat > test_riscv64_smoke.py <<'EOF' - import importlib.metadata - - import pytest - - - def test_extension_is_compiled(): - from protobuf_ext import _protobuf_ext - - assert _protobuf_ext.__file__.endswith(".so"), _protobuf_ext.__file__ - - - def test_license_is_packaged(): - files = importlib.metadata.files("protobuf-py-ext") - licenses = [ - str(path) for path in files if ".dist-info/licenses/" in str(path) - ] - assert licenses, "no licence file packaged in the wheel" - - - def test_oneof(): - from protobuf_ext import Oneof - - oneof = Oneof("kind", 42) - assert oneof.field == "kind" - assert oneof.value == 42 - assert oneof == Oneof("kind", 42) - assert oneof != Oneof("other", 42) - assert repr(oneof) == "Oneof(field='kind', value=42)" - - - def test_generic_setattr(): - from protobuf_ext import generic_setattr - - class Slotted: - __slots__ = ("value",) - - obj = Slotted() - generic_setattr(obj, "value", 7) - assert obj.value == 7 - - with pytest.raises(AttributeError): - generic_setattr(obj, "missing", 1) - - - def test_native_message_class_shape(): - # Constructing a bare NativeMessage() hangs indefinitely on riscv64 - # (reproduced twice in CI): its __new__ is only ever exercised by - # protobuf-py's own protoc-generated subclasses, which always wire - # a marshaler first via initialize_message_type -- a descriptor - # pool that needs buf/protoc, unavailable here. Check its shape - # without instantiating it. - from protobuf_ext import NativeMessage - - assert NativeMessage.__module__ == "protobuf_ext" - assert NativeMessage.to_binary - assert NativeMessage.to_json - - - def test_marshaler_implementation_is_native(): - from protobuf._native_message import NativeMessageClass - - assert NativeMessageClass is not None - EOF - - - name: Build and test wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: packages/protobuf-py-ext - output-dir: wheelhouse/ - env: - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # protobuf-py-ext ships no [tool.cibuildwheel], so the Rust toolchain - # its maturin backend needs is installed in-container here. - 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" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_REQUIRES: pytest protobuf-py==${{ env.PROTOBUF_PY_EXT_VERSION }} - # The checkout's own root pyproject.toml sets [tool.pytest] addopts to - # --benchmark-disable/--benchmark-group-by, which pytest picks up as the - # inifile by proximity even for an explicit file target; pytest-benchmark - # isn't installed here, so -c points at an empty ini instead. - CIBW_TEST_COMMAND: python -m pytest -vv -c {project}/riscv64_smoke.ini {project}/test_riscv64_smoke.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: protobuf-py-ext-${{ env.PROTOBUF_PY_EXT_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + assert NativeMessageClass is not None + EOF + cibw-package-dir: "packages/protobuf-py-ext" + cibw-build: "${{ matrix.build }}" + # protobuf-py-ext ships no [tool.cibuildwheel], so the Rust toolchain + # its maturin backend needs is installed in-container here. + 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" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + cibw-test-requires: "pytest protobuf-py==${{ matrix.version }}" + # The checkout's own root pyproject.toml sets [tool.pytest] addopts to + # --benchmark-disable/--benchmark-group-by, which pytest picks up as the + # inifile by proximity even for an explicit file target; pytest-benchmark + # isn't installed here, so -c points at an empty ini instead. + cibw-test-command: "python -m pytest -vv -c {project}/riscv64_smoke.ini {project}/test_riscv64_smoke.py" publish: name: Publish protobuf-py-ext ${{ matrix.version }} diff --git a/.github/workflows/build-pyfaup-rs.yml b/.github/workflows/build-pyfaup-rs.yml index 3f2553aa6c4d..15b1d4f0bfe4 100644 --- a/.github/workflows/build-pyfaup-rs.yml +++ b/.github/workflows/build-pyfaup-rs.yml @@ -49,57 +49,37 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pyfaup-rs ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PYFAUP_RS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout faup-rs pyfaup-rs-v${{ env.PYFAUP_RS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ail-project/faup-rs - ref: pyfaup-rs-v${{ env.PYFAUP_RS_VERSION }} - persist-credentials: false - - - name: Stage LICENSE beside python/pyproject.toml - # maturin auto-discovers LICENSE* files relative to the pyproject.toml - # directory (python/), not the workspace root where LICENSE actually - # lives -- upstream's own published wheel ships no licence file at all. - run: cp LICENSE python/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # pyfaup-rs ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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_REQUIRES: pytest - CIBW_TEST_SOURCES: python/tests - CIBW_TEST_COMMAND: >- - python -c "import pyfaup.pyfaup as ext, importlib.metadata as md; - assert ext.__file__.endswith('.so'), ext.__file__; - assert {p.name for p in md.files('pyfaup-rs') if 'licenses' in str(p)} == {'LICENSE'}" && - python -m pytest -v python/tests/test_pyfaup.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pyfaup-rs-${{ env.PYFAUP_RS_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin auto-discovers LICENSE* files relative to the pyproject.toml + # directory (python/), not the workspace root where LICENSE actually + # lives -- upstream's own published wheel ships no licence file at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pyfaup-rs" + version: "${{ matrix.version }}" + repository: "ail-project/faup-rs" + ref: "pyfaup-rs-v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: "cp LICENSE python/" + cibw-package-dir: "python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # pyfaup-rs ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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-requires: "pytest" + cibw-test-sources: "python/tests" + cibw-test-command: > + python -c "import pyfaup.pyfaup as ext, importlib.metadata as md; + assert ext.__file__.endswith('.so'), ext.__file__; + assert {p.name for p in md.files('pyfaup-rs') if 'licenses' in str(p)} == {'LICENSE'}" && + python -m pytest -v python/tests/test_pyfaup.py publish: name: Publish pyfaup-rs ${{ matrix.version }} diff --git a/.github/workflows/build-pyffish.yml b/.github/workflows/build-pyffish.yml index a082023c018e..34cbb94f515f 100644 --- a/.github/workflows/build-pyffish.yml +++ b/.github/workflows/build-pyffish.yml @@ -51,42 +51,22 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pyffish ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PYFFISH_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout Fairy-Stockfish ${{ env.PYFFISH_COMMIT }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: gbtami/Fairy-Stockfish - ref: ${{ env.PYFFISH_COMMIT }} - persist-credentials: false - - - name: Stage licence file - run: cp Copying.txt LICENSE - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_COMMAND: >- - python -c "import runpy; runpy.run_path(r'{project}/test.py', run_name='__main__')" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pyffish-${{ env.PYFFISH_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pyffish" + version: "${{ matrix.version }}" + repository: "gbtami/Fairy-Stockfish" + ref: "9d2499c8cf57427279effecea9523d8168c88f91" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: "cp Copying.txt LICENSE" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-test-command: > + python -c "import runpy; runpy.run_path(r'{project}/test.py', run_name='__main__')" publish: name: Publish pyffish ${{ matrix.version }} diff --git a/.github/workflows/build-pylibmagic.yml b/.github/workflows/build-pylibmagic.yml index 2cca4d61a1f0..de4cc8327df1 100644 --- a/.github/workflows/build-pylibmagic.yml +++ b/.github/workflows/build-pylibmagic.yml @@ -49,55 +49,34 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pylibmagic ${{ matrix.version }} cp312-${{ matrix.libc }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} libc: [manylinux, musllinux] - env: - PYLIBMAGIC_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pylibmagic v${{ env.PYLIBMAGIC_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: kratsg/pylibmagic - ref: v${{ env.PYLIBMAGIC_VERSION }} - fetch-depth: 0 - persist-credentials: false - - # CMakeLists.txt fetches and bundles libmagic (file) at build time but the wheel ships - # only pylibmagic's LICENSE; scikit-build-core's default glob picks this up (gotcha 53). - - name: Stage libmagic licence - run: | - tag=$(sed -n 's/^ *GIT_TAG *//p' CMakeLists.txt) - curl -fsSL --retry 5 -o LICENSE.libmagic "https://raw.githubusercontent.com/file/file/${tag}/COPYING" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: cp312-${{ matrix.libc }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_SOURCES: tests pyproject.toml - CIBW_TEST_COMMAND: >- - pytest tests && - python -c "import importlib.metadata as md; - licenses = {str(f) for f in md.files('pylibmagic') if '.dist-info/licenses/' in str(f)}; - assert any(l.endswith('/LICENSE') for l in licenses), licenses; - assert any(l.endswith('/LICENSE.libmagic') for l in licenses), licenses" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pylibmagic-${{ matrix.version }}-cp312-${{ matrix.libc }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # CMakeLists.txt fetches and bundles libmagic (file) at build time but the wheel ships + # only pylibmagic's LICENSE; scikit-build-core's default glob picks this up (gotcha 53). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pylibmagic" + version: "${{ matrix.version }}" + repository: "kratsg/pylibmagic" + ref: "v${{ matrix.version }}" + artifact-tag: "cp312-${{ matrix.libc }}_riscv64" + checkout-fetch-depth: 0 + pre-build: |- + tag=$(sed -n 's/^ *GIT_TAG *//p' CMakeLists.txt) + curl -fsSL --retry 5 -o LICENSE.libmagic "https://raw.githubusercontent.com/file/file/${tag}/COPYING" + cibw-build: "cp312-${{ matrix.libc }}_riscv64" + cibw-musllinux-riscv64-image: "quay.io/pypa/musllinux_1_2_riscv64" + cibw-test-sources: "tests pyproject.toml" + cibw-test-command: > + pytest tests && + python -c "import importlib.metadata as md; + licenses = {str(f) for f in md.files('pylibmagic') if '.dist-info/licenses/' in str(f)}; + assert any(l.endswith('/LICENSE') for l in licenses), licenses; + assert any(l.endswith('/LICENSE.libmagic') for l in licenses), licenses" publish: name: Publish pylibmagic ${{ matrix.version }} diff --git a/.github/workflows/build-pyqwest.yml b/.github/workflows/build-pyqwest.yml index 8ac30136bfd7..c6b8dc32e819 100644 --- a/.github/workflows/build-pyqwest.yml +++ b/.github/workflows/build-pyqwest.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pyqwest ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -74,122 +72,105 @@ jobs: build: cp314t-manylinux_riscv64 features: --features pyo3/extension-module - env: - PYQWEST_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pyqwest v${{ env.PYQWEST_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: curioswitch/pyqwest - ref: v${{ env.PYQWEST_VERSION }} - persist-credentials: false - - - name: Replace tests/conftest.py to drop the pyvoy-based local server - # The real conftest.py imports pyvoy unconditionally to run a local - # Envoy-based test server; pyvoy bundles Envoy and ships no riscv64 - # wheel anywhere. This keeps only the anyio backend fixtures, the - # asyncio_only deselection hook and the client_type fixture (copied - # verbatim) needed by the self-contained subset of tests below -- - # none of them need the live server. - run: | - cat > tests/conftest.py <<'EOF' - from __future__ import annotations - - import pytest - import sniffio - - - @pytest.fixture(scope="session", params=["asyncio", "trio"]) - def anyio_backend(request: pytest.FixtureRequest) -> str: - return request.param - - - @pytest.fixture(autouse=True) - def no_stale_runner(request: pytest.FixtureRequest) -> None: - callspec = getattr(request.node, "callspec", None) - expected = callspec.params.get("anyio_backend") if callspec is not None else None - if expected is None: - return - try: - running = sniffio.current_async_library() - except sniffio.AsyncLibraryNotFoundError: - return - if running != expected: - pytest.fail(f"a {running} runner is still alive for this {expected} test") - - - def pytest_collection_modifyitems( - config: pytest.Config, items: list[pytest.Item] - ) -> None: - kept: list[pytest.Item] = [] - dropped: list[pytest.Item] = [] - for item in items: - callspec = getattr(item, "callspec", None) - backend = callspec.params.get("anyio_backend") if callspec is not None else None - if backend not in (None, "asyncio") and item.get_closest_marker("asyncio_only"): - dropped.append(item) - else: - kept.append(item) - if dropped: - config.hook.pytest_deselected(items=dropped) - items[:] = kept - - - @pytest.fixture( - params=[ - "async", - "sync", - pytest.param("async_asgi", marks=pytest.mark.asyncio_only), - pytest.param("sync_wsgi", marks=pytest.mark.asyncio_only), - ] - ) - def client_type(request: pytest.FixtureRequest) -> str: - return request.param - EOF - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # pyqwest ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. aws-lc-sys - # (pulled in by reqwest's rustls/http3 stack) ships prebuilt - # riscv64gc bindings, and cmake is already in the manylinux 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" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - CIBW_TEST_REQUIRES: pytest pytest-benchmark anyio trio outcome sniffio - CIBW_TEST_SOURCES: >- - tests/__init__.py tests/_util.py tests/conftest.py - tests/test_common.py tests/test_multipart_encode.py - tests/test_protocol_errors.py tests/test_request.py - tests/test_response.py tests/test_timeout.py - tests/test_validation.py pyproject.toml - # The other test files need the pyvoy local server dropped above; - # this subset is the pyvoy-independent slice of upstream's own - # suite -- request/response/multipart construction, protocol-error - # framing over a raw socket (tests/_util.py's raw_server), TLS - # option validation and the sync timeout context manager. - CIBW_TEST_COMMAND: >- - python -c "import pyqwest._pyqwest as m; assert m.__file__.endswith('.so'), m.__file__" - && python -m pytest -v - tests/test_common.py tests/test_multipart_encode.py - tests/test_protocol_errors.py tests/test_request.py - tests/test_response.py tests/test_timeout.py - tests/test_validation.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pyqwest-${{ env.PYQWEST_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The real conftest.py imports pyvoy unconditionally to run a local + # Envoy-based test server; pyvoy bundles Envoy and ships no riscv64 + # wheel anywhere. This keeps only the anyio backend fixtures, the + # asyncio_only deselection hook and the client_type fixture (copied + # verbatim) needed by the self-contained subset of tests below -- + # none of them need the live server. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pyqwest" + version: "${{ matrix.version }}" + repository: "curioswitch/pyqwest" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + pre-build: |- + cat > tests/conftest.py <<'EOF' + from __future__ import annotations + + import pytest + import sniffio + + + @pytest.fixture(scope="session", params=["asyncio", "trio"]) + def anyio_backend(request: pytest.FixtureRequest) -> str: + return request.param + + + @pytest.fixture(autouse=True) + def no_stale_runner(request: pytest.FixtureRequest) -> None: + callspec = getattr(request.node, "callspec", None) + expected = callspec.params.get("anyio_backend") if callspec is not None else None + if expected is None: + return + try: + running = sniffio.current_async_library() + except sniffio.AsyncLibraryNotFoundError: + return + if running != expected: + pytest.fail(f"a {running} runner is still alive for this {expected} test") + + + def pytest_collection_modifyitems( + config: pytest.Config, items: list[pytest.Item] + ) -> None: + kept: list[pytest.Item] = [] + dropped: list[pytest.Item] = [] + for item in items: + callspec = getattr(item, "callspec", None) + backend = callspec.params.get("anyio_backend") if callspec is not None else None + if backend not in (None, "asyncio") and item.get_closest_marker("asyncio_only"): + dropped.append(item) + else: + kept.append(item) + if dropped: + config.hook.pytest_deselected(items=dropped) + items[:] = kept + + + @pytest.fixture( + params=[ + "async", + "sync", + pytest.param("async_asgi", marks=pytest.mark.asyncio_only), + pytest.param("sync_wsgi", marks=pytest.mark.asyncio_only), + ] + ) + def client_type(request: pytest.FixtureRequest) -> str: + return request.param + EOF + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # pyqwest ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. aws-lc-sys + # (pulled in by reqwest's rustls/http3 stack) ships prebuilt + # riscv64gc bindings, and cmake is already in the manylinux 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" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + cibw-test-requires: "pytest pytest-benchmark anyio trio outcome sniffio" + cibw-test-sources: > + tests/__init__.py tests/_util.py tests/conftest.py + tests/test_common.py tests/test_multipart_encode.py + tests/test_protocol_errors.py tests/test_request.py + tests/test_response.py tests/test_timeout.py + tests/test_validation.py pyproject.toml + # The other test files need the pyvoy local server dropped above; + # this subset is the pyvoy-independent slice of upstream's own + # suite -- request/response/multipart construction, protocol-error + # framing over a raw socket (tests/_util.py's raw_server), TLS + # option validation and the sync timeout context manager. + cibw-test-command: > + python -c "import pyqwest._pyqwest as m; assert m.__file__.endswith('.so'), m.__file__" + && python -m pytest -v + tests/test_common.py tests/test_multipart_encode.py + tests/test_protocol_errors.py tests/test_request.py + tests/test_response.py tests/test_timeout.py + tests/test_validation.py publish: name: Publish pyqwest ${{ matrix.version }} diff --git a/.github/workflows/build-pysoem.yml b/.github/workflows/build-pysoem.yml index ee585928b708..51c1d1d15d42 100644 --- a/.github/workflows/build-pysoem.yml +++ b/.github/workflows/build-pysoem.yml @@ -49,51 +49,31 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pysoem ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PYSOEM_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pysoem ${{ env.PYSOEM_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: bnjmnp/pysoem - ref: ${{ env.PYSOEM_VERSION }} - # The SOEM C library is a git submodule and is compiled into the extension. - submodules: recursive - persist-credentials: false - - # setup.py sets license='MIT' with no license_files option, so setuptools' - # default LICEN[CS]E* glob is root-only. The extension statically links the - # vendored SOEM submodule (GPL-2.0-only with a linking exception), whose own - # LICENSE lives at soem/LICENSE and never ships in any published wheel. - - name: Stage the SOEM library's LICENSE - run: cp soem/LICENSE LICENSE.soem - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Upstream's own CI builds wheels/sdist only and runs no test step against - # them (the test suite needs a real EtherCAT network interface/slave). - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as m; f = {p.name for p in m.files('pysoem') if '.dist-info/licenses/' in str(p)}; assert f == {'LICENSE', 'LICENSE.soem'}, f" - && python -c "import pysoem; print(pysoem.__version__)" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pysoem-${{ env.PYSOEM_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # The SOEM C library is a git submodule and is compiled into the extension. + # setup.py sets license='MIT' with no license_files option, so setuptools' + # default LICEN[CS]E* glob is root-only. The extension statically links the + # vendored SOEM submodule (GPL-2.0-only with a linking exception), whose own + # LICENSE lives at soem/LICENSE and never ships in any published wheel. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pysoem" + version: "${{ matrix.version }}" + repository: "bnjmnp/pysoem" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + checkout-submodules: "recursive" + pre-build: "cp soem/LICENSE LICENSE.soem" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # Upstream's own CI builds wheels/sdist only and runs no test step against + # them (the test suite needs a real EtherCAT network interface/slave). + cibw-test-command: > + python -c "import importlib.metadata as m; f = {p.name for p in m.files('pysoem') if '.dist-info/licenses/' in str(p)}; assert f == {'LICENSE', 'LICENSE.soem'}, f" + && python -c "import pysoem; print(pysoem.__version__)" publish: name: Publish pysoem ${{ matrix.version }} diff --git a/.github/workflows/build-python-magic-standalone.yml b/.github/workflows/build-python-magic-standalone.yml index 117dc3107aeb..2d2c31e2fd9e 100644 --- a/.github/workflows/build-python-magic-standalone.yml +++ b/.github/workflows/build-python-magic-standalone.yml @@ -49,55 +49,35 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build python-magic-standalone ${{ matrix.version }} cp312-${{ matrix.libc }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} libc: [manylinux, musllinux] - env: - PYTHON_MAGIC_STANDALONE_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout python-magic-standalone ${{ env.PYTHON_MAGIC_STANDALONE_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: fpgmaas/python-magic - ref: ${{ env.PYTHON_MAGIC_STANDALONE_VERSION }} - fetch-depth: 0 - persist-credentials: false - - # add_libmagic.sh compiles and bundles libmagic (file) but the wheel ships only python-magic's LICENSE. - - name: Stage libmagic licence - run: | - version=$(sed -n 's/.*version="file-\([0-9.]*\)".*/\1/p' add_libmagic.sh) - curl -fsSL --retry 5 -o LICENSE.libmagic "https://raw.githubusercontent.com/file/file/FILE${version//./_}/COPYING" - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: cp312-${{ matrix.libc }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_BUILD_LINUX: bash add_libmagic.sh - CIBW_ENVIRONMENT: LC_ALL=en_US.UTF-8 - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: >- - pytest --import-mode=importlib {project}/test && - python -c "import importlib.metadata as md; - licenses = {str(f) for f in md.files('python-magic-standalone') if '.dist-info/licenses/' in str(f)}; - assert any(l.endswith('/LICENSE') for l in licenses), licenses; - assert any(l.endswith('/LICENSE.libmagic') for l in licenses), licenses" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: python-magic-standalone-${{ matrix.version }}-cp312-${{ matrix.libc }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # add_libmagic.sh compiles and bundles libmagic (file) but the wheel ships only python-magic's LICENSE. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "python-magic-standalone" + version: "${{ matrix.version }}" + repository: "fpgmaas/python-magic" + ref: "${{ matrix.version }}" + artifact-tag: "cp312-${{ matrix.libc }}_riscv64" + checkout-fetch-depth: 0 + pre-build: |- + version=$(sed -n 's/.*version="file-\([0-9.]*\)".*/\1/p' add_libmagic.sh) + curl -fsSL --retry 5 -o LICENSE.libmagic "https://raw.githubusercontent.com/file/file/FILE${version//./_}/COPYING" + cibw-build: "cp312-${{ matrix.libc }}_riscv64" + cibw-musllinux-riscv64-image: "quay.io/pypa/musllinux_1_2_riscv64" + cibw-before-build-linux: "bash add_libmagic.sh" + cibw-environment-linux: "LC_ALL=en_US.UTF-8" + cibw-test-requires: "pytest" + cibw-test-command: > + pytest --import-mode=importlib {project}/test && + python -c "import importlib.metadata as md; + licenses = {str(f) for f in md.files('python-magic-standalone') if '.dist-info/licenses/' in str(f)}; + assert any(l.endswith('/LICENSE') for l in licenses), licenses; + assert any(l.endswith('/LICENSE.libmagic') for l in licenses), licenses" publish: name: Publish python-magic-standalone ${{ matrix.version }} diff --git a/.github/workflows/build-python-rapidjson.yml b/.github/workflows/build-python-rapidjson.yml index 5d068962348e..946f7c55573d 100644 --- a/.github/workflows/build-python-rapidjson.yml +++ b/.github/workflows/build-python-rapidjson.yml @@ -49,46 +49,28 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build python-rapidjson ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 120 - strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - PYTHON_RAPIDJSON_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout python-rapidjson v${{ env.PYTHON_RAPIDJSON_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: python-rapidjson/python-rapidjson - ref: v${{ env.PYTHON_RAPIDJSON_VERSION }} - submodules: recursive - persist-credentials: false - - # The extension compiles the bundled RapidJSON headers in, but the wheel ships - # only python-rapidjson's own licence; setuptools globs LICEN[CS]E* at the root. - - name: Stage the RapidJSON licence - run: cp rapidjson/license.txt LICENSE.rapidjson - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_TEST_REQUIRES: pytest pytest-benchmark pytz - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as md; got = sorted(p.name for p in md.files('python-rapidjson') if '.dist-info/licenses/' in str(p) and p.name); assert got == ['LICENSE', 'LICENSE.rapidjson'], got" - && pytest {project}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: python_rapidjson-${{ env.PYTHON_RAPIDJSON_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # The extension compiles the bundled RapidJSON headers in, but the wheel ships + # only python-rapidjson's own licence; setuptools globs LICEN[CS]E* at the root. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "python_rapidjson" + version: "${{ matrix.version }}" + repository: "python-rapidjson/python-rapidjson" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 120 + checkout-submodules: "recursive" + pre-build: "cp rapidjson/license.txt LICENSE.rapidjson" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-test-requires: "pytest pytest-benchmark pytz" + cibw-test-command: > + python -c "import importlib.metadata as md; got = sorted(p.name for p in md.files('python-rapidjson') if '.dist-info/licenses/' in str(p) and p.name); assert got == ['LICENSE', 'LICENSE.rapidjson'], got" + && pytest {project}/tests publish: name: Publish python-rapidjson ${{ matrix.version }} diff --git a/.github/workflows/build-pyxirr.yml b/.github/workflows/build-pyxirr.yml index ff191516b59d..8d5711ff8874 100644 --- a/.github/workflows/build-pyxirr.yml +++ b/.github/workflows/build-pyxirr.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build pyxirr ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -69,100 +67,82 @@ jobs: cp314-manylinux_riscv64 features: --features extension,abi - env: - PYXIRR_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout pyxirr v${{ env.PYXIRR_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Anexen/pyxirr - ref: v${{ env.PYXIRR_VERSION }} - persist-credentials: false - - - name: Stage the riscv64 smoke tests - # Upstream's tests/ directory holds only Rust integration tests - # (exercised by `cargo test` in ci.yaml), no Python-level suite ships - # in the checkout or the sdist. This mirrors the README's examples - # against the compiled extension. - run: | - cat > tests/test_riscv64_smoke.py <<'EOF' - from datetime import date - - import numpy as np - import pytest - from pyxirr import DayCount, fv, irr, is_conventional_cash_flow, npv, xirr, xnpv - + # Upstream's tests/ directory holds only Rust integration tests + # (exercised by `cargo test` in ci.yaml), no Python-level suite ships + # in the checkout or the sdist. This mirrors the README's examples + # against the compiled extension. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "pyxirr" + version: "${{ matrix.version }}" + repository: "Anexen/pyxirr" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + pre-build: |- + cat > tests/test_riscv64_smoke.py <<'EOF' + from datetime import date - def test_extension_is_compiled(): - from pyxirr import _pyxirr + import numpy as np + import pytest + from pyxirr import DayCount, fv, irr, is_conventional_cash_flow, npv, xirr, xnpv - assert _pyxirr.__file__.endswith(".so"), _pyxirr.__file__ + def test_extension_is_compiled(): + from pyxirr import _pyxirr - def test_irr(): - assert irr([-100, 39, 59, 55, 20]) == pytest.approx(0.28094842) + assert _pyxirr.__file__.endswith(".so"), _pyxirr.__file__ - def test_xirr_dates_and_amounts(): - dates = [date(2020, 1, 1), date(2021, 1, 1), date(2022, 1, 1)] - amounts = [-1000, 750, 500] - assert xirr(dates, amounts) == pytest.approx(0.17500926) + def test_irr(): + assert irr([-100, 39, 59, 55, 20]) == pytest.approx(0.28094842) - def test_xirr_string_dates_and_dict(): - assert xirr(["2020-01-01", "2021-01-01"], [-1000, 1200]) == pytest.approx(0.19940237) - assert xirr(dict(zip( - ["2020-01-01", "2021-01-01"], [-1000, 1200], - ))) == pytest.approx(0.19940237) + def test_xirr_dates_and_amounts(): + dates = [date(2020, 1, 1), date(2021, 1, 1), date(2022, 1, 1)] + amounts = [-1000, 750, 500] + assert xirr(dates, amounts) == pytest.approx(0.17500926) - def test_npv_and_xnpv(): - assert npv(0.1, [-100, 60, 60, 60]) == pytest.approx(49.21111946) - assert xnpv(0.1, ["2020-01-01", "2021-01-01"], [-100, 110]) == pytest.approx(-0.02610897) + def test_xirr_string_dates_and_dict(): + assert xirr(["2020-01-01", "2021-01-01"], [-1000, 1200]) == pytest.approx(0.19940237) + assert xirr(dict(zip( + ["2020-01-01", "2021-01-01"], [-1000, 1200], + ))) == pytest.approx(0.19940237) - def test_fv_broadcasts_over_numpy_arrays(): - rates = np.array([0.05, 0.1]) - result = fv(rates, 10, -100, 0) - assert result == pytest.approx([1257.78925, 1593.7424601]) + def test_npv_and_xnpv(): + assert npv(0.1, [-100, 60, 60, 60]) == pytest.approx(49.21111946) + assert xnpv(0.1, ["2020-01-01", "2021-01-01"], [-100, 110]) == pytest.approx(-0.02610897) - def test_day_count_convention(): - assert xirr( - ["2020-01-01", "2021-01-01"], [-1000, 1200], - day_count=DayCount.ACT_360, - ) == pytest.approx(0.19641870) + def test_fv_broadcasts_over_numpy_arrays(): + rates = np.array([0.05, 0.1]) + result = fv(rates, 10, -100, 0) + assert result == pytest.approx([1257.78925, 1593.7424601]) - def test_is_conventional_cash_flow(): - assert is_conventional_cash_flow([-100, 50, 50, 50]) - assert not is_conventional_cash_flow([-100, 50, -20, 80]) - EOF + def test_day_count_convention(): + assert xirr( + ["2020-01-01", "2021-01-01"], [-1000, 1200], + day_count=DayCount.ACT_360, + ) == pytest.approx(0.19641870) - - name: Build and test wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # pyxirr ships no [tool.cibuildwheel], so the Rust toolchain its - # maturin backend needs is installed in-container here. - 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" - MATURIN_PEP517_ARGS="${{ matrix.features }}" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy - CIBW_TEST_REQUIRES: pytest numpy - CIBW_TEST_COMMAND: python -m pytest -vv {project}/tests/test_riscv64_smoke.py - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: pyxirr-${{ env.PYXIRR_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + def test_is_conventional_cash_flow(): + assert is_conventional_cash_flow([-100, 50, 50, 50]) + assert not is_conventional_cash_flow([-100, 50, -20, 80]) + EOF + cibw-build: "${{ matrix.build }}" + # pyxirr ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + 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" + MATURIN_PEP517_ARGS="${{ matrix.features }}" + PIP_ONLY_BINARY=numpy + cibw-test-requires: "pytest numpy" + cibw-test-command: "python -m pytest -vv {project}/tests/test_riscv64_smoke.py" publish: name: Publish pyxirr ${{ matrix.version }} diff --git a/.github/workflows/build-readcon-db.yml b/.github/workflows/build-readcon-db.yml index 39b5d44df2eb..01d80ac20aeb 100644 --- a/.github/workflows/build-readcon-db.yml +++ b/.github/workflows/build-readcon-db.yml @@ -49,58 +49,38 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build readcon-db ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - READCON_DB_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout readcon-db v${{ env.READCON_DB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: lode-org/readcon-db - ref: v${{ env.READCON_DB_VERSION }} - persist-credentials: false - - - name: Stage the licence beside python/pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory - # (python/), not the crate root where LICENSE actually lives - - # unstaged, the upstream PyPI wheel itself ships no licence file. - run: cp LICENSE python/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python - output-dir: wheelhouse/ - env: - CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - 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" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy,h5py,MDAnalysis,matplotlib,contourpy,kiwisolver,pillow - CIBW_TEST_REQUIRES: pytest numpy h5py MDAnalysis - CIBW_TEST_SOURCES: python/tests resources - # test_append_trajectory_frames needs the `readcon` package, which - # has no riscv64 wheel on PyPI or pypi.riseproject.dev. - CIBW_TEST_COMMAND: >- - python -c "from readcon_db import readcon_db as m; assert m.__file__.endswith('.so'), m.__file__" && - python -m pytest python/tests - --deselect python/tests/test_ingest_memory.py::test_append_trajectory_frames - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: readcon-db-${{ env.READCON_DB_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory + # (python/), not the crate root where LICENSE actually lives - + # unstaged, the upstream PyPI wheel itself ships no licence file. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "readcon-db" + version: "${{ matrix.version }}" + repository: "lode-org/readcon-db" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + pre-build: "cp LICENSE python/LICENSE" + cibw-package-dir: "python" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + 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-environment: "PIP_ONLY_BINARY=numpy,h5py,MDAnalysis,matplotlib,contourpy,kiwisolver,pillow" + cibw-test-requires: "pytest numpy h5py MDAnalysis" + cibw-test-sources: "python/tests resources" + # test_append_trajectory_frames needs the `readcon` package, which + # has no riscv64 wheel on PyPI or pypi.riseproject.dev. + cibw-test-command: > + python -c "from readcon_db import readcon_db as m; assert m.__file__.endswith('.so'), m.__file__" && + python -m pytest python/tests + --deselect python/tests/test_ingest_memory.py::test_append_trajectory_frames publish: name: Publish readcon-db ${{ matrix.version }} diff --git a/.github/workflows/build-robotpy-wpiutil.yml b/.github/workflows/build-robotpy-wpiutil.yml index 8951ac151abf..31c8c44a1654 100644 --- a/.github/workflows/build-robotpy-wpiutil.yml +++ b/.github/workflows/build-robotpy-wpiutil.yml @@ -52,48 +52,29 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build robotpy-wpiutil ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - ROBOTPY_WPIUTIL_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout mostrobotpy ${{ env.ROBOTPY_WPIUTIL_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: robotpy/mostrobotpy - ref: ${{ env.ROBOTPY_WPIUTIL_VERSION }} - persist-credentials: false - - # subprojects/robotpy-wpiutil has no licence of its own, so upstream's wheel ships none. - - name: Add the mostrobotpy licence - run: cp LICENSE.md subprojects/robotpy-wpiutil/LICENSE.md - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: subprojects/robotpy-wpiutil - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=${{ env.PIP_EXTRA_INDEX_URL }} - # libwpiutil.so comes from the robotpy-native-wpiutil dependency, as upstream's wheel expects. - CIBW_REPAIR_WHEEL_COMMAND: auditwheel repair -w {dest_dir} {wheel} --exclude libwpiutil.so - CIBW_TEST_REQUIRES: pytest hatch-meson hatchling ninja semiwrap~=0.3.0 - CIBW_TEST_COMMAND: >- - pip install --no-build-isolation {package}/tests/cpp && - pytest {package}/tests - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: robotpy-wpiutil-${{ env.ROBOTPY_WPIUTIL_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: ./wheelhouse/*.whl - if-no-files-found: error + # subprojects/robotpy-wpiutil has no licence of its own, so upstream's wheel ships none. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "robotpy-wpiutil" + version: "${{ matrix.version }}" + repository: "robotpy/mostrobotpy" + ref: "${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + pre-build: "cp LICENSE.md subprojects/robotpy-wpiutil/LICENSE.md" + cibw-package-dir: "subprojects/robotpy-wpiutil" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # libwpiutil.so comes from the robotpy-native-wpiutil dependency, as upstream's wheel expects. + cibw-repair-wheel-command: "auditwheel repair -w {dest_dir} {wheel} --exclude libwpiutil.so" + cibw-test-requires: "pytest hatch-meson hatchling ninja semiwrap~=0.3.0" + cibw-test-command: > + pip install --no-build-isolation {package}/tests/cpp && + pytest {package}/tests publish: name: Publish robotpy-wpiutil ${{ matrix.version }} diff --git a/.github/workflows/build-sdbus.yml b/.github/workflows/build-sdbus.yml index b9eb2f212979..ded8c8b4a754 100644 --- a/.github/workflows/build-sdbus.yml +++ b/.github/workflows/build-sdbus.yml @@ -59,118 +59,97 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build sdbus ${{ matrix.version }} cp312-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 - env: - SDBUS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout sdbus ${{ env.SDBUS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: python-sdbus/python-sdbus - ref: ${{ env.SDBUS_VERSION }} - persist-credentials: false - - - name: Stage the licence-collection script - run: | - cat > collect-licenses.sh <<'COLLECT_EOF' - #!/bin/bash - # SPDX-FileCopyrightText: 2026 The RISE Project - # SPDX-License-Identifier: MIT - # - # Stage, at the project root, the licence of every shared library - # auditwheel vendors out of the build image alongside libsystemd. - # setuptools' default LICENSE* glob copies them into the wheel. - set -euo pipefail - - project="${1:?usage: collect-licenses.sh }" - - # ldd is transitive, so libsystemd alone covers its whole closure; - # ldd does not list the root itself, so resolve that too. - mapfile -t libs < <( - { - ldd /usr/lib64/libsystemd.so.0 | tr ' ' '\n' | grep '^/' - readlink -f /usr/lib64/libsystemd.so.0 - } | sort -u - ) - - # `rpm -qf` reports unowned files on stdout, so keep only bare package names. - # glibc and the gcc runtime are on auditwheel's manylinux allowlist and - # are never vendored into the wheel. - mapfile -t pkgs < <( - rpm -qf --qf '%{NAME}\n' "${libs[@]}" 2>/dev/null | - grep -E '^[A-Za-z0-9._+-]+$' | sort -u | - grep -vE '^(glibc|libgcc|libstdc\+\+|gcc)$' - ) - - for pkg in "${pkgs[@]}"; do - mapfile -t files < <(rpm -q --licensefiles "$pkg" 2>/dev/null || true) - - # Some subpackages leave the licence to a sibling of the same source RPM. - if [ -z "${files[0]:-}" ]; then - srpm=$(rpm -q --qf '%{SOURCERPM}\n' "$pkg") - mapfile -t files < <( - rpm -qa --qf '%{SOURCERPM} %{NAME}\n' | - awk -v s="$srpm" '$1 == s { print $2 }' | - xargs -r rpm -q --licensefiles 2>/dev/null | sort -u - ) - fi - - # Others mark it %doc rather than %license, and the image installs no docs. - if [ -z "${files[0]:-}" ]; then - dnf -y --disablerepo=extras reinstall --setopt=tsflags= "$pkg" >/dev/null - mapfile -t files < <(rpm -qd "$pkg" | grep -iE '/(LICEN[CS]E|COPYING|NOTICE)') - fi - - for f in "${files[@]}"; do - [ -f "$f" ] || continue - cp "$f" "$project/LICENSE.${pkg}.$(basename "$f")" - done - compgen -G "$project/LICENSE.$pkg.*" >/dev/null || - { echo "no licence file found for $pkg" >&2; exit 1; } - done - - ls -1 "$project"/LICENSE.* | sed "s|$project/||" - COLLECT_EOF + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "sdbus" + version: "${{ matrix.version }}" + repository: "python-sdbus/python-sdbus" + ref: "${{ matrix.version }}" + artifact-tag: "cp312-abi3-manylinux_riscv64" + pre-build: |- + cat > collect-licenses.sh <<'COLLECT_EOF' + #!/bin/bash + # SPDX-FileCopyrightText: 2026 The RISE Project + # SPDX-License-Identifier: MIT + # + # Stage, at the project root, the licence of every shared library + # auditwheel vendors out of the build image alongside libsystemd. + # setuptools' default LICENSE* glob copies them into the wheel. + set -euo pipefail + + project="${1:?usage: collect-licenses.sh }" + + # ldd is transitive, so libsystemd alone covers its whole closure; + # ldd does not list the root itself, so resolve that too. + mapfile -t libs < <( + { + ldd /usr/lib64/libsystemd.so.0 | tr ' ' '\n' | grep '^/' + readlink -f /usr/lib64/libsystemd.so.0 + } | sort -u + ) + + # `rpm -qf` reports unowned files on stdout, so keep only bare package names. + # glibc and the gcc runtime are on auditwheel's manylinux allowlist and + # are never vendored into the wheel. + mapfile -t pkgs < <( + rpm -qf --qf '%{NAME}\n' "${libs[@]}" 2>/dev/null | + grep -E '^[A-Za-z0-9._+-]+$' | sort -u | + grep -vE '^(glibc|libgcc|libstdc\+\+|gcc)$' + ) + + for pkg in "${pkgs[@]}"; do + mapfile -t files < <(rpm -q --licensefiles "$pkg" 2>/dev/null || true) + + # Some subpackages leave the licence to a sibling of the same source RPM. + if [ -z "${files[0]:-}" ]; then + srpm=$(rpm -q --qf '%{SOURCERPM}\n' "$pkg") + mapfile -t files < <( + rpm -qa --qf '%{SOURCERPM} %{NAME}\n' | + awk -v s="$srpm" '$1 == s { print $2 }' | + xargs -r rpm -q --licensefiles 2>/dev/null | sort -u + ) + fi - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: >- - cp312-manylinux_riscv64 cp313-manylinux_riscv64 - cp314-manylinux_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL_LINUX: >- - dnf install -y systemd-devel dbus-daemon && - bash {project}/collect-licenses.sh {project} - CIBW_ENVIRONMENT: PYTHON_SDBUS_USE_LIMITED_API=1 - # setup.py only calls Extension(py_limited_api=True); it never sets - # the bdist_wheel option itself (gotcha 34 does not apply here), so - # the abi3 tag has to be injected via config-settings (gotcha 11). - CIBW_CONFIG_SETTINGS: --build-option=--py-limited-api=${{ env.ABI3_FLOOR }} - # Matches build-pygame.yml's fix for the same "D-Bus library appears - # to be incorrectly set up" error: the image ships no machine-id. - CIBW_BEFORE_TEST: | - mkdir -p /var/lib/dbus - if [ ! -f /var/lib/dbus/machine-id ]; then - dbus-uuidgen > /var/lib/dbus/machine-id + # Others mark it %doc rather than %license, and the image installs no docs. + if [ -z "${files[0]:-}" ]; then + dnf -y --disablerepo=extras reinstall --setopt=tsflags= "$pkg" >/dev/null + mapfile -t files < <(rpm -qd "$pkg" | grep -iE '/(LICEN[CS]E|COPYING|NOTICE)') fi - CIBW_TEST_REQUIRES: jinja2 - # {package}/test is a package (has __init__.py) with relative - # imports, so it must be discovered as a subpackage of {package}, - # not passed as the start directory itself (gotcha: bare - # `--start-directory {package}/test` makes __package__ = ""). - CIBW_TEST_COMMAND: cd {package} && python3 -m unittest discover --verbose - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sdbus-${{ env.SDBUS_VERSION }}-cp312-abi3-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + for f in "${files[@]}"; do + [ -f "$f" ] || continue + cp "$f" "$project/LICENSE.${pkg}.$(basename "$f")" + done + compgen -G "$project/LICENSE.$pkg.*" >/dev/null || + { echo "no licence file found for $pkg" >&2; exit 1; } + done + + ls -1 "$project"/LICENSE.* | sed "s|$project/||" + COLLECT_EOF + cibw-build: > + cp312-manylinux_riscv64 cp313-manylinux_riscv64 + cp314-manylinux_riscv64 + cibw-before-all-linux: > + dnf install -y systemd-devel dbus-daemon && + bash {project}/collect-licenses.sh {project} + cibw-environment-linux: "PYTHON_SDBUS_USE_LIMITED_API=1" + # setup.py only calls Extension(py_limited_api=True); it never sets + # the bdist_wheel option itself (gotcha 34 does not apply here), so + # the abi3 tag has to be injected via config-settings (gotcha 11). + cibw-config-settings: "--build-option=--py-limited-api=cp312" + # Matches build-pygame.yml's fix for the same "D-Bus library appears + # to be incorrectly set up" error: the image ships no machine-id. + cibw-before-test: |- + mkdir -p /var/lib/dbus + if [ ! -f /var/lib/dbus/machine-id ]; then + dbus-uuidgen > /var/lib/dbus/machine-id + fi + cibw-test-requires: "jinja2" + # {package}/test is a package (has __init__.py) with relative + # imports, so it must be discovered as a subpackage of {package}, + # not passed as the start directory itself (gotcha: bare + # `--start-directory {package}/test` makes __package__ = ""). + cibw-test-command: "cd {package} && python3 -m unittest discover --verbose" build_freethreaded: needs: [setup] @@ -180,105 +159,84 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build sdbus ${{ matrix.version }} cp314t-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 60 - env: - SDBUS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout sdbus ${{ env.SDBUS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: python-sdbus/python-sdbus - ref: ${{ env.SDBUS_VERSION }} - persist-credentials: false - - - name: Stage the licence-collection script - run: | - cat > collect-licenses.sh <<'COLLECT_EOF' - #!/bin/bash - # SPDX-FileCopyrightText: 2026 The RISE Project - # SPDX-License-Identifier: MIT - # - # Stage, at the project root, the licence of every shared library - # auditwheel vendors out of the build image alongside libsystemd. - # setuptools' default LICENSE* glob copies them into the wheel. - set -euo pipefail - - project="${1:?usage: collect-licenses.sh }" - - # ldd is transitive, so libsystemd alone covers its whole closure; - # ldd does not list the root itself, so resolve that too. - mapfile -t libs < <( - { - ldd /usr/lib64/libsystemd.so.0 | tr ' ' '\n' | grep '^/' - readlink -f /usr/lib64/libsystemd.so.0 - } | sort -u - ) - - # `rpm -qf` reports unowned files on stdout, so keep only bare package names. - # glibc and the gcc runtime are on auditwheel's manylinux allowlist and - # are never vendored into the wheel. - mapfile -t pkgs < <( - rpm -qf --qf '%{NAME}\n' "${libs[@]}" 2>/dev/null | - grep -E '^[A-Za-z0-9._+-]+$' | sort -u | - grep -vE '^(glibc|libgcc|libstdc\+\+|gcc)$' - ) - - for pkg in "${pkgs[@]}"; do - mapfile -t files < <(rpm -q --licensefiles "$pkg" 2>/dev/null || true) - - # Some subpackages leave the licence to a sibling of the same source RPM. - if [ -z "${files[0]:-}" ]; then - srpm=$(rpm -q --qf '%{SOURCERPM}\n' "$pkg") - mapfile -t files < <( - rpm -qa --qf '%{SOURCERPM} %{NAME}\n' | - awk -v s="$srpm" '$1 == s { print $2 }' | - xargs -r rpm -q --licensefiles 2>/dev/null | sort -u - ) - fi - - # Others mark it %doc rather than %license, and the image installs no docs. - if [ -z "${files[0]:-}" ]; then - dnf -y --disablerepo=extras reinstall --setopt=tsflags= "$pkg" >/dev/null - mapfile -t files < <(rpm -qd "$pkg" | grep -iE '/(LICEN[CS]E|COPYING|NOTICE)') - fi - - for f in "${files[@]}"; do - [ -f "$f" ] || continue - cp "$f" "$project/LICENSE.${pkg}.$(basename "$f")" - done - compgen -G "$project/LICENSE.$pkg.*" >/dev/null || - { echo "no licence file found for $pkg" >&2; exit 1; } - done - - ls -1 "$project"/LICENSE.* | sed "s|$project/||" - COLLECT_EOF + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "sdbus" + version: "${{ matrix.version }}" + repository: "python-sdbus/python-sdbus" + ref: "${{ matrix.version }}" + artifact-tag: "cp314t-manylinux_riscv64" + pre-build: |- + cat > collect-licenses.sh <<'COLLECT_EOF' + #!/bin/bash + # SPDX-FileCopyrightText: 2026 The RISE Project + # SPDX-License-Identifier: MIT + # + # Stage, at the project root, the licence of every shared library + # auditwheel vendors out of the build image alongside libsystemd. + # setuptools' default LICENSE* glob copies them into the wheel. + set -euo pipefail + + project="${1:?usage: collect-licenses.sh }" + + # ldd is transitive, so libsystemd alone covers its whole closure; + # ldd does not list the root itself, so resolve that too. + mapfile -t libs < <( + { + ldd /usr/lib64/libsystemd.so.0 | tr ' ' '\n' | grep '^/' + readlink -f /usr/lib64/libsystemd.so.0 + } | sort -u + ) + + # `rpm -qf` reports unowned files on stdout, so keep only bare package names. + # glibc and the gcc runtime are on auditwheel's manylinux allowlist and + # are never vendored into the wheel. + mapfile -t pkgs < <( + rpm -qf --qf '%{NAME}\n' "${libs[@]}" 2>/dev/null | + grep -E '^[A-Za-z0-9._+-]+$' | sort -u | + grep -vE '^(glibc|libgcc|libstdc\+\+|gcc)$' + ) + + for pkg in "${pkgs[@]}"; do + mapfile -t files < <(rpm -q --licensefiles "$pkg" 2>/dev/null || true) + + # Some subpackages leave the licence to a sibling of the same source RPM. + if [ -z "${files[0]:-}" ]; then + srpm=$(rpm -q --qf '%{SOURCERPM}\n' "$pkg") + mapfile -t files < <( + rpm -qa --qf '%{SOURCERPM} %{NAME}\n' | + awk -v s="$srpm" '$1 == s { print $2 }' | + xargs -r rpm -q --licensefiles 2>/dev/null | sort -u + ) + fi - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: cp314t-manylinux_riscv64 - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL_LINUX: >- - dnf install -y systemd-devel dbus-daemon && - bash {project}/collect-licenses.sh {project} - CIBW_BEFORE_TEST: | - mkdir -p /var/lib/dbus - if [ ! -f /var/lib/dbus/machine-id ]; then - dbus-uuidgen > /var/lib/dbus/machine-id + # Others mark it %doc rather than %license, and the image installs no docs. + if [ -z "${files[0]:-}" ]; then + dnf -y --disablerepo=extras reinstall --setopt=tsflags= "$pkg" >/dev/null + mapfile -t files < <(rpm -qd "$pkg" | grep -iE '/(LICEN[CS]E|COPYING|NOTICE)') fi - CIBW_TEST_REQUIRES: jinja2 - CIBW_TEST_COMMAND: cd {package} && python3 -m unittest discover --verbose - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sdbus-${{ env.SDBUS_VERSION }}-cp314t-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + for f in "${files[@]}"; do + [ -f "$f" ] || continue + cp "$f" "$project/LICENSE.${pkg}.$(basename "$f")" + done + compgen -G "$project/LICENSE.$pkg.*" >/dev/null || + { echo "no licence file found for $pkg" >&2; exit 1; } + done + + ls -1 "$project"/LICENSE.* | sed "s|$project/||" + COLLECT_EOF + cibw-build: "cp314t-manylinux_riscv64" + cibw-before-all-linux: > + dnf install -y systemd-devel dbus-daemon && + bash {project}/collect-licenses.sh {project} + cibw-before-test: |- + mkdir -p /var/lib/dbus + if [ ! -f /var/lib/dbus/machine-id ]; then + dbus-uuidgen > /var/lib/dbus/machine-id + fi + cibw-test-requires: "jinja2" + cibw-test-command: "cd {package} && python3 -m unittest discover --verbose" gpl_sources: needs: [setup] diff --git a/.github/workflows/build-semantic-text-splitter.yml b/.github/workflows/build-semantic-text-splitter.yml index c6963382279e..673559c8e8a2 100644 --- a/.github/workflows/build-semantic-text-splitter.yml +++ b/.github/workflows/build-semantic-text-splitter.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build semantic-text-splitter ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 120 strategy: fail-fast: false matrix: @@ -85,57 +83,39 @@ jobs: # assertion below is the only check this leg gets. test-command: 'true' - env: - SEMANTIC_TEXT_SPLITTER_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout text-splitter ${{ env.SEMANTIC_TEXT_SPLITTER_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: benbrandt/text-splitter - ref: v${{ env.SEMANTIC_TEXT_SPLITTER_VERSION }} - persist-credentials: false - - - name: Stage the licence beside semantic-text-splitter's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # is bindings/python/ in this workspace -- the licence file lives at - # the repo root instead (primp/moyopy hit the same gap). - run: cp LICENSE.txt bindings/python/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: bindings/python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # semantic-text-splitter ships no [tool.cibuildwheel], so the Rust - # toolchain its maturin backend needs is installed in-container here. - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # tree-sitter-python's own sdist (no riscv64 wheel on public PyPI) - # builds clean but is missing the external scanner's symbols; our - # registry already carries a correctly-built riscv64 wheel for it - # (cp310-abi3 leg only -- see matrix.test-requires for cp314t). - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - CIBW_TEST_REQUIRES: ${{ matrix.test-requires }} - CIBW_TEST_SOURCES: bindings/python/tests - CIBW_TEST_COMMAND: >- - python -c "import semantic_text_splitter, importlib.metadata as md; - files = md.files('semantic-text-splitter'); - assert any(str(p).endswith('.so') for p in files), files; - assert any(str(p).endswith('licenses/LICENSE.txt') for p in files)" && - ${{ matrix.test-command }} - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: semantic-text-splitter-${{ env.SEMANTIC_TEXT_SPLITTER_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # is bindings/python/ in this workspace -- the licence file lives at + # the repo root instead (primp/moyopy hit the same gap). + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "semantic-text-splitter" + version: "${{ matrix.version }}" + repository: "benbrandt/text-splitter" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 120 + pre-build: "cp LICENSE.txt bindings/python/" + cibw-package-dir: "bindings/python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # semantic-text-splitter ships no [tool.cibuildwheel], so the Rust + # toolchain its maturin backend needs is installed in-container here. + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # tree-sitter-python's own sdist (no riscv64 wheel on public PyPI) + # builds clean but is missing the external scanner's symbols; our + # registry already carries a correctly-built riscv64 wheel for it + # (cp310-abi3 leg only -- see matrix.test-requires for cp314t). + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + cibw-test-requires: "${{ matrix.test-requires }}" + cibw-test-sources: "bindings/python/tests" + cibw-test-command: > + python -c "import semantic_text_splitter, importlib.metadata as md; + files = md.files('semantic-text-splitter'); + assert any(str(p).endswith('.so') for p in files), files; + assert any(str(p).endswith('licenses/LICENSE.txt') for p in files)" && + ${{ matrix.test-command }} publish: name: Publish semantic-text-splitter ${{ matrix.version }} diff --git a/.github/workflows/build-sherpa-onnx.yml b/.github/workflows/build-sherpa-onnx.yml index cb68b73d5b1d..aeac0726f975 100644 --- a/.github/workflows/build-sherpa-onnx.yml +++ b/.github/workflows/build-sherpa-onnx.yml @@ -53,106 +53,87 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build sherpa-onnx ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 1440 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - SHERPA_ONNX_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout sherpa-onnx v${{ env.SHERPA_ONNX_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: k2-fsa/sherpa-onnx - ref: v${{ env.SHERPA_ONNX_VERSION }} - persist-credentials: false - - # Non-split build (SHERPA_ONNX_SPLIT_PYTHON_PACKAGE left unset): upstream's - # own published wheels depend at runtime on sherpa-onnx-core, which has no - # riscv64 wheel or sdist. cmake_extension.py's non-split path bundles - # onnxruntime and every other native dependency straight into this wheel - # instead, with no separate package. Each dependency below is pulled in by - # CMake's own FetchContent at build time (invisible from `git ls-files`), - # so its licence has to be staged here for setuptools' default - # LICEN[CS]E*/COPYING* glob to pick it up into dist-info/licenses/. - - name: Stage vendored licences - run: | - set -euo pipefail - curl -fsSL --retry 5 "https://raw.githubusercontent.com/microsoft/onnxruntime/v${{ env.ONNXRUNTIME_VERSION }}/LICENSE" -o LICENSE.onnxruntime - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING" -o COPYING.espeak-ng - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING.APACHE" -o COPYING.espeak-ng.APACHE - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING.BSD2" -o COPYING.espeak-ng.BSD2 - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING.UCD" -o COPYING.espeak-ng.UCD - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/piper-phonemize/f3ff95afc03640bc1399e113e83361192a2fafb4/LICENSE.md" -o LICENSE.piper-phonemize - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/kaldi-native-fbank/v1.22.3/LICENSE" -o LICENSE.kaldi-native-fbank - curl -fsSL --retry 5 "https://raw.githubusercontent.com/k2-fsa/kaldi-decoder/v0.3.0/LICENSE" -o LICENSE.kaldi-decoder - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/openfst/v1.8.5-2026-07-09/COPYING" -o COPYING.openfst - curl -fsSL --retry 5 "https://raw.githubusercontent.com/pkufool/simple-sentencepiece/v0.7/LICENSE" -o LICENSE.simple-sentencepiece - curl -fsSL --retry 5 "https://raw.githubusercontent.com/zaphoyd/websocketpp/b9aeec6eaf3d5610503439b4fae3581d9aff08e8/COPYING" -o COPYING.websocketpp - curl -fsSL --retry 5 "https://raw.githubusercontent.com/chriskohlhoff/asio/asio-1-24-0/asio/LICENSE_1_0.txt" -o LICENSE.asio - curl -fsSL --retry 5 "https://raw.githubusercontent.com/nlohmann/json/v3.12.0/LICENSE.MIT" -o LICENSE.json - curl -fsSL --retry 5 "https://gitlab.com/libeigen/eigen/-/raw/5.0.1/COPYING.MPL2" -o COPYING.eigen - curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/hclust-cpp/2026-02-25/LICENSE" -o LICENSE.hclust-cpp - curl -fsSL --retry 5 "https://raw.githubusercontent.com/likle/cargs/v1.0.3/LICENSE.md" -o LICENSE.cargs - curl -fsSL --retry 5 "http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz" -o /tmp/pa.tgz - tar xzf /tmp/pa.tgz -O portaudio/LICENSE.txt > LICENSE.portaudio - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE is ON by default; - # pointing it at our own riscv64 onnxruntime wheel (see env.ONNXRUNTIME_VERSION - # above) skips CMake's FetchContent download of the T-Head-only binary entirely. - # Headers come straight from the matching onnxruntime release tag - the pip - # wheel ships only the runtime .so, not the C/C++ API headers. - CIBW_BEFORE_BUILD: >- - pip download --no-deps --only-binary=:all: --index-url https://pypi.riseproject.dev/simple/ -d /tmp/ort_pkg "onnxruntime==${{ env.ONNXRUNTIME_VERSION }}" && - unzip -q /tmp/ort_pkg/*.whl -d /tmp/ort_pkg/extracted && - mkdir -p {project}/onnxruntime-riscv64/lib && - cp /tmp/ort_pkg/extracted/onnxruntime/capi/libonnxruntime.so.${{ env.ONNXRUNTIME_VERSION }} /tmp/ort_pkg/extracted/onnxruntime/capi/libonnxruntime_providers_shared.so {project}/onnxruntime-riscv64/lib/ && - ln -sf libonnxruntime.so.${{ env.ONNXRUNTIME_VERSION }} {project}/onnxruntime-riscv64/lib/libonnxruntime.so && - ln -sf libonnxruntime.so.${{ env.ONNXRUNTIME_VERSION }} {project}/onnxruntime-riscv64/lib/libonnxruntime.so.1 && - curl -fsSL --retry 5 "https://github.com/microsoft/onnxruntime/releases/download/v${{ env.ONNXRUNTIME_VERSION }}/onnxruntime-linux-aarch64-${{ env.ONNXRUNTIME_VERSION }}.tgz" - | tar xz -C {project}/onnxruntime-riscv64 --wildcards --strip-components=1 "onnxruntime-linux-aarch64-${{ env.ONNXRUNTIME_VERSION }}/include/*.h" - # LD_LIBRARY_PATH is required at auditwheel-repair time, not just at - # link time: SHERPA_ONNXRUNTIME_LIB_DIR only tells CMake where to - # find libonnxruntime.so to link against, but auditwheel's own - # dependency scan (ldd-based) needs the actual DT_NEEDED SONAME - # (libonnxruntime.so.1, not the dev-symlink libonnxruntime.so) on - # its own search path to locate and bundle it into the wheel. - CIBW_ENVIRONMENT: >- - MAKEFLAGS=-j$(nproc) - SHERPA_ONNXRUNTIME_INCLUDE_DIR=/project/onnxruntime-riscv64/include - SHERPA_ONNXRUNTIME_LIB_DIR=/project/onnxruntime-riscv64/lib - LD_LIBRARY_PATH=/project/onnxruntime-riscv64/lib - # sherpa-onnx 2.0.0 dropped the bundled espeak-ng: the Piper VITS model - # is driven through a lexicon (--vits-lexicon) instead of the - # espeak-ng-data directory, which is now ignored and leaves the model - # with no way to turn text into tokens. - CIBW_TEST_COMMAND: >- - python -c "import sherpa_onnx; print(sherpa_onnx.__version__); print(sherpa_onnx.OnlineRecognizer); print(sherpa_onnx.OfflineRecognizer)" && - sherpa-onnx-offline --help && - sherpa-onnx-offline-tts --help && - curl -fsSL --retry 5 https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23.tar.bz2 | tar xj && - sherpa-onnx --tokens=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/tokens.txt --encoder=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/encoder-epoch-99-avg-1.onnx --decoder=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/decoder-epoch-99-avg-1.onnx --joiner=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/joiner-epoch-99-avg-1.onnx ./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/test_wavs/0.wav && - curl -fsSL --retry 5 https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-lessac-medium.tar.bz2 | tar xj && - curl -fsSL --retry 5 -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/lexicon-en-us.txt && - sherpa-onnx-offline-tts --vits-model=./vits-piper-en_US-lessac-medium/en_US-lessac-medium.onnx --vits-lexicon=./lexicon-en-us.txt --vits-tokens=./vits-piper-en_US-lessac-medium/tokens.txt --output-filename=./test.wav 'test' && - test -s ./test.wav - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sherpa-onnx-${{ env.SHERPA_ONNX_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # Non-split build (SHERPA_ONNX_SPLIT_PYTHON_PACKAGE left unset): upstream's + # own published wheels depend at runtime on sherpa-onnx-core, which has no + # riscv64 wheel or sdist. cmake_extension.py's non-split path bundles + # onnxruntime and every other native dependency straight into this wheel + # instead, with no separate package. Each dependency below is pulled in by + # CMake's own FetchContent at build time (invisible from `git ls-files`), + # so its licence has to be staged here for setuptools' default + # LICEN[CS]E*/COPYING* glob to pick it up into dist-info/licenses/. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "sherpa-onnx" + version: "${{ matrix.version }}" + repository: "k2-fsa/sherpa-onnx" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 1440 + pre-build: |- + set -euo pipefail + curl -fsSL --retry 5 "https://raw.githubusercontent.com/microsoft/onnxruntime/v1.29.0/LICENSE" -o LICENSE.onnxruntime + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING" -o COPYING.espeak-ng + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING.APACHE" -o COPYING.espeak-ng.APACHE + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING.BSD2" -o COPYING.espeak-ng.BSD2 + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/espeak-ng/ed530aa113046142eb5115cf2fc9157854d0ffe1/COPYING.UCD" -o COPYING.espeak-ng.UCD + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/piper-phonemize/f3ff95afc03640bc1399e113e83361192a2fafb4/LICENSE.md" -o LICENSE.piper-phonemize + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/kaldi-native-fbank/v1.22.3/LICENSE" -o LICENSE.kaldi-native-fbank + curl -fsSL --retry 5 "https://raw.githubusercontent.com/k2-fsa/kaldi-decoder/v0.3.0/LICENSE" -o LICENSE.kaldi-decoder + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/openfst/v1.8.5-2026-07-09/COPYING" -o COPYING.openfst + curl -fsSL --retry 5 "https://raw.githubusercontent.com/pkufool/simple-sentencepiece/v0.7/LICENSE" -o LICENSE.simple-sentencepiece + curl -fsSL --retry 5 "https://raw.githubusercontent.com/zaphoyd/websocketpp/b9aeec6eaf3d5610503439b4fae3581d9aff08e8/COPYING" -o COPYING.websocketpp + curl -fsSL --retry 5 "https://raw.githubusercontent.com/chriskohlhoff/asio/asio-1-24-0/asio/LICENSE_1_0.txt" -o LICENSE.asio + curl -fsSL --retry 5 "https://raw.githubusercontent.com/nlohmann/json/v3.12.0/LICENSE.MIT" -o LICENSE.json + curl -fsSL --retry 5 "https://gitlab.com/libeigen/eigen/-/raw/5.0.1/COPYING.MPL2" -o COPYING.eigen + curl -fsSL --retry 5 "https://raw.githubusercontent.com/csukuangfj/hclust-cpp/2026-02-25/LICENSE" -o LICENSE.hclust-cpp + curl -fsSL --retry 5 "https://raw.githubusercontent.com/likle/cargs/v1.0.3/LICENSE.md" -o LICENSE.cargs + curl -fsSL --retry 5 "http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz" -o /tmp/pa.tgz + tar xzf /tmp/pa.tgz -O portaudio/LICENSE.txt > LICENSE.portaudio + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE is ON by default; + # pointing it at our own riscv64 onnxruntime wheel (see env.ONNXRUNTIME_VERSION + # above) skips CMake's FetchContent download of the T-Head-only binary entirely. + # Headers come straight from the matching onnxruntime release tag - the pip + # wheel ships only the runtime .so, not the C/C++ API headers. + cibw-before-build: > + pip download --no-deps --only-binary=:all: --index-url https://pypi.riseproject.dev/simple/ -d /tmp/ort_pkg "onnxruntime==1.29.0" && + unzip -q /tmp/ort_pkg/*.whl -d /tmp/ort_pkg/extracted && + mkdir -p {project}/onnxruntime-riscv64/lib && + cp /tmp/ort_pkg/extracted/onnxruntime/capi/libonnxruntime.so.1.29.0 /tmp/ort_pkg/extracted/onnxruntime/capi/libonnxruntime_providers_shared.so {project}/onnxruntime-riscv64/lib/ && + ln -sf libonnxruntime.so.1.29.0 {project}/onnxruntime-riscv64/lib/libonnxruntime.so && + ln -sf libonnxruntime.so.1.29.0 {project}/onnxruntime-riscv64/lib/libonnxruntime.so.1 && + curl -fsSL --retry 5 "https://github.com/microsoft/onnxruntime/releases/download/v1.29.0/onnxruntime-linux-aarch64-1.29.0.tgz" + | tar xz -C {project}/onnxruntime-riscv64 --wildcards --strip-components=1 "onnxruntime-linux-aarch64-1.29.0/include/*.h" + # LD_LIBRARY_PATH is required at auditwheel-repair time, not just at + # link time: SHERPA_ONNXRUNTIME_LIB_DIR only tells CMake where to + # find libonnxruntime.so to link against, but auditwheel's own + # dependency scan (ldd-based) needs the actual DT_NEEDED SONAME + # (libonnxruntime.so.1, not the dev-symlink libonnxruntime.so) on + # its own search path to locate and bundle it into the wheel. + cibw-environment-linux: > + MAKEFLAGS=-j$(nproc) + SHERPA_ONNXRUNTIME_INCLUDE_DIR=/project/onnxruntime-riscv64/include + SHERPA_ONNXRUNTIME_LIB_DIR=/project/onnxruntime-riscv64/lib + LD_LIBRARY_PATH=/project/onnxruntime-riscv64/lib + # sherpa-onnx 2.0.0 dropped the bundled espeak-ng: the Piper VITS model + # is driven through a lexicon (--vits-lexicon) instead of the + # espeak-ng-data directory, which is now ignored and leaves the model + # with no way to turn text into tokens. + cibw-test-command: > + python -c "import sherpa_onnx; print(sherpa_onnx.__version__); print(sherpa_onnx.OnlineRecognizer); print(sherpa_onnx.OfflineRecognizer)" && + sherpa-onnx-offline --help && + sherpa-onnx-offline-tts --help && + curl -fsSL --retry 5 https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23.tar.bz2 | tar xj && + sherpa-onnx --tokens=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/tokens.txt --encoder=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/encoder-epoch-99-avg-1.onnx --decoder=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/decoder-epoch-99-avg-1.onnx --joiner=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/joiner-epoch-99-avg-1.onnx ./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/test_wavs/0.wav && + curl -fsSL --retry 5 https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-lessac-medium.tar.bz2 | tar xj && + curl -fsSL --retry 5 -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/lexicon-en-us.txt && + sherpa-onnx-offline-tts --vits-model=./vits-piper-en_US-lessac-medium/en_US-lessac-medium.onnx --vits-lexicon=./lexicon-en-us.txt --vits-tokens=./vits-piper-en_US-lessac-medium/tokens.txt --output-filename=./test.wav 'test' && + test -s ./test.wav publish: name: Publish sherpa-onnx ${{ matrix.version }} diff --git a/.github/workflows/build-sqruff.yml b/.github/workflows/build-sqruff.yml index 1e6d68a0f538..9621145ee91f 100644 --- a/.github/workflows/build-sqruff.yml +++ b/.github/workflows/build-sqruff.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build sqruff ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -70,68 +68,50 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - SQRUFF_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout sqruff v${{ env.SQRUFF_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: quarylabs/sqruff - ref: v${{ env.SQRUFF_VERSION }} - persist-credentials: false - - - name: Stage the licence beside sqruff's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory, which - # in this workspace is crates/cli-python/ -- so upstream's published - # wheels carry no licence text at all. - run: cp LICENSE crates/cli-python/LICENSE - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: crates/cli-python - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # sqruff's crates/cli-python ships no [tool.cibuildwheel], so the Rust - # toolchain its maturin backend needs is installed in-container here; - # rustup then picks up the repo's rust-toolchain.toml (1.97.1) itself. - 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" - # No wheel-level test suite ships in the sdist (crates/cli-python/tests/*.rs - # are Rust integration tests run by upstream's own `cargo test`, never - # packaged), so drive the real linter/fixer against a known fixture instead - # of settling for a bare --version check. - CIBW_TEST_COMMAND: | - python3 -c "import sqruff._lib_name as m, importlib.metadata as md; assert m.__file__.endswith('.so'), m.__file__; assert any(str(p).endswith('licenses/LICENSE') for p in md.files('sqruff'))" - sqruff --version - sqruff --help >/dev/null - sqruff dialects >/dev/null - work=$(mktemp -d) - printf 'SELECT foo bar, * FROM tabs\n' > "$work/bad.sql" - set +e - sqruff lint "$work/bad.sql" - rc=$? - set -e - [ "$rc" -eq 1 ] - set +e - sqruff fix "$work/bad.sql" - rc=$? - set -e - [ "$rc" -eq 0 ] - grep -q 'SELECT foo AS bar, \* FROM tabs' "$work/bad.sql" - sqruff lint "$work/bad.sql" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sqruff-${{ env.SQRUFF_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error - + # maturin globs LICEN[CS]E* relative to the pyproject directory, which + # in this workspace is crates/cli-python/ -- so upstream's published + # wheels carry no licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "sqruff" + version: "${{ matrix.version }}" + repository: "quarylabs/sqruff" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + pre-build: "cp LICENSE crates/cli-python/LICENSE" + cibw-package-dir: "crates/cli-python" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # sqruff's crates/cli-python ships no [tool.cibuildwheel], so the Rust + # toolchain its maturin backend needs is installed in-container here; + # rustup then picks up the repo's rust-toolchain.toml (1.97.1) itself. + 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" + # No wheel-level test suite ships in the sdist (crates/cli-python/tests/*.rs + # are Rust integration tests run by upstream's own `cargo test`, never + # packaged), so drive the real linter/fixer against a known fixture instead + # of settling for a bare --version check. + cibw-test-command: |- + python3 -c "import sqruff._lib_name as m, importlib.metadata as md; assert m.__file__.endswith('.so'), m.__file__; assert any(str(p).endswith('licenses/LICENSE') for p in md.files('sqruff'))" + sqruff --version + sqruff --help >/dev/null + sqruff dialects >/dev/null + work=$(mktemp -d) + printf 'SELECT foo bar, * FROM tabs\n' > "$work/bad.sql" + set +e + sqruff lint "$work/bad.sql" + rc=$? + set -e + [ "$rc" -eq 1 ] + set +e + sqruff fix "$work/bad.sql" + rc=$? + set -e + [ "$rc" -eq 0 ] + grep -q 'SELECT foo AS bar, \* FROM tabs' "$work/bad.sql" + sqruff lint "$work/bad.sql" publish: name: Publish sqruff ${{ matrix.version }} needs: [setup, build_wheels] diff --git a/.github/workflows/build-surrealdb.yml b/.github/workflows/build-surrealdb.yml index 46ffc5142d2b..082e51a37803 100644 --- a/.github/workflows/build-surrealdb.yml +++ b/.github/workflows/build-surrealdb.yml @@ -55,65 +55,43 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build surrealdb ${{ matrix.version }} cp39-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 480 - - env: - SURREALDB_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout surrealdb.py v${{ env.SURREALDB_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: surrealdb/surrealdb.py - ref: v${{ env.SURREALDB_VERSION }} - persist-credentials: false - - - name: Write the wheel test - run: | - cat > test_surrealdb_embedded.py <<'EOF' - import surrealdb._surrealdb_ext as ext - assert ext.__file__.endswith('.so'), ext.__file__ - - from surrealdb import Surreal - - with Surreal("mem://") as db: - db.use("test", "test") - created = db.create("person", {"name": "Jane", "age": 30}) - assert created["name"] == "Jane", created - people = db.select("person") - assert len(people) == 1 and people[0]["age"] == 30, people - EOF + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "surrealdb" + version: "${{ matrix.version }}" + repository: "surrealdb/surrealdb.py" + ref: "v${{ matrix.version }}" + artifact-tag: "cp39-abi3-manylinux_riscv64" + timeout-minutes: 480 + pre-build: |- + cat > test_surrealdb_embedded.py <<'EOF' + import surrealdb._surrealdb_ext as ext + assert ext.__file__.endswith('.so'), ext.__file__ - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ARCHS: riscv64 - # pyo3 carries `abi3-py39` workspace-wide (Cargo.toml), so every interpreter - # yields the same cp39-abi3 wheel: cibuildwheel compiles once on cp312 and - # reuses it for cp313/cp314 while still running the test suite on each. - # cp314t is skipped: the stable ABI a wheel like this ships has no - # free-threaded build. - CIBW_BUILD: "cp312-* cp313-* cp314-*" - # rustup.rs ships no riscv64 musl toolchain. - CIBW_SKIP: "*-musllinux_*" - 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" - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=aiohttp,pydantic-core,websockets - CIBW_TEST_SOURCES: test_surrealdb_embedded.py - CIBW_TEST_COMMAND: python test_surrealdb_embedded.py + from surrealdb import Surreal - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: surrealdb-${{ env.SURREALDB_VERSION }}-cp39-abi3-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + with Surreal("mem://") as db: + db.use("test", "test") + created = db.create("person", {"name": "Jane", "age": 30}) + assert created["name"] == "Jane", created + people = db.select("person") + assert len(people) == 1 and people[0]["age"] == 30, people + EOF + # pyo3 carries `abi3-py39` workspace-wide (Cargo.toml), so every interpreter + # yields the same cp39-abi3 wheel: cibuildwheel compiles once on cp312 and + # reuses it for cp313/cp314 while still running the test suite on each. + # cp314t is skipped: the stable ABI a wheel like this ships has no + # free-threaded build. + cibw-build: "cp312-* cp313-* cp314-*" + # rustup.rs ships no riscv64 musl toolchain. + cibw-skip: "*-musllinux_*" + 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" + PIP_ONLY_BINARY=aiohttp,pydantic-core,websockets + cibw-test-sources: "test_surrealdb_embedded.py" + cibw-test-command: "python test_surrealdb_embedded.py" publish: name: Publish surrealdb ${{ matrix.version }} diff --git a/.github/workflows/build-sxtwl.yml b/.github/workflows/build-sxtwl.yml index d3872db8d667..215e28ede7ac 100644 --- a/.github/workflows/build-sxtwl.yml +++ b/.github/workflows/build-sxtwl.yml @@ -53,56 +53,37 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build sxtwl ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 45 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - SXTWL_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout sxtwl_cpp ${{ env.SXTWL_REF }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: yuangu/sxtwl_cpp - ref: ${{ env.SXTWL_REF }} - persist-credentials: false - - # Upstream's released wheel carries no LICENSE at all (python/ has none, and - # MANIFEST.in never references the repo-root one); setuptools auto-discovers - # it once copied in and stages it under dist-info/licenses/. - - name: Stage the sxtwl licence - run: cp LICENSE python/LICENSE - - - name: Build and test wheel - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # No formal test suite ships (example/main.py is a demo script, not pytest). - # Smoke-test against the Spring Festival of the Year of the Dragon, a fixed, - # independently verifiable fact: 2024-02-10 is lunar 1-1 of a jiachen (甲辰) - # year, and the solar<->lunar conversion round-trips. - CIBW_TEST_COMMAND: >- - python -c "import sxtwl; - d = sxtwl.fromSolar(2024, 2, 10); - assert (d.getLunarMonth(), d.getLunarDay(), d.isLunarLeap()) == (1, 1, False); - gz = d.getYearGZ(); - assert (gz.tg, gz.dz) == (0, 4); - d2 = sxtwl.fromLunar(2024, 1, 1); - assert (d2.getSolarYear(), d2.getSolarMonth(), d2.getSolarDay()) == (2024, 2, 10)" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: sxtwl-${{ env.SXTWL_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # Upstream's released wheel carries no LICENSE at all (python/ has none, and + # MANIFEST.in never references the repo-root one); setuptools auto-discovers + # it once copied in and stages it under dist-info/licenses/. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "sxtwl" + version: "${{ matrix.version }}" + repository: "yuangu/sxtwl_cpp" + ref: "98b731a66bfdb1b98de2209b01fc6609351e6a4d" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 45 + pre-build: "cp LICENSE python/LICENSE" + cibw-package-dir: "python" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # No formal test suite ships (example/main.py is a demo script, not pytest). + # Smoke-test against the Spring Festival of the Year of the Dragon, a fixed, + # independently verifiable fact: 2024-02-10 is lunar 1-1 of a jiachen (甲辰) + # year, and the solar<->lunar conversion round-trips. + cibw-test-command: > + python -c "import sxtwl; + d = sxtwl.fromSolar(2024, 2, 10); + assert (d.getLunarMonth(), d.getLunarDay(), d.isLunarLeap()) == (1, 1, False); + gz = d.getYearGZ(); + assert (gz.tg, gz.dz) == (0, 4); + d2 = sxtwl.fromLunar(2024, 1, 1); + assert (d2.getSolarYear(), d2.getSolarMonth(), d2.getSolarDay()) == (2024, 2, 10)" publish: name: Publish sxtwl ${{ matrix.version }} diff --git a/.github/workflows/build-tdewolff-minify.yml b/.github/workflows/build-tdewolff-minify.yml index f1a1409832d3..5d4b72bb4307 100644 --- a/.github/workflows/build-tdewolff-minify.yml +++ b/.github/workflows/build-tdewolff-minify.yml @@ -49,54 +49,34 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build tdewolff-minify ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - TDEWOLFF_MINIFY_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout minify v${{ env.TDEWOLFF_MINIFY_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: tdewolff/minify - ref: v${{ env.TDEWOLFF_MINIFY_VERSION }} - fetch-depth: 0 - persist-credentials: false - - - name: Stage the licence beside bindings/py/setup.py - run: cp LICENSE bindings/py/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: bindings/py - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_ALL: .ci/ensure-go.sh; make -C bindings/py compile - CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - # Upstream's wheel job runs no tests; this is bindings/py/example/example.py. - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata, pathlib, tempfile, minify; - minify.config({'html-keep-document-tags': 0}); - assert minify.string('text/html', '

lala') == '
lala', minify.string('text/html', '
lala'); - assert minify.string('application/json', '{ \"a\" : [ 1 , 2 ] }') == '{\"a\":[1,2]}'; - d = pathlib.Path(tempfile.mkdtemp()); (d / 'in.css').write_text('a { color : #ff0000 ; }'); - minify.file('text/css', str(d / 'in.css'), str(d / 'out.css')); - assert (d / 'out.css').read_text() == 'a{color:red}', (d / 'out.css').read_text(); - assert any(str(p).endswith('licenses/LICENSE') for p in importlib.metadata.files('tdewolff-minify'))" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: tdewolff-minify-${{ env.TDEWOLFF_MINIFY_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "tdewolff-minify" + version: "${{ matrix.version }}" + repository: "tdewolff/minify" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 90 + checkout-fetch-depth: 0 + pre-build: "cp LICENSE bindings/py/" + cibw-package-dir: "bindings/py" + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-before-all: ".ci/ensure-go.sh; make -C bindings/py compile" + # Upstream's wheel job runs no tests; this is bindings/py/example/example.py. + cibw-test-command: > + python -c "import importlib.metadata, pathlib, tempfile, minify; + minify.config({'html-keep-document-tags': 0}); + assert minify.string('text/html', '
lala') == '
lala', minify.string('text/html', '
lala'); + assert minify.string('application/json', '{ \"a\" : [ 1 , 2 ] }') == '{\"a\":[1,2]}'; + d = pathlib.Path(tempfile.mkdtemp()); (d / 'in.css').write_text('a { color : #ff0000 ; }'); + minify.file('text/css', str(d / 'in.css'), str(d / 'out.css')); + assert (d / 'out.css').read_text() == 'a{color:red}', (d / 'out.css').read_text(); + assert any(str(p).endswith('licenses/LICENSE') for p in importlib.metadata.files('tdewolff-minify'))" publish: name: Publish tdewolff-minify ${{ matrix.version }} diff --git a/.github/workflows/build-typedunits.yml b/.github/workflows/build-typedunits.yml index 66173027dc62..3c657a793ef1 100644 --- a/.github/workflows/build-typedunits.yml +++ b/.github/workflows/build-typedunits.yml @@ -49,51 +49,31 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build typedunits ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - TYPEDUNITS_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout typedunits v${{ env.TYPEDUNITS_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: quantumlib/TypedUnits - ref: v${{ env.TYPEDUNITS_VERSION }} - persist-credentials: false - - - name: Write package version - # setup.py reads version/version.txt, falling back to ".dev" otherwise; - # upstream's own release workflow writes this file in a separate host-side job - # before cibuildwheel so the built wheel's version matches the git tag exactly. - run: | - mkdir -p version - echo "${{ env.TYPEDUNITS_VERSION }}" > version/version.txt - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy,protobuf - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: >- - python -c "import tunits_core; assert tunits_core.__file__.endswith('.so')" - && python -m pytest -v {package}/test - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: typedunits-${{ env.TYPEDUNITS_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # setup.py reads version/version.txt, falling back to ".dev" otherwise; + # upstream's own release workflow writes this file in a separate host-side job + # before cibuildwheel so the built wheel's version matches the git tag exactly. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "typedunits" + version: "${{ matrix.version }}" + repository: "quantumlib/TypedUnits" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + pre-build: |- + mkdir -p version + echo "${{ matrix.version }}" > version/version.txt + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + cibw-environment-linux: > + PIP_ONLY_BINARY=numpy,protobuf + cibw-test-requires: "pytest" + cibw-test-command: > + python -c "import tunits_core; assert tunits_core.__file__.endswith('.so')" + && python -m pytest -v {package}/test publish: name: Publish typedunits ${{ matrix.version }} diff --git a/.github/workflows/build-vesin-torch.yml b/.github/workflows/build-vesin-torch.yml index ea32c60648e5..2c55097eedb6 100644 --- a/.github/workflows/build-vesin-torch.yml +++ b/.github/workflows/build-vesin-torch.yml @@ -56,78 +56,57 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build vesin-torch ${{ matrix.version }} py3-none-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 90 - - env: - VESIN_TORCH_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout vesin v${{ env.VESIN_TORCH_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Luthaf/vesin - ref: v${{ env.VESIN_TORCH_VERSION }} - persist-credentials: false - - # setup.py's `universal_wheel` forces py3-none, so one build serves every - # interpreter. The wheel statically links gpulite (fetched by CMake) and - # dynamically links torch; none of their licences reach - # python/vesin_torch's pyproject.toml glob root, so upstream ships none. - - name: Stage the vesin and gpulite licences - run: | - cp LICENSE python/vesin_torch/LICENSE - curl -fsSL --retry 5 "https://raw.githubusercontent.com/metatensor/gpu-lite/${{ env.GPULITE_COMMIT }}/LICENSE" -o python/vesin_torch/LICENSE.gpulite - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python/vesin_torch - output-dir: wheelhouse/ - only: cp312-manylinux_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BUILD_FRONTEND: build - # The build backend (python/vesin_torch/build-backend/backend.py) adds - # cmake + torch==.* as dynamic - # build-time requirements, resolved from our registry like upstream - # resolves them from download.pytorch.org. - VESIN_TORCH_BUILD_WITH_TORCH_VERSION: ${{ env.TORCH_VERSION }} - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=cmake,torch,numpy - VESIN_TORCH_BUILD_WITH_TORCH_VERSION=${{ env.TORCH_VERSION }}.* - # vesin_torch links libtorch/libc10 (provided by the torch wheel at - # runtime, loaded RTLD_GLOBAL before vesin_torch is), same as our - # torchaudio port; excluding them keeps auditwheel from vendoring them. - CIBW_REPAIR_WHEEL_COMMAND_LINUX: >- - auditwheel repair -w {dest_dir} {wheel} - --exclude libtorch.so - --exclude libtorch_cpu.so - --exclude libtorch_python.so - --exclude libtorch_global_deps.so - --exclude libc10.so - --exclude libgomp.so.1 - # numpy is not a vesin-torch test dependency, but without it `import - # torch` warns "Failed to initialize NumPy", which the tests' - # `filterwarnings = ["error"]` turns into a collection error. - # Upstream gets numpy transitively through ase (tox optional_deps). - CIBW_TEST_REQUIRES: pytest numpy torch==${{ env.TORCH_VERSION }}.* - # {project} is the checkout root, not package-dir, since - # python/vesin_torch's CMakeLists.txt needs the sibling top-level - # vesin/ and vesin-torch/ (C++ library) directories. - # test_metatomic.py needs metatensor-torch/metatomic-torch, neither - # of which this registry carries; deselect it rather than the whole file. - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as md; - assert {p.name for p in md.files('vesin_torch') if 'licenses' in str(p)} == {'LICENSE', 'LICENSE.gpulite'}" && - python {project}/scripts/pytest-dont-rewrite-torch.py && - pytest {project}/python/vesin_torch/tests --ignore={project}/python/vesin_torch/tests/test_metatomic.py - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: vesin-torch-${{ env.VESIN_TORCH_VERSION }}-py3-none-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # setup.py's `universal_wheel` forces py3-none, so one build serves every + # interpreter. The wheel statically links gpulite (fetched by CMake) and + # dynamically links torch; none of their licences reach + # python/vesin_torch's pyproject.toml glob root, so upstream ships none. + # The build backend (python/vesin_torch/build-backend/backend.py) adds + # cmake + torch==.* as dynamic + # build-time requirements, resolved from our registry like upstream + # resolves them from download.pytorch.org. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "vesin-torch" + version: "${{ matrix.version }}" + repository: "Luthaf/vesin" + ref: "v${{ matrix.version }}" + artifact-tag: "py3-none-manylinux_riscv64" + timeout-minutes: 90 + pre-build: |- + cp LICENSE python/vesin_torch/LICENSE + curl -fsSL --retry 5 "https://raw.githubusercontent.com/metatensor/gpu-lite/6c221167aeca7e113ea6f27e9a2e12391bdb189a/LICENSE" -o python/vesin_torch/LICENSE.gpulite + cibw-package-dir: "python/vesin_torch" + cibw-build: "cp312-manylinux_riscv64" + cibw-build-frontend: "build" + cibw-environment-linux: > + PIP_ONLY_BINARY=cmake,torch,numpy + VESIN_TORCH_BUILD_WITH_TORCH_VERSION=2.13.* + # vesin_torch links libtorch/libc10 (provided by the torch wheel at + # runtime, loaded RTLD_GLOBAL before vesin_torch is), same as our + # torchaudio port; excluding them keeps auditwheel from vendoring them. + cibw-repair-wheel-command-linux: > + auditwheel repair -w {dest_dir} {wheel} + --exclude libtorch.so + --exclude libtorch_cpu.so + --exclude libtorch_python.so + --exclude libtorch_global_deps.so + --exclude libc10.so + --exclude libgomp.so.1 + # numpy is not a vesin-torch test dependency, but without it `import + # torch` warns "Failed to initialize NumPy", which the tests' + # `filterwarnings = ["error"]` turns into a collection error. + # Upstream gets numpy transitively through ase (tox optional_deps). + cibw-test-requires: "pytest numpy torch==2.13.*" + # {project} is the checkout root, not package-dir, since + # python/vesin_torch's CMakeLists.txt needs the sibling top-level + # vesin/ and vesin-torch/ (C++ library) directories. + # test_metatomic.py needs metatensor-torch/metatomic-torch, neither + # of which this registry carries; deselect it rather than the whole file. + cibw-test-command: > + python -c "import importlib.metadata as md; + assert {p.name for p in md.files('vesin_torch') if 'licenses' in str(p)} == {'LICENSE', 'LICENSE.gpulite'}" && + python {project}/scripts/pytest-dont-rewrite-torch.py && + pytest {project}/python/vesin_torch/tests --ignore={project}/python/vesin_torch/tests/test_metatomic.py publish: name: Publish vesin-torch ${{ matrix.version }} diff --git a/.github/workflows/build-vesin.yml b/.github/workflows/build-vesin.yml index 4214e6fdc015..3e849727b1c6 100644 --- a/.github/workflows/build-vesin.yml +++ b/.github/workflows/build-vesin.yml @@ -53,60 +53,40 @@ jobs: matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} name: Build vesin ${{ matrix.version }} py3-none-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 45 - - env: - VESIN_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout vesin v${{ env.VESIN_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: Luthaf/vesin - ref: v${{ env.VESIN_VERSION }} - persist-credentials: false - - # setup.py's `universal_wheel` forces py3-none, so one build serves every - # interpreter. The wheel statically links gpulite (fetched by CMake); neither - # licence reaches python/vesin's pyproject.toml glob root, so upstream ships none. - - name: Stage the vesin and gpulite licences - run: | - cp LICENSE python/vesin/LICENSE - curl -fsSL --retry 5 "https://raw.githubusercontent.com/metatensor/gpu-lite/${{ env.GPULITE_COMMIT }}/LICENSE" -o python/vesin/LICENSE.gpulite - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python/vesin - output-dir: wheelhouse/ - only: cp312-manylinux_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BUILD_FRONTEND: build - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=cmake,numpy,scipy,matplotlib - # ase (a test-only dep) pulls in numpy/scipy/matplotlib; without pinning - # them to our registry's riscv64 wheels too, pip can resolve a newer - # PyPI-only release of one and fall back to a from-source build (gotcha 291). - CIBW_TEST_REQUIRES: pytest pytest-timeout ase - # {project} is the checkout root, not package-dir, since python/vesin's CMakeLists.txt - # needs the sibling top-level vesin/ (C++ library) directory. - # test_fork_during_calculations deterministically times out (>10s, pytest-timeout) - # forking while a background thread holds the native threadpool's locks -- 2/2 on - # this runner (run 34600349160, incl. a rerun); upstream's own x86_64/arm64/Windows - # CI never exercises riscv64. -k, not --deselect (gotcha 14): nodeids are - # rootdir-relative, {project} here is absolute. - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as md; - assert {p.name for p in md.files('vesin') if 'licenses' in str(p)} == {'LICENSE', 'LICENSE.gpulite'}" && - pytest {project}/python/vesin/tests -k "not test_fork_during_calculations" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: vesin-${{ env.VESIN_VERSION }}-py3-none-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # setup.py's `universal_wheel` forces py3-none, so one build serves every + # interpreter. The wheel statically links gpulite (fetched by CMake); neither + # licence reaches python/vesin's pyproject.toml glob root, so upstream ships none. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "vesin" + version: "${{ matrix.version }}" + repository: "Luthaf/vesin" + ref: "v${{ matrix.version }}" + artifact-tag: "py3-none-manylinux_riscv64" + timeout-minutes: 45 + pre-build: |- + cp LICENSE python/vesin/LICENSE + curl -fsSL --retry 5 "https://raw.githubusercontent.com/metatensor/gpu-lite/6c221167aeca7e113ea6f27e9a2e12391bdb189a/LICENSE" -o python/vesin/LICENSE.gpulite + cibw-package-dir: "python/vesin" + cibw-build: "cp312-manylinux_riscv64" + cibw-build-frontend: "build" + cibw-environment-linux: > + PIP_ONLY_BINARY=cmake,numpy,scipy,matplotlib + # ase (a test-only dep) pulls in numpy/scipy/matplotlib; without pinning + # them to our registry's riscv64 wheels too, pip can resolve a newer + # PyPI-only release of one and fall back to a from-source build (gotcha 291). + cibw-test-requires: "pytest pytest-timeout ase" + # {project} is the checkout root, not package-dir, since python/vesin's CMakeLists.txt + # needs the sibling top-level vesin/ (C++ library) directory. + # test_fork_during_calculations deterministically times out (>10s, pytest-timeout) + # forking while a background thread holds the native threadpool's locks -- 2/2 on + # this runner (run 34600349160, incl. a rerun); upstream's own x86_64/arm64/Windows + # CI never exercises riscv64. -k, not --deselect (gotcha 14): nodeids are + # rootdir-relative, {project} here is absolute. + cibw-test-command: > + python -c "import importlib.metadata as md; + assert {p.name for p in md.files('vesin') if 'licenses' in str(p)} == {'LICENSE', 'LICENSE.gpulite'}" && + pytest {project}/python/vesin/tests -k "not test_fork_during_calculations" publish: name: Publish vesin ${{ matrix.version }} diff --git a/.github/workflows/build-vina.yml b/.github/workflows/build-vina.yml index 8a98437fbd35..4b0386883e5d 100644 --- a/.github/workflows/build-vina.yml +++ b/.github/workflows/build-vina.yml @@ -48,66 +48,46 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build vina ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.setup.outputs.matrix) }} - env: - VINA_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout AutoDock-Vina v${{ env.VINA_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: ccsb-scripps/AutoDock-Vina - ref: v${{ env.VINA_VERSION }} - persist-credentials: false - - - name: Prepare the python package directory - # Mirrors upstream's own `cp -R ./build/python/* .` wheel-build step: the - # setup.py in build/python addresses its native sources (src/lib/*.cpp) and - # SWIG interface relative to the repository root, so it is copied there - # rather than used as cibuildwheel's package-dir. - # That copy overwrites the tracked root README.md, so setup.py's fallback - # `git describe --dirty=@mod` would version the wheel `1.2.7+mod`; like - # upstream's "Add tag to version.py file" step, pin vina/version.py (which - # setup.py reads first) to the release version. - run: | - echo "${VINA_VERSION}" > ./build/python/vina/version.py - cp -R ./build/python/* . - - - name: Write the wheel test - run: | - cat > test_vina.py <<'EOF' - from vina import Vina - - v = Vina(sf_name="vina", verbosity=0) - assert v.__class__.__name__ == "Vina" - EOF + # Mirrors upstream's own `cp -R ./build/python/* .` wheel-build step: the + # setup.py in build/python addresses its native sources (src/lib/*.cpp) and + # SWIG interface relative to the repository root, so it is copied there + # rather than used as cibuildwheel's package-dir. + # That copy overwrites the tracked root README.md, so setup.py's fallback + # `git describe --dirty=@mod` would version the wheel `1.2.7+mod`; like + # upstream's "Add tag to version.py file" step, pin vina/version.py (which + # setup.py reads first) to the release version. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "vina" + version: "${{ matrix.version }}" + repository: "ccsb-scripps/AutoDock-Vina" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + timeout-minutes: 360 + pre-build: |- + export VINA_VERSION='${{ matrix.version }}' + echo "${VINA_VERSION}" > ./build/python/vina/version.py + cp -R ./build/python/* . - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - output-dir: wheelhouse/ - only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 - env: - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Rocky 10's own boost-devel (behind crb) and swig packages replace - # upstream's from-source SWIG 4.0.2 + Boost 1.82.0 builds (both built purely - # for a build-time compiler/linker, so the substitution has no effect on - # what ships in the wheel). - CIBW_BEFORE_ALL: dnf -y install --enablerepo=crb boost-devel swig - CIBW_TEST_SOURCES: test_vina.py - CIBW_TEST_COMMAND: python test_vina.py + cat > test_vina.py <<'EOF' + from vina import Vina - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: vina-${{ env.VINA_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + v = Vina(sf_name="vina", verbosity=0) + assert v.__class__.__name__ == "Vina" + EOF + cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64" + # Rocky 10's own boost-devel (behind crb) and swig packages replace + # upstream's from-source SWIG 4.0.2 + Boost 1.82.0 builds (both built purely + # for a build-time compiler/linker, so the substitution has no effect on + # what ships in the wheel). + cibw-before-all: "dnf -y install --enablerepo=crb boost-devel swig" + cibw-test-sources: "test_vina.py" + cibw-test-command: "python test_vina.py" publish: name: Publish vina ${{ matrix.version }} diff --git a/.github/workflows/build-voyager.yml b/.github/workflows/build-voyager.yml index 5f11560d5118..81b6a10da328 100644 --- a/.github/workflows/build-voyager.yml +++ b/.github/workflows/build-voyager.yml @@ -45,7 +45,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build voyager ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv strategy: fail-fast: false matrix: @@ -63,43 +62,25 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - VOYAGER_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout voyager v${{ env.VOYAGER_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: spotify/voyager - ref: v${{ env.VOYAGER_VERSION }} - persist-credentials: false - - # LICENSE is copied alongside README.md so setuptools' default glob ships it; upstream's - # wheels carry no licence text. - - name: Copy README, LICENSE and C++ sources into place - run: | - cp README.md LICENSE python/ - cp -r cpp python/cpp - - - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: python - output-dir: wheelhouse - env: - CIBW_ARCHS: riscv64 - CIBW_BUILD: ${{ matrix.build }} - CIBW_ENVIRONMENT: >- - PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ - PIP_ONLY_BINARY=numpy - # The rest of dev-requirements.txt is lint/docs/benchmark tooling the tests never import. - CIBW_TEST_REQUIRES: pytest numpy - CIBW_TEST_COMMAND: pytest {package}/tests -x - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: voyager-${{ env.VOYAGER_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # LICENSE is copied alongside README.md so setuptools' default glob ships it; upstream's + # wheels carry no licence text. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "voyager" + version: "${{ matrix.version }}" + repository: "spotify/voyager" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + pre-build: |- + cp README.md LICENSE python/ + cp -r cpp python/cpp + cibw-package-dir: "python" + cibw-build: "${{ matrix.build }}" + cibw-environment-linux: > + PIP_ONLY_BINARY=numpy + # The rest of dev-requirements.txt is lint/docs/benchmark tooling the tests never import. + cibw-test-requires: "pytest numpy" + cibw-test-command: "pytest {package}/tests -x" publish: name: Publish voyager ${{ matrix.version }} diff --git a/.github/workflows/build-xa11y.yml b/.github/workflows/build-xa11y.yml index 9329d6326637..e82118f05e14 100644 --- a/.github/workflows/build-xa11y.yml +++ b/.github/workflows/build-xa11y.yml @@ -50,60 +50,41 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build xa11y ${{ matrix.version }} cp39-abi3-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 120 strategy: fail-fast: false matrix: version: ${{ fromJSON(needs.setup.outputs.versions) }} - env: - XA11Y_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout xa11y v${{ env.XA11Y_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: xa11y/xa11y - ref: v${{ env.XA11Y_VERSION }} - persist-credentials: false - - # Upstream's release job stamps the workspace version into xa11y-python after tagging. - - name: Sync Python package version - run: | - VERSION=$(sed -n '/\[workspace\.package\]/,/\[/{s/^version = "\(.*\)"/\1/p}' Cargo.toml) - test "$VERSION" = "$XA11Y_VERSION" - sed -i "s/^version = \".*\"/version = \"$VERSION\"/" xa11y-python/Cargo.toml - - - name: Stage the licence beside xa11y-python's pyproject.toml - run: cp LICENSE xa11y-python/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: xa11y-python - output-dir: wheelhouse/ - env: - CIBW_BUILD: cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64 - 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 && - dnf install -y dbus-devel libxkbcommon-devel && - cp /usr/share/licenses/libxkbcommon/LICENSE {project}/xa11y-python/LICENSE.libxkbcommon - CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: xa11y-python/tests - CIBW_TEST_COMMAND: >- - python -c "import importlib.metadata as md; - lic = {p.name for p in md.files('xa11y') if '.dist-info/licenses/' in str(p)} - {''}; - assert lic == {'LICENSE', 'LICENSE.libxkbcommon'}, lic" && - python -m pytest -v xa11y-python/tests + # Upstream's release job stamps the workspace version into xa11y-python after tagging. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "xa11y" + version: "${{ matrix.version }}" + repository: "xa11y/xa11y" + ref: "v${{ matrix.version }}" + artifact-tag: "cp39-abi3-manylinux_riscv64" + timeout-minutes: 120 + pre-build: |- + export XA11Y_VERSION='${{ matrix.version }}' + VERSION=$(sed -n '/\[workspace\.package\]/,/\[/{s/^version = "\(.*\)"/\1/p}' Cargo.toml) + test "$VERSION" = "$XA11Y_VERSION" + sed -i "s/^version = \".*\"/version = \"$VERSION\"/" xa11y-python/Cargo.toml - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: xa11y-${{ env.XA11Y_VERSION }}-cp39-abi3-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + cp LICENSE xa11y-python/ + cibw-package-dir: "xa11y-python" + cibw-build: "cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64" + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && + dnf install -y dbus-devel libxkbcommon-devel && + cp /usr/share/licenses/libxkbcommon/LICENSE {project}/xa11y-python/LICENSE.libxkbcommon + cibw-environment-linux: PATH="$PATH:$HOME/.cargo/bin" + cibw-test-requires: "pytest" + cibw-test-sources: "xa11y-python/tests" + cibw-test-command: > + python -c "import importlib.metadata as md; + lic = {p.name for p in md.files('xa11y') if '.dist-info/licenses/' in str(p)} - {''}; + assert lic == {'LICENSE', 'LICENSE.libxkbcommon'}, lic" && + python -m pytest -v xa11y-python/tests publish: name: Publish xa11y ${{ matrix.version }} diff --git a/.github/workflows/build-yara-x.yml b/.github/workflows/build-yara-x.yml index 7ad54c1389e3..7207f7adaf08 100644 --- a/.github/workflows/build-yara-x.yml +++ b/.github/workflows/build-yara-x.yml @@ -49,8 +49,6 @@ jobs: needs: [setup] if: needs.setup.outputs.versions != '[]' name: Build yara-x ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64 - runs-on: ubuntu-24.04-riscv - timeout-minutes: 360 strategy: fail-fast: false matrix: @@ -70,57 +68,40 @@ jobs: - tag: cp314t build: cp314t-manylinux_riscv64 - env: - YARA_X_VERSION: ${{ matrix.version }} - - steps: - - name: Checkout yara-x v${{ env.YARA_X_VERSION }} - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: VirusTotal/yara-x - ref: v${{ env.YARA_X_VERSION }} - persist-credentials: false - - - name: Stage the licence beside yara-x's pyproject.toml - # maturin globs LICEN[CS]E* relative to the pyproject directory (py/), - # not the workspace root, so upstream's published wheels carry no - # licence text at all. - run: cp LICENSE py/ - - - name: Build wheels - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 - with: - package-dir: py - output-dir: wheelhouse/ - env: - # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. - CIBW_BUILD: ${{ matrix.build }} - CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # py/ ships no [tool.cibuildwheel]; the Rust toolchain maturin - # needs is installed in-container here (gotcha 10). - CIBW_BEFORE_ALL_LINUX: >- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - # yara-x's own dependency graph (wasmtime + cranelift) is heavy - # enough to risk an alloc-failure SIGABRT at cargo's default - # parallelism on these 4-core runners (gotcha 228). - CIBW_ENVIRONMENT_LINUX: >- - PATH="$PATH:$HOME/.cargo/bin" - CARGO_BUILD_JOBS=2 - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_SOURCES: py/tests - # yara_x/__init__.py re-exports the compiled yara_x.yara_x - # submodule (gotcha 56). - CIBW_TEST_COMMAND: >- - python -c "import yara_x.yara_x as m, importlib.metadata as md; - assert m.__file__.endswith('.so'), m.__file__; - assert any(str(p).endswith('licenses/LICENSE') for p in md.files('yara-x'))" && - cd py && python -m pytest tests -v - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: yara-x-${{ env.YARA_X_VERSION }}-${{ matrix.tag }}-manylinux_riscv64 - path: wheelhouse/*.whl - if-no-files-found: error + # maturin globs LICEN[CS]E* relative to the pyproject directory (py/), + # not the workspace root, so upstream's published wheels carry no + # licence text at all. + uses: $/.github/workflows/_build-cibuildwheel.yml + with: + package: "yara-x" + version: "${{ matrix.version }}" + repository: "VirusTotal/yara-x" + ref: "v${{ matrix.version }}" + artifact-tag: "${{ matrix.tag }}-manylinux_riscv64" + timeout-minutes: 360 + pre-build: "cp LICENSE py/" + cibw-package-dir: "py" + # musllinux is dropped: rustup.rs ships no riscv64 musl toolchain. + cibw-build: "${{ matrix.build }}" + # py/ ships no [tool.cibuildwheel]; the Rust toolchain maturin + # needs is installed in-container here (gotcha 10). + cibw-before-all-linux: > + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # yara-x's own dependency graph (wasmtime + cranelift) is heavy + # enough to risk an alloc-failure SIGABRT at cargo's default + # parallelism on these 4-core runners (gotcha 228). + cibw-environment-linux: > + PATH="$PATH:$HOME/.cargo/bin" + CARGO_BUILD_JOBS=2 + cibw-test-requires: "pytest" + cibw-test-sources: "py/tests" + # yara_x/__init__.py re-exports the compiled yara_x.yara_x + # submodule (gotcha 56). + cibw-test-command: > + python -c "import yara_x.yara_x as m, importlib.metadata as md; + assert m.__file__.endswith('.so'), m.__file__; + assert any(str(p).endswith('licenses/LICENSE') for p in md.files('yara-x'))" && + cd py && python -m pytest tests -v publish: name: Publish yara-x ${{ matrix.version }}