steps:
- checkout: self
  fetchDepth: 1

- template: azure-install-rust.yml

- bash: rustup target add $OTHER_TARGET
  displayName: "Install cross-compile target"

- bash: sudo apt install gcc-multilib
  displayName: "Install gcc-multilib (linux)"
  condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))

# Some tests rely on a clippy command to run, so let's try to install clippy to
# we can be sure to run those tests.
- bash: rustup component add clippy || echo "clippy not available"
  displayName: "Install clippy (maybe)"

# This is needed for standard library tests.
- bash: |
    if [ "$TOOLCHAIN" = "nightly" ]; then
      rustup component add rust-src
    fi
  displayName: "Install rust-src (maybe)"

# Deny warnings on CI to avoid warnings getting into the codebase, and note the
# `force-system-lib-on-osx` which is intended to fix compile issues on OSX where
# compiling curl from source on OSX yields linker errors on Azure.
#
# Note that the curl issue is traced back to alexcrichton/curl-rust#279 where it
# looks like the OSX version we're actually running on is such that a symbol is
# emitted that's never worked. For now force the system library to be used to
# fix the link errors.
- bash: cargo test --features 'deny-warnings curl/force-system-lib-on-osx'
  displayName: "cargo test"

steps:
- checkout: self
  fetchDepth: 1

- template: azure-install-rust.yml

- bash: rustup target add $OTHER_TARGET
  displayName: "Install cross-compile target"

- bash: sudo apt install gcc-multilib
  displayName: "Install gcc-multilib (linux)"
  condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))

# Some tests rely on a clippy command to run, so let's try to install clippy to
# we can be sure to run those tests.
- bash: rustup component add clippy || echo "clippy not available"
  displayName: "Install clippy (maybe)"

# This is needed for standard library tests.
- bash: rustup component add rust-src
  condition: and(succeeded(), eq(variables['TOOLCHAIN'], 'nightly'))
  displayName: "Install rust-src (maybe)"

# Deny warnings on CI to avoid warnings getting into the codebase, and note the
# `force-system-lib-on-osx` which is intended to fix compile issues on OSX where
# compiling curl from source on OSX yields linker errors on Azure.
#
# Note that the curl issue is traced back to alexcrichton/curl-rust#279 where it
# looks like the OSX version we're actually running on is such that a symbol is
# emitted that's never worked. For now force the system library to be used to
# fix the link errors.
- bash: cargo test --features 'deny-warnings curl/force-system-lib-on-osx'
  displayName: "cargo test"

Use azure condition for rust-src.
Use azure condition for rust-src.
