diff --git a/.github/workflows/build-strix-agent.yml b/.github/workflows/build-strix-agent.yml new file mode 100644 index 000000000000..90bc8e914ba8 --- /dev/null +++ b/.github/workflows/build-strix-agent.yml @@ -0,0 +1,170 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build` job of +# https://github.com/usestrix/strix/blob/v1.7.0/.github/workflows/build-release.yml +# and the `wheel` job of its .github/workflows/ci-package.yml. +name: Build strix-agent wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/strix-agent.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-strix-agent.yml' + - 'docs/packages/strix-agent.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-strix-agent.yml' + - 'docs/packages/strix-agent.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: strix-agent + version: ${{ inputs.version }} + + build_wheel: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Build strix-agent ${{ matrix.version }} py3-none-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 45 + + env: + STRIX_AGENT_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout strix v${{ env.STRIX_AGENT_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: usestrix/strix + ref: v${{ env.STRIX_AGENT_VERSION }} + persist-credentials: false + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: '3.12' + activate-environment: true + enable-cache: false + + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: '1.24.x' + check-latest: true + cache: false + + - name: Build wheel + env: + STRIX_WHEEL_PLATFORM_TAG: manylinux_2_39_riscv64 + run: uv build --wheel + + - name: Check the wheel ships the riscv64 strix-tui sidecar + run: | + python3 - dist/*.whl <<'EOF' + import sys, zipfile + with zipfile.ZipFile(sys.argv[1]) as zf: + names = zf.namelist() + assert sys.argv[1].endswith("-py3-none-manylinux_2_39_riscv64.whl"), sys.argv[1] + assert "strix/bin/strix-tui" in names, names + assert "strix/interface/viewer/static/index.html" in names, names + wheel = zf.read(next(n for n in names if n.endswith(".dist-info/WHEEL"))).decode() + assert "Root-Is-Purelib: false" in wheel, wheel + assert "Tag: py3-none-manylinux_2_39_riscv64" in wheel, wheel + licenses = sorted(n.rsplit("/", 1)[-1] for n in names if ".dist-info/licenses/" in n) + assert licenses == ["LICENSE"], licenses + header = zf.read("strix/bin/strix-tui")[:20] + assert header[:4] == b"\x7fELF", header + assert header[18] == 0xF3, header # e_machine EM_RISCV + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: strix-agent-${{ env.STRIX_AGENT_VERSION }}-py3-none-manylinux_riscv64 + path: dist/*.whl + if-no-files-found: error + + test_wheel: + name: Test strix-agent ${{ matrix.version }} on Python ${{ matrix.python-version }} + needs: [setup, build_wheel] + if: needs.setup.outputs.versions != '[]' + runs-on: ubuntu-24.04-riscv + timeout-minutes: 30 + env: + STRIX_AGENT_VERSION: ${{ matrix.version }} + UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY: unsafe-best-match + UV_ONLY_BINARY: ':all:' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + python-version: ['3.12', '3.13', '3.14'] + + steps: + - name: Download wheel + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: strix-agent-${{ env.STRIX_AGENT_VERSION }}-py3-none-manylinux_riscv64 + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: ${{ matrix.python-version }} + activate-environment: true + enable-cache: false + + - name: Install wheel + run: uv pip install --find-links . "strix-agent==${STRIX_AGENT_VERSION}" + + - name: Test wheel + run: | + set -euo pipefail + strix --version + strix --help >/dev/null + python -c "import google.auth.transport.requests, boto3" + + # Without a backend to attach to, the sidecar exits right after start-up. + tui=$(python -c "from strix.interface.tui.runtime import GoTuiRuntime; print(*GoTuiRuntime.binary_command())") + case "$tui" in */site-packages/strix/bin/strix-tui) ;; *) echo "unexpected sidecar: $tui"; exit 1 ;; esac + rc=0 + err=$("$tui" &1) || rc=$? + echo "$err" + [ "$rc" -eq 1 ] + grep -q 'STRIX_TUI_FD or STRIX_TUI_ADDR and STRIX_TUI_TOKEN are required' <<<"$err" + + publish: + name: Publish strix-agent ${{ matrix.version }} + needs: [setup, build_wheel, test_wheel] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: strix-agent-${{ matrix.version }}-py3-none-manylinux_riscv64 diff --git a/docs/packages/strix-agent.yaml b/docs/packages/strix-agent.yaml new file mode 100644 index 000000000000..e46b27a955c7 --- /dev/null +++ b/docs/packages/strix-agent.yaml @@ -0,0 +1,5 @@ +package-name: strix-agent +source-code: https://github.com/usestrix/strix +license: Apache-2.0 +versions: +- version: 1.7.0