Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/_build-maturin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT

name: Build wheels with maturin

on:
workflow_call:
inputs:
package:
description: Package name used for the uploaded artifact.
required: true
type: string
version:
description: Package version being built.
required: true
type: string
repository:
description: Upstream owner/repository to check out.
required: true
type: string
ref:
description: Upstream ref to check out.
required: true
type: string
artifact-tag:
description: Platform or ABI suffix used in the uploaded artifact name.
required: true
type: string
timeout-minutes:
description: Build job timeout in minutes.
required: false
default: 60
type: number
checkout-submodules:
description: actions/checkout submodules value (false, true, or recursive).
required: false
default: 'false'
type: string
maturin-args:
description: Arguments passed to maturin build, excluding the output directory.
required: true
type: string
maturin-target:
description: Rust target passed to maturin-action.
required: false
default: riscv64gc-unknown-linux-gnu
type: string
maturin-manylinux:
description: Manylinux compatibility level passed to maturin-action.
required: false
default: '2_39'
type: string
maturin-version:
description: Maturin version installed by maturin-action.
required: false
default: ''
type: string
maturin-working-directory:
description: Source-relative directory in which maturin runs.
required: false
default: .
type: string
maturin-output-directory:
description: Working-directory-relative wheel output directory.
required: false
default: dist
type: string
maturin-before-script-linux:
description: Script run by maturin-action before the Linux build.
required: false
default: git config --global --add safe.directory "*"
type: string
cargo-profile-release-lto:
description: CARGO_PROFILE_RELEASE_LTO value exported for the build.
required: false
default: ''
type: string
cargo-profile-release-codegen-units:
description: CARGO_PROFILE_RELEASE_CODEGEN_UNITS value exported for the build.
required: false
default: ''
type: string

jobs:
build_wheel:
name: Build ${{ inputs.package }} ${{ inputs.version }} ${{ inputs['artifact-tag'] }}
runs-on: ubuntu-24.04-riscv
timeout-minutes: ${{ inputs['timeout-minutes'] }}
steps:
- name: Checkout ${{ inputs.repository }} ${{ inputs.ref }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
submodules: ${{ inputs['checkout-submodules'] }}
persist-credentials: false

- name: Validate maturin configuration
env:
ARGS: ${{ inputs['maturin-args'] }}
WORKING_DIRECTORY: ${{ inputs['maturin-working-directory'] }}
OUTPUT_DIRECTORY: ${{ inputs['maturin-output-directory'] }}
run: |
python3 - <<'PY'
import os
import shlex

args = shlex.split(os.environ["ARGS"])
if any(
arg in {"-o", "--out"}
or arg.startswith("--out=")
or (arg.startswith("-o") and not arg.startswith("--"))
for arg in args
):
raise SystemExit("maturin-args must not set the output directory")
PY
for directory in "$WORKING_DIRECTORY" "$OUTPUT_DIRECTORY"; do
case "$directory" in
''|/*|../*|*/../*|*/..)
echo "directory must be a non-empty relative path without ..: $directory" >&2
exit 1
;;
esac
done

- name: Configure Cargo release profile
if: inputs['cargo-profile-release-lto'] != '' || inputs['cargo-profile-release-codegen-units'] != ''
env:
LTO: ${{ inputs['cargo-profile-release-lto'] }}
CODEGEN_UNITS: ${{ inputs['cargo-profile-release-codegen-units'] }}
run: |
if [ -n "$LTO" ]; then
echo "CARGO_PROFILE_RELEASE_LTO=$LTO" >> "$GITHUB_ENV"
fi
if [ -n "$CODEGEN_UNITS" ]; then
echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=$CODEGEN_UNITS" >> "$GITHUB_ENV"
fi

- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
maturin-version: ${{ inputs['maturin-version'] }}
target: ${{ inputs['maturin-target'] }}
args: ${{ inputs['maturin-args'] }} --out ${{ inputs['maturin-output-directory'] }}
working-directory: ${{ inputs['maturin-working-directory'] }}
manylinux: ${{ inputs['maturin-manylinux'] }}
before-script-linux: ${{ inputs['maturin-before-script-linux'] }}

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ inputs.package }}-${{ inputs.version }}-${{ inputs['artifact-tag'] }}
path: ${{ inputs['maturin-working-directory'] }}/${{ inputs['maturin-output-directory'] }}/*.whl
if-no-files-found: error
44 changes: 12 additions & 32 deletions .github/workflows/build-ast-grep-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,38 +49,18 @@ jobs:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build ast-grep-cli ${{ matrix.version }} manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 360

env:
AST_GREP_CLI_VERSION: ${{ matrix.version }}

steps:
- name: Checkout ast-grep v${{ env.AST_GREP_CLI_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ast-grep/ast-grep
ref: ${{ env.AST_GREP_CLI_VERSION }}
persist-credentials: false

# `[tool.maturin] bindings = "bin"`, manifest-path = crates/cli/Cargo.toml:
# the wheel is one compiled executable (actually two: ast-grep and its sg
# alias) with no ABI tag, so a single native build covers every interpreter.
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
target: riscv64gc-unknown-linux-gnu
args: --release --locked --out dist
manylinux: '2_39'
before-script-linux: git config --global --add safe.directory "*"

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ast-grep-cli-${{ env.AST_GREP_CLI_VERSION }}-manylinux_riscv64
path: dist/*.whl
if-no-files-found: error
# `[tool.maturin] bindings = "bin"`, manifest-path = crates/cli/Cargo.toml:
# the wheel is one compiled executable (actually two: ast-grep and its sg
# alias) with no ABI tag, so a single native build covers every interpreter.
uses: $/.github/workflows/_build-maturin.yml
with:
package: ast-grep-cli
version: ${{ matrix.version }}
repository: ast-grep/ast-grep
ref: ${{ matrix.version }}
artifact-tag: manylinux_riscv64
timeout-minutes: 360
maturin-args: --release --locked

test_wheel:
name: Test ast-grep-cli ${{ matrix.version }} on Python ${{ matrix.python-version }}
Expand Down
59 changes: 20 additions & 39 deletions .github/workflows/build-bauplan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,45 +49,26 @@ jobs:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build bauplan ${{ matrix.version }} manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 1440

env:
BAUPLAN_VERSION: ${{ matrix.version }}

steps:
- name: Checkout bauplan v${{ env.BAUPLAN_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: BauplanLabs/bauplan
ref: v${{ env.BAUPLAN_VERSION }}
persist-credentials: false

# Upstream builds the CLI on the runner and downloads a protoc release,
# which ships no riscv64 binary; both happen in the manylinux container
# here, with protoc from Rocky 10's CRB repo.
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
target: riscv64gc-unknown-linux-gnu
args: >-
--release --out dist
-i python3.12 python3.13 python3.14
manylinux: '2_39'
before-script-linux: |
set -euo pipefail
git config --global --add safe.directory "*"
yum install -y protobuf-compiler protobuf-devel
cargo build --release --bin bauplan
rm -f python/data/scripts/.gitkeep python/data/scripts/.gitignore
cp target/release/bauplan python/data/scripts/

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bauplan-${{ env.BAUPLAN_VERSION }}-manylinux_riscv64
path: dist/*.whl
if-no-files-found: error
# Upstream builds the CLI on the runner and downloads a protoc release,
# which ships no riscv64 binary; both happen in the manylinux container
# here, with protoc from Rocky 10's CRB repo.
uses: $/.github/workflows/_build-maturin.yml
with:
package: bauplan
version: ${{ matrix.version }}
repository: BauplanLabs/bauplan
ref: v${{ matrix.version }}
artifact-tag: manylinux_riscv64
timeout-minutes: 1440
maturin-args: >-
--release -i python3.12 python3.13 python3.14
maturin-before-script-linux: |
set -euo pipefail
git config --global --add safe.directory "*"
yum install -y protobuf-compiler protobuf-devel
cargo build --release --bin bauplan
rm -f python/data/scripts/.gitkeep python/data/scripts/.gitignore
cp target/release/bauplan python/data/scripts/

test_wheels:
name: Test bauplan ${{ matrix.version }} on Python ${{ matrix.python-version }}
Expand Down
44 changes: 12 additions & 32 deletions .github/workflows/build-cargo-lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,38 +49,18 @@ jobs:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build cargo-lambda ${{ matrix.version }} manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 360

env:
CARGO_LAMBDA_VERSION: ${{ matrix.version }}

steps:
- name: Checkout cargo-lambda v${{ env.CARGO_LAMBDA_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: cargo-lambda/cargo-lambda
ref: v${{ env.CARGO_LAMBDA_VERSION }}
persist-credentials: false

# Upstream cross-builds static musl in x86_64 rust-musl-cross images; build glibc
# natively, overriding pyproject's maturin<1.9 pin, which has no riscv64 asset (gotcha 344).
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
maturin-version: '1.15.0'
command: build
target: riscv64gc-unknown-linux-gnu
args: --release -o dist --strip -m crates/cargo-lambda-cli/Cargo.toml
manylinux: '2_39'
before-script-linux: git config --global --add safe.directory "*"

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cargo-lambda-${{ env.CARGO_LAMBDA_VERSION }}-manylinux_riscv64
path: dist/*.whl
if-no-files-found: error
# Upstream cross-builds static musl in x86_64 rust-musl-cross images; build glibc
# natively, overriding pyproject's maturin<1.9 pin, which has no riscv64 asset (gotcha 344).
uses: $/.github/workflows/_build-maturin.yml
with:
package: cargo-lambda
version: ${{ matrix.version }}
repository: cargo-lambda/cargo-lambda
ref: v${{ matrix.version }}
artifact-tag: manylinux_riscv64
timeout-minutes: 360
maturin-args: --release --strip -m crates/cargo-lambda-cli/Cargo.toml
maturin-version: '1.15.0'

test_wheel:
name: Test cargo-lambda ${{ matrix.version }} on Python ${{ matrix.python-version }}
Expand Down
46 changes: 13 additions & 33 deletions .github/workflows/build-cargo-xwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,19 @@ jobs:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build cargo-xwin ${{ matrix.version }} manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 360

env:
CARGO_XWIN_VERSION: ${{ matrix.version }}
CARGO_PROFILE_RELEASE_LTO: "true"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"

steps:
- name: Checkout cargo-xwin v${{ env.CARGO_XWIN_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: rust-cross/cargo-xwin
ref: v${{ env.CARGO_XWIN_VERSION }}
persist-credentials: false

# Upstream builds static *-unknown-linux-musl binaries in rust-musl-cross
# images, which have no riscv64 variant, so build glibc.
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
target: riscv64gc-unknown-linux-gnu
args: --release -o dist
manylinux: '2_39'
before-script-linux: git config --global --add safe.directory "*"

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cargo-xwin-${{ env.CARGO_XWIN_VERSION }}-manylinux_riscv64
path: dist/*.whl
if-no-files-found: error
# Upstream builds static *-unknown-linux-musl binaries in rust-musl-cross
# images, which have no riscv64 variant, so build glibc.
uses: $/.github/workflows/_build-maturin.yml
with:
package: cargo-xwin
version: ${{ matrix.version }}
repository: rust-cross/cargo-xwin
ref: v${{ matrix.version }}
artifact-tag: manylinux_riscv64
timeout-minutes: 360
maturin-args: --release
cargo-profile-release-lto: "true"
cargo-profile-release-codegen-units: "1"

test_wheel:
name: Test cargo-xwin ${{ matrix.version }} (${{ matrix.cross-compiler }})
Expand Down
Loading