trigger:
  - master

jobs:
  - job: Docker
    pool:
      vmImage: ubuntu-16.04
    steps:
      - template: ci/azure-install-rust.yml
      - bash: rustup target add $TARGET
        displayName: "add cross target"
      - bash: rustup target add x86_64-unknown-linux-musl
        displayName: "add musl target"
      - bash: cargo generate-lockfile && ./ci/run-docker.sh $TARGET
        displayName: "run tests"
    strategy:
      matrix:
        aarch64:
          TARGET: aarch64-unknown-linux-gnu
        arm:
          TARGET: arm-unknown-linux-gnueabi
        armhf:
          TARGET: arm-unknown-linux-gnueabihf
        armv7:
          TARGET: armv7-unknown-linux-gnueabihf
        i686:
          TARGET: i686-unknown-linux-gnu
        mips:
          TARGET: mips-unknown-linux-gnu
        mips64:
          TARGET: mips64-unknown-linux-gnuabi64
        mips64el:
          TARGET: mips64el-unknown-linux-gnuabi64
        powerpc:
          TARGET: powerpc-unknown-linux-gnu
        powerpc64:
          TARGET: powerpc64-unknown-linux-gnu
        powerpc64le:
          TARGET: powerpc64le-unknown-linux-gnu
        x86_64:
          TARGET: x86_64-unknown-linux-gnu

  - job: wasm
    pool:
      vmImage: ubuntu-16.04
    steps:
      - template: ci/azure-install-rust.yml
      - script: rustup target add wasm32-unknown-unknown
        displayName: "Install rust wasm target"
      - script: cargo build --target wasm32-unknown-unknown
        displayName: "Build for wasm"
      - script: cargo build --target wasm32-unknown-unknown --no-default-features
        displayName: "Build for wasm (no default features)"
    variables:
      TOOLCHAIN: nightly

  - job: rustfmt
    pool:
      vmImage: ubuntu-16.04
    steps:
      - template: ci/azure-install-rust.yml
      - bash: rustup component add rustfmt
        displayName: "install rustfmt"
      - bash: cargo fmt --all -- --check
        displayName: "check formatting"

  - job: compiler_builtins_works
    pool:
      vmImage: ubuntu-16.04
    steps:
      - template: ci/azure-install-rust.yml
      - bash: cargo build -p cb
        displayName: "Check compiler-builtins still probably builds"
