# This template creates one job per channel-target.
parameters:
  # The default rust channels to use ('stable', 'beta' and/or 'nightly').
  # This can also be overriden for each target.
  channels: [stable]
  # The target triples to use (e.g 'i686-apple-darwin')
  targets: []

jobs:
- ${{ each target in parameters.targets }}:
  - ${{ if target.channels }}:
    - ${{ each channel in target.channels }}:
      - template: cargo-job.yml
        parameters:
          identifier: ${{ format('rust_{0}_{1}', channel, replace(target.target, '-', '_')) }}
          channel: ${{ channel }}
          ${{ insert }}: ${{ target }}

  - ${{ if not(target.channels) }}:
    - ${{ each channel in parameters.channels }}:
      - template: cargo-job.yml
        parameters:
          identifier: ${{ format('rust_{0}_{1}', channel, replace(target.target, '-', '_')) }}
          channel: ${{ channel }}
          ${{ insert }}: ${{ target }}
