steps:

- task: DownloadPipelineArtifact@2
  inputs:
    source: current
    artifact: artifact_SourceDistribution
    path: dist

- script: |
    sudo apt-get update
    sudo apt-get install -y qemu qemu-user-static qemu-user binfmt-support
    sudo docker run --rm --privileged hypriot/qemu-register
  condition: and(succeeded(), eq(variables['arch'], 'aarch64'))
  displayName: 'Install QEMU'

- script: |
    ls -l
    ls -l dist
  displayName: Sanity check 

- script: |
    set -ex
    docker run -e PLAT=$(plat) -e package_name=$(package_name) --rm -v `pwd`:/io $(image) /io/.azure/scripts/build-wheels.sh
  displayName: Build wheels

- script: |
    ls -lh wheelhouse/
    rm dist/*
    cp wheelhouse/$(package_name)*.whl dist/.
  displayName: Copy wheels
