setup-rust-toolchain
setup-rust-toolchain copied to clipboard
Failing with "bash: command not found" on self-hosted Windows runner
I'm building a Tauri app on a self-hosted Windows runner. Here's the relevant bit of the action yaml:
name: 'publish'
on:
push:
branches:
- release
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # for Arm and Intel based macs
args: '--target universal-apple-darwin'
- platform: 'windows-latest'
args: ''
#- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
# args: ''
runs-on: [self-hosted, "${{ matrix.platform }}"]
steps:
- uses: actions/checkout@v4
# ... sets up node and stuff here ...
- name: install Rust stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
The output from the action looks like:
Warning: Unexpected input(s) 'targets', valid inputs are ['toolchain', 'target', 'components', 'cache', 'cache-workspaces', 'cache-directories', 'cache-on-failure', 'cache-key', 'matcher', 'rustflags', 'override']
Run actions-rust-lang/setup-rust-toolchain@v1
with:
cache: true
cache-on-failure: true
matcher: true
rustflags: -D warnings
override: true
env:
PNPM_HOME: C:\Windows\ServiceProfiles\NetworkService\setup-pnpm\node_modules\.bin
Run : construct rustup command line
: construct rustup command line
echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT
echo "downgrade=" >> $GITHUB_OUTPUT
Error: bash: command not found
It looks like this repo's action.yml
handles Windows in a couple spots but maybe not all, and I think the Github-hosted runners do actually have bash installed so this works fine there.
I'd also be fine with adding a step to install bash if that seems better, though the answer here makes that sound like it might not be the right path.