forked from slaclab/pydm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-test-template.yml
112 lines (94 loc) · 3.59 KB
/
azure-test-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Azure Pipelines CI job template for PyDM Tests
parameters:
name: ''
vmImage: ''
python: ''
allowFailure: false
jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
variables:
python: ${{ parameters.python }}
continueOnError: ${{ parameters.allowFailure }}
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: 'MacOS - Add conda to PATH'
condition: eq(variables['agent.os'], 'Darwin' )
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: 'Linux - Add conda to PATH'
condition: eq(variables['agent.os'], 'Linux' )
# Linux
- bash: |
# Install & Start Windows Manager for Linux
sudo apt-get install -y xvfb herbstluftwm
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
sleep 3
# Fix Anaconda permissions
sudo install -d -m 0777 /usr/share/miniconda/
sudo install -d -m 0777 /usr/share/miniconda/envs
displayName: 'Linux - Prepare OS'
condition: eq(variables['agent.os'], 'Linux' )
# Linux
- bash: |
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_herbstluftwm_99.pid --make-pidfile --background --exec /usr/bin/herbstluftwm
sleep 1
env:
DISPLAY: :99.0
displayName: 'Linux - Start herbstluftwm'
condition: eq(variables['agent.os'], 'Linux' )
# MacOS
- bash: |
# Fix Anaconda permissions
sudo chown -R $USER $CONDA
displayName: 'MacOS - Prepare OS'
condition: eq(variables['agent.os'], 'Darwin' )
- bash: |
conda config --set always_yes yes
conda config --set channel_priority strict
conda config --set show_channel_urls yes
conda config --add channels conda-forge
displayName: 'Anaconda - Configure'
- bash: |
conda create --name test-environment-$(python) python=$(python)
displayName: 'Anaconda - Create'
- bash: |
conda config --add channels 'file:///$(Build.Repository.LocalPath)/anaconda_package'
displayName: 'Anaconda - Configure - Add local bld-dir'
- bash: |
conda info
conda info --envs
conda config --show channels
displayName: Debug
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
artifactName: 'anaconda_package'
downloadPath: $(Build.Repository.LocalPath)/
displayName: Artifact Download - Anaconda Packages
- bash: |
source activate test-environment-$(python)
conda install python=$(python) pytest-azurepipelines pydm --file dev-requirements.txt
displayName: 'Anaconda - Install Dependencies'
- bash: |
source activate test-environment-$(python)
# debug of conda environment
conda info
conda list
echo python location: `which python`
echo pytest location: `which pytest`
python -c "from PyQt5 import QtCore; print(QtCore)"
displayName: 'Debug - Conda List'
continueOnError: false
- bash: |
source activate test-environment-$(python)
python run_tests.py --timeout 30 --show-cov --test-run-title="Tests for $(Agent.OS) - Python $(python)" --napoleon-docstrings
displayName: 'Tests - Run'
continueOnError: false
env:
DISPLAY: :99.0
- bash: |
source activate test-environmnet-$(python)
bash <(curl -s https://codecov.io/bash)
displayName: 'Codecov - Upload'
continueOnError: true