parameters:
  name: ''
  vmImage: ''
  toolchain: 'stable'
  features: 'all'

jobs:
- job: ${{ parameters.name }}
  pool:
    vmImage: ${{ parameters.vmImage }}
  variables:
    tc: ${{ parameters.toolchain }}
    os: ${{ parameters.vmImage }}
    features: ${{ parameters.features }}
  steps:
  - bash: |
      if [[ "$OS" == "xcode9-macos10.13" ]]; then
        HOMEBREW_NO_AUTO_UPDATE=1 brew install automake autoconf libtool libsodium pkg-config
      fi
      if [[ "$OS" == "ubuntu-16.04" ]]; then
        sudo apt-get install -y --allow-downgrades libsodium-dev libssl-dev=1.0.2g-1ubuntu4.14
      fi
    displayName: 'Install dependencies'

  - bash: |
      curl -o rustup-init.sh https://sh.rustup.rs -sSf
      sh rustup-init.sh --default-toolchain $(tc) -y
    displayName: 'Install Rust'

  - bash: |
      source $HOME/.cargo/env
      if [[ "$(features)" == "all" ]]; then
        cargo build --all-features
      else
        cargo build --no-default-features --features "$(features)"
      fi
    displayName: 'Build Serenity'

  - bash: |
      source $HOME/.cargo/env
      if [[ "$(features)" == "all" ]]; then
        cargo test --all-features
      else
        cargo test --no-default-features --features "$(features)"
      fi
    displayName: 'Test Serenity'

parameters:
  name: ''
  vmImage: ''
  toolchain: 'stable'
  features: 'all'

jobs:
- job: ${{ parameters.name }}
  pool:
    vmImage: ${{ parameters.vmImage }}
  variables:
    tc: ${{ parameters.toolchain }}
    os: ${{ parameters.vmImage }}
    features: ${{ parameters.features }}
  steps:
  - bash: |
      if [[ "$OS" == "xcode9-macos10.13" ]]; then
        HOMEBREW_NO_AUTO_UPDATE=1 brew install automake autoconf libtool libsodium pkg-config
      fi
      if [[ "$OS" == "ubuntu-16.04" ]]; then
        sudo apt-get install -y --allow-downgrades libsodium-dev libssl-dev=1.0.2g-1ubuntu4.15
      fi
    displayName: 'Install dependencies'

  - bash: |
      curl -o rustup-init.sh https://sh.rustup.rs -sSf
      sh rustup-init.sh --default-toolchain $(tc) -y
    displayName: 'Install Rust'

  - bash: |
      source $HOME/.cargo/env
      if [[ "$(features)" == "all" ]]; then
        cargo build --all-features
      else
        cargo build --no-default-features --features "$(features)"
      fi
    displayName: 'Build Serenity'

  - bash: |
      source $HOME/.cargo/env
      if [[ "$(features)" == "all" ]]; then
        cargo test --all-features
      else
        cargo test --no-default-features --features "$(features)"
      fi
    displayName: 'Test Serenity'

Increment minor version to fix a linux dependency
Increment minor version to fix a linux dependency
