environment:
  global:
    PROJECT_NAME: rust-derivative
  matrix:
    # Prioritize 64-bit builds over 32-bit to get clippy checks sooner
    - TARGET: x86_64-pc-windows-msvc
    - TARGET: x86_64-pc-windows-gnu
      MSYS2_BITS: 64
    - TARGET: i686-pc-windows-msvc
    - TARGET: i686-pc-windows-gnu
      MSYS2_BITS: 32

configuration:
  - 1.34.0  # Minimum supported version
  - stable
  - nightly
  - beta

install:
  - curl -sSf -o rustup-init.exe https://win.rustup.rs/
  - rustup-init.exe -y --default-host %TARGET% --default-toolchain %CONFIGURATION%
  # Some toolchains don't ship clippy, so handle this case to not break the build
  - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin;C:\Users\appveyor\.rustup\toolchains\%CONFIGURATION%-%TARGET%\bin
  - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin
  # Only install `clippy` for 64-bit targets; for reasoning see
  # <https://github.com/rust-lang-nursery/rust-clippy/issues/3202#issuecomment-431641932>
  - if not "x%TARGET:x86_64=%" == "x%TARGET%" rustup component add clippy-preview && set HAS_CLIPPY=y || cd .
  - rustc -V
  - cargo -V
  - if defined HAS_CLIPPY cargo clippy -V

build: false

test_script:
  - cargo build --verbose
  - cargo test --verbose
  - cargo clean
  - cargo test --verbose --features=use_core
  - if defined HAS_CLIPPY cargo clippy --verbose --features=use_core

  - if "%CONFIGURATION%" == "nightly" cargo update -Z minimal-versions
  - if "%CONFIGURATION%" == "nightly" cargo build --verbose
  - if "%CONFIGURATION%" == "nightly" cargo test --verbose
  - if "%CONFIGURATION%" == "nightly" cargo test --verbose --features=use_core
