actions-rust-lang / setup-rust-toolchain

Setup a specific Rust toolchain with extra features like problem matchers
MIT License
180 stars 32 forks source link

Version 1.4.0 fails on mac os with error 'conditional binary operator expected' #9

Closed GeorgeHahn closed 1 year ago

GeorgeHahn commented 1 year ago

The changes released in version 1.4.0 throw an error on mac os runners.

Here's the relevant part of the Action log:

Run if [[ ! -v CARGO_INCREMENTAL ]]; then
  if [[ ! -v CARGO_INCREMENTAL ]]; then
    echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
  fi
  if [[ ! -v CARGO_PROFILE_DEV_DEBUG ]]; then
    echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
  fi
  if [[ ! -v CARGO_TERM_COLOR ]]; then
    echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
  fi
  if [[ ! -v RUST_BACKTRACE ]]; then
    echo "RUST_BACKTRACE=short" >> $GITHUB_ENV
  fi
  if [[ ! -v RUSTFLAGS ]]; then
    echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV
  fi
  # Enable faster sparse index on nightly
  # The value is ignored on stable and causes no problems
  # https://internals.rust-lang.org/t/call-for-testing-cargo-sparse-registry/16862
  if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then
    echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
  fi
  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
/Users/runner/work/_temp/<guid>.sh: line 1: conditional binary operator expected
Error: Process completed with exit code 2.

(from this CI run)

jonasbb commented 1 year ago

Hi, thanks for reporting the issue and sorry for breaking your CI. Right now I think that could be because of an ancient version of bash on the macOS images. Unfortunately, I don't have any macOS knowledge. I think using brew I can change the bash version.

GeorgeHahn commented 1 year ago

No worries at all! I can look into this sometime in the next week or so if that would be helpful. For the moment, I've pinned the affected project's CI to an older version of the action.

jonasbb commented 1 year ago

I just pushed v1.4.1 with a fix. I also extended the CI to run on Windows and macOS, such that this problem hopefully doesn't appear anymore. The PR is #10.