From 6e69f14777abba458db7ee6ec9ab28adcca0bdf1 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 13 Oct 2026 21:43:18 +0000 Subject: [PATCH] cargo-xwin: Add version 0.23.1 --- .github/workflows/build-cargo-xwin.yml | 172 +++++++++++++++++++++++++ docs/packages/cargo-xwin.yaml | 5 + 2 files changed, 177 insertions(+) create mode 100644 .github/workflows/build-cargo-xwin.yml create mode 100644 docs/packages/cargo-xwin.yaml diff --git a/.github/workflows/build-cargo-xwin.yml b/.github/workflows/build-cargo-xwin.yml new file mode 100644 index 000000000000..d03a01f6330f --- /dev/null +++ b/.github/workflows/build-cargo-xwin.yml @@ -0,0 +1,172 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `linux` job of +# https://github.com/rust-cross/cargo-xwin/blob/v0.23.1/.github/workflows/Release.yml +# and the Linux steps of the `test` job of +# https://github.com/rust-cross/cargo-xwin/blob/v0.23.1/.github/workflows/CI.yml +name: Build cargo-xwin wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/cargo-xwin.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-cargo-xwin.yml' + - 'docs/packages/cargo-xwin.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-cargo-xwin.yml' + - 'docs/packages/cargo-xwin.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: cargo-xwin + 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 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 + + test_wheel: + name: Test cargo-xwin ${{ matrix.version }} (${{ matrix.cross-compiler }}) + needs: [setup, build_wheel] + if: needs.setup.outputs.versions != '[]' + runs-on: ubuntu-24.04-riscv + timeout-minutes: 120 + env: + CARGO_XWIN_VERSION: ${{ matrix.version }} + UV_PYTHON_PREFERENCE: only-managed + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + XWIN_CROSS_COMPILER: ${{ matrix.cross-compiler }} + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + python-version: ['3.12'] + cross-compiler: [clang-cl, clang] + + 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 + + - name: Download wheel + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: cargo-xwin-${{ env.CARGO_XWIN_VERSION }}-manylinux_riscv64 + path: wheelhouse + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: ${{ matrix.python-version }} + activate-environment: true + enable-cache: false + + # wine-stable, upstream's other package, has no riscv64 build. + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install --quiet -y clang + + - uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master + with: + toolchain: stable + components: llvm-tools + targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc + + - name: Install wheel + run: uv pip install --reinstall --find-links wheelhouse "cargo-xwin==${CARGO_XWIN_VERSION}" + + # `xwin run`/`xwin test` need wine; the bindeps case is nightly-only upstream. + - name: Test wheel + run: | + set -euxo pipefail + cargo-xwin --version + ninja --version + + cargo xwin build --target x86_64-pc-windows-msvc --manifest-path tests/libhello/Cargo.toml + cargo xwin build --target x86_64-pc-windows-msvc --manifest-path tests/hello-tls/Cargo.toml + cargo xwin build --target x86_64-pc-windows-msvc --manifest-path tests/hello-rustls/Cargo.toml + cargo xwin build --manifest-path tests/hello-windows/Cargo.toml + RUSTFLAGS="-C target-feature=+crt-static" cargo-xwin build --target x86_64-pc-windows-msvc --manifest-path tests/hello-rustls/Cargo.toml + + cargo xwin build --target aarch64-pc-windows-msvc --manifest-path tests/libhello/Cargo.toml + cargo xwin build --target aarch64-pc-windows-msvc --manifest-path tests/hello-windows/Cargo.toml + cargo xwin build --target aarch64-pc-windows-msvc --manifest-path tests/hello-tls/Cargo.toml + + file tests/hello-windows/target/x86_64-pc-windows-msvc/debug/hello-windows.exe | grep -i 'PE32+ executable.*x86-64' + file tests/hello-windows/target/aarch64-pc-windows-msvc/debug/hello-windows.exe | grep -i 'PE32+ executable.*aarch64' + + publish: + name: Publish cargo-xwin ${{ 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: cargo-xwin-${{ matrix.version }}-manylinux_riscv64 diff --git a/docs/packages/cargo-xwin.yaml b/docs/packages/cargo-xwin.yaml new file mode 100644 index 000000000000..0c5dcd2bc5f8 --- /dev/null +++ b/docs/packages/cargo-xwin.yaml @@ -0,0 +1,5 @@ +package-name: cargo-xwin +source-code: https://github.com/rust-cross/cargo-xwin +license: MIT +versions: +- version: 0.23.1