'How to setup default rust compilation target on CI using rustup command on github actions?
I need to compile my code for both 32 and 64 bit windows. As far as I understand, I basically need to configure my CI so that this command:
rustup default
prints
stable-i686-pc-windows-msvc (default)
(i build a lot of stuff in one run, including a tauri
app, and they all need to detect that as the compilation target)
this didn't work (it still prints x86_64
on both runs)
jobs:
publish-tauri:
strategy:
fail-fast: true
matrix:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: windows-latest
target: i686-pc-windows-msvc
runs-on: ${{ matrix.settings.host }}
steps:
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
default: true
toolchain: stable
target: ${{ matrix.settings.target }}
- name: REALLY set default target # based on https://rust-lang.github.io/rustup/installation/windows.html
run: rustup set default-host ${{ matrix.settings.target }}
Solution 1:[1]
Would providing build matrix data as arrays work? Like:
jobs:
publish-tauri:
strategy:
fail-fast: true
matrix:
toolchain: [stable]
os: [windows-latest]
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc]
runs-on: ${{ matrix.os }}
steps:
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
default: true
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mika Vatanen |