# Based on the "trust" template - https://github.com/japaric/trust/tree/v0.1.1

environment:
  global:
    RUST_VERSION: stable
    CRATE_NAME: nt_version

  matrix:
    - TARGET: i686-pc-windows-msvc
      RUST_VERSION: stable
    - TARGET: x86_64-pc-windows-msvc
      RUST_VERSION: stable
    - TARGET: i686-pc-windows-msvc
      RUST_VERSION: nightly
    - TARGET: x86_64-pc-windows-msvc
      RUST_VERSION: nightly

install:
  # For some fucking reason appveyor only has ntdll.lib on x86_64!
  # On the other hand, this gives us a great chance to test fallback on/off.
  - ps: >-
      If ($Env:TARGET -eq 'i686-pc-windows-msvc') {
        $Env:FEATURES = '--features fallback'
      } ElseIf ($Env:TARGET -eq 'x86_64-pc-windows-msvc') {
        $Env:FEATURES = '';
      }
  - curl -sSf -o rustup-init.exe https://win.rustup.rs/
  - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
  - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
  - rustc -Vv
  - cargo -V

test_script:
  - cargo build --target %TARGET% %FEATURES% &&
      cargo build --target %TARGET% %FEATURES% --release &&
      cargo test --target %TARGET% %FEATURES% -- --nocapture &&
      cargo test --target %TARGET% %FEATURES% --release -- --nocapture

cache:
  - C:\Users\appveyor\.cargo\registry
  - target

branches:
  only:
    - /^v\d+\.\d+\.\d+.*$/
    - /^appveyor-.*$/
    - master

notifications:
  - provider: Email
    on_build_success: false

# Already done in the test phase
build: false
