From fdeaea56cecde502de4700dacc6a93a373ec3125 Mon Sep 17 00:00:00 2001 From: Sewer56 Date: Thu, 10 Sep 2026 14:41:50 +0100 Subject: [PATCH] Fix cross-target toolchain setup --- .github/workflows/test-build-options.yml | 82 ++++++++++++++++++++++++ action.yml | 6 +- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-build-options.yml b/.github/workflows/test-build-options.yml index 8aea448..c2c6015 100644 --- a/.github/workflows/test-build-options.yml +++ b/.github/workflows/test-build-options.yml @@ -11,6 +11,88 @@ on: - ".github/workflows/test-build-options.yml" jobs: + test-target-matrix: + strategy: + fail-fast: false + matrix: + include: + - label: Linux x64 + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + rust-toolchain: nightly + use-cross: false + - label: Linux x86 + os: ubuntu-latest + target: i686-unknown-linux-gnu + rust-toolchain: nightly + use-cross: false + - label: Linux ARM64 + os: ubuntu-latest + target: aarch64-unknown-linux-gnu + rust-toolchain: nightly + use-cross: true + - label: Linux ARMv7 + os: ubuntu-latest + target: armv7-unknown-linux-gnueabihf + rust-toolchain: nightly + use-cross: true + - label: Windows x64 + os: windows-latest + target: x86_64-pc-windows-msvc + rust-toolchain: nightly + use-cross: false + - label: Windows x86 + os: windows-latest + target: i686-pc-windows-msvc + rust-toolchain: nightly + use-cross: false + - label: Windows x86 (pinned nightly) + os: windows-latest + target: i686-pc-windows-msvc + rust-toolchain: nightly-2025-09-11 + use-cross: false + - label: macOS Intel + os: macos-15-intel + target: x86_64-apple-darwin + rust-toolchain: nightly + use-cross: false + - label: macOS ARM64 + os: macos-latest + target: aarch64-apple-darwin + rust-toolchain: nightly + use-cross: false + - label: Big Endian 32-bit + os: ubuntu-latest + target: powerpc-unknown-linux-gnu + rust-toolchain: nightly + use-cross: true + - label: Big Endian 64-bit + os: ubuntu-latest + target: powerpc64-unknown-linux-gnu + rust-toolchain: nightly + use-cross: true + name: ${{ matrix.label }} + runs-on: ${{ matrix.os }} + steps: + - name: Checkout Action + uses: actions/checkout@v6 + + - name: Checkout Test Repository + uses: actions/checkout@v6 + with: + repository: Sewer56/prs-rs + ref: 149060527e685360687d7332742ac016b39af8a7 + path: test-project + + - name: Build Target + uses: ./ + with: + rust-project-path: test-project/tools/cli + rust-toolchain: ${{ matrix.rust-toolchain }} + target: ${{ matrix.target }} + use-cross: ${{ matrix.use-cross }} + upload-artifacts: false + test-build-without-native-host-tools: runs-on: ubuntu-latest steps: diff --git a/action.yml b/action.yml index 56334d0..138e34a 100644 --- a/action.yml +++ b/action.yml @@ -314,12 +314,10 @@ runs: shell: bash working-directory: ${{ env.WORKSPACE_PATH }} run: | + # Build with the selected host toolchain and the requested target. + # Not every target publishes a target-native compiler toolchain. rustup target add ${{ inputs.target }} --toolchain ${{ inputs.rust-toolchain }} rustup component add rust-src --toolchain ${{ inputs.rust-toolchain }} - if [ "${{ inputs.use-cross }}" != "true" ]; then - # Install native toolchain to build with, otherwise it's provided by cross. - rustup toolchain install ${{ inputs.rust-toolchain }}-${{ inputs.target }} --force-non-host - fi # Install cross-rs if needed if [ "${{ inputs.use-cross }}" == "true" ]; then