|
| 1 | +jobs: |
| 2 | + |
| 3 | +- job: check_diff |
| 4 | + pool: |
| 5 | + vmImage: 'Ubuntu-20.04' |
| 6 | + steps: |
| 7 | + - bash: | |
| 8 | + pip --version |
| 9 | + pip install -q -r requirements.txt |
| 10 | + pip list |
| 11 | + displayName: 'Install dependencies' |
| 12 | +
|
| 13 | + - script: | |
| 14 | + echo $PR_NUMBER |
| 15 | + CONFIGS=$(python _actions/assistant.py changed_configs $PR_NUMBER --as_list=False 2>&1) |
| 16 | + printf "Changed configs: $CONFIGS\n" |
| 17 | + echo "##vso[task.setvariable variable=diff;isOutput=true]$CONFIGS" |
| 18 | + name: files |
| 19 | + env: |
| 20 | + PR_NUMBER: "$(System.PullRequest.PullRequestNumber)" |
| 21 | + displayName: 'Config diff' |
| 22 | +
|
| 23 | +
|
| 24 | +- ${{ each config in parameters.configs }}: |
| 25 | + - job: |
| 26 | + displayName: ${{config}} |
| 27 | + dependsOn: check_diff |
| 28 | + variables: |
| 29 | + # map the output variable from A into this job |
| 30 | + configs: $[ dependencies.check_diff.outputs['files.diff'] ] |
| 31 | + config: "${{ config }}" |
| 32 | + |
| 33 | + condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), contains(variables['configs'], variables['config'])) |
| 34 | + # how long to run the job before automatically cancelling |
| 35 | + timeoutInMinutes: 75 |
| 36 | + # how much time to give 'run always even if cancelled tasks' before stopping them |
| 37 | + cancelTimeoutInMinutes: 2 |
| 38 | + |
| 39 | + pool: 'intel-hpus' |
| 40 | + # this need to have installed docker in the base image... |
| 41 | + container: |
| 42 | + image: "vault.habana.ai/gaudi-docker/1.8.0/ubuntu20.04/habanalabs/pytorch-installer-1.13.1:latest" |
| 43 | + options: "--runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host --shm-size=4g -v /usr/bin/docker:/tmp/docker:ro" |
| 44 | + workspace: |
| 45 | + clean: all |
| 46 | + |
| 47 | + steps: |
| 48 | + |
| 49 | + - script: | |
| 50 | + container_id=$(head -1 /proc/self/cgroup|cut -d/ -f3) |
| 51 | + /tmp/docker exec -t -u 0 $container_id \ |
| 52 | + sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo" |
| 53 | + echo "##vso[task.setvariable variable=CONTAINER_ID]$container_id" |
| 54 | + displayName: 'Install Sudo in container (thanks Microsoft!)' |
| 55 | +
|
| 56 | + - bash: | |
| 57 | + whoami && id |
| 58 | + sudo apt-get install -q -y hwinfo |
| 59 | + hwinfo --short |
| 60 | + python --version |
| 61 | + python --version |
| 62 | + pip --version |
| 63 | + pip list |
| 64 | + displayName: 'Image info & HW' |
| 65 | +
|
| 66 | + - bash: | |
| 67 | + sudo apt-get update -q --fix-missing |
| 68 | + sudo apt-get install -q -y --no-install-recommends build-essential gcc g++ cmake git unzip tree |
| 69 | + # Python's dependencies |
| 70 | + pip --version |
| 71 | + pip install -r requirements.txt |
| 72 | + pip list |
| 73 | + displayName: 'Install dependencies' |
| 74 | +
|
| 75 | + #- bash: | |
| 76 | + # echo $CONTAINER_ID |
| 77 | + # displayName: 'Sanity check' |
| 78 | + |
| 79 | + - bash: | |
| 80 | + python _actions/assistant.py prepare_env --config_file=${{config}} > prepare_env.sh |
| 81 | + cat prepare_env.sh |
| 82 | + displayName: 'Create scripts' |
| 83 | +
|
| 84 | + - bash: | |
| 85 | + bash prepare_env.sh |
| 86 | + # pip list |
| 87 | + tree . |
| 88 | + displayName: 'Prepare env.' |
| 89 | +
|
| 90 | + - script: | |
| 91 | + ENVS=$(python _actions/assistant.py list_env --config_file=${{config}} --export 2>&1) |
| 92 | + printf "PyTest env. variables: $ENVS\n" |
| 93 | + echo "##vso[task.setvariable variable=envs;isOutput=true]$ENVS" |
| 94 | + ARGS=$(python _actions/assistant.py specify_tests --config_file=${{config}} 2>&1) |
| 95 | + printf "PyTest arguments: $ARGS\n" |
| 96 | + echo "##vso[task.setvariable variable=args;isOutput=true]$ARGS" |
| 97 | + name: testing |
| 98 | + displayName: 'testing specs' |
| 99 | +
|
| 100 | + - bash: | |
| 101 | + $(testing.envs) |
| 102 | + python -m pytest $(testing.args) -v |
| 103 | + workingDirectory: _integrations |
| 104 | + displayName: 'Integration tests' |
| 105 | +
|
| 106 | + # ToDo: add Slack notification |
0 commit comments