forked from QCoDeS/Qcodes_contrib_drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
147 lines (143 loc) · 7.36 KB
/
azure-pipelines.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: "QCoDeS_driver_contrib CI"
# A note on activating conda environments
# At the time of writing the prefered way to activate conda envs (conda 4.6.x)
# is to use conda activate env, and source activate is deprecated. However, this
# requires the user to run conda init which will configure a startup hook for the relevant terminal
# However, azure pipelines does (at the time of writing may 2019) not execute the hook scrips in cmd.exe or bash
# To work around this we use standard source activate qcodes in bash and run the hook manually in cmd.exe
# The hook needs to be rerun for each step.
# We could also run the hooks for bash steps but there is no obvious way to do that in a platform independent way.
trigger:
branches:
include:
- master
tags:
include:
- 'v*'
pr:
branches:
include:
- '*' # workaround for missing trigger. Should be same as default
jobs:
- job: "run_the_tests"
strategy:
matrix:
linux:
imageName: 'ubuntu-16.04'
windows:
imageName: 'vs2017-win2016'
pool:
vmImage: $(imageName)
steps:
- task: InstallSSHKey@0
inputs:
knownHostsEntry: "github.com,140.82.118.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
sshPublicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOAEmvxbkJCjIZWYQFXl2CSmNkrmFt6D3gu8UUxeii8+7+las+cNA2aQl0A55tiF2zamD68Qgm/aasUP6wPjuDpf81SWGqNAqrmP1hwU9Jgu6wYQPiZ96TQArLtYpwDoiFxGDh8uEduoWxSvTYvq3Ox+YrU29F/o3tQbdRumO80GTZK4SFa2/y33uYOT7DWSf/eOQgW+zRESmlKUYzXmHzDe4iFa9WmZYAdp4hOQlAjZrexK3vuetObooxpz4kU6bsE66ALetPzXo/Sb1ZomYEMbZkn4aLeemP/UkXipPKO7nAWn+WBCpOYZl4jn3SK8jyq7+f90yWreKFEnjD1CRkB51UNq9H/ggRXCtXHGMXR52lpoRuugin/BMLcwS4A60F3fmbZ7ax3Hus/eqZlunOJZv5OvXdUG6vb/KvyD24H+FUmDZhJMl2CZNe0nTayRwfoMBSGCw75Cas1zJs5j1ex4ZqgmY+9ZYjqQ00jFzMUA94sUhrJniLS5K/aBqiab5yaH+IQ1IlQznauoHApEGhcTrtiQexrQ31uRgNqGnLj4MJ86BIdoaSsirTrD4IbB11EmBkDd/Z4A8yJxS5gTy8scDMmziveFCFycQFrIiCHdVpdf/nvs528I2giPcRZyv2e8E/eR2LVnUzo1SOWLINFhXA7oDLLL/pUICpETXSBQ== [email protected]"
sshKeySecureFile: 'qcodes_contrib_ghpages'
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: "Add conda to PATH on Windows"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
displayName: "Add conda to PATH on Linux"
condition: eq( variables['Agent.OS'], 'Linux' )
- script: |
conda install conda=4.6 -n base -y
conda init --all
displayName: "Conda setup on Windows"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- bash: |
sudo conda update -n base conda -y
sudo conda init bash
displayName: "Conda setup on Linux"
condition: eq( variables['Agent.OS'], 'Linux' )
- bash: |
conda --version
curl https://raw.githubusercontent.com/QCoDeS/Qcodes/master/environment.yml > environment.yml
curl https://raw.githubusercontent.com/QCoDeS/Qcodes/master/test_requirements.txt > test_requirements.txt
curl https://raw.githubusercontent.com/QCoDeS/Qcodes/master/docs_requirements.txt > docs_requirements.txt
conda env create --file environment.yml
source activate qcodes
pip install -r test_requirements.txt
pip install -r docs_requirements.txt
pip install -e .
pip install twine
displayName: "Install environment, qcodes"
- bash: |
source activate qcodes
mypy qcodes_contrib_drivers
displayName: "mypy"
- script: |
CALL C:\Miniconda\condabin\conda_hook.bat
CALL conda activate qcodes
cd qcodes_contrib_drivers
pytest --junitxml=test-results.xml --cov=qcodes --cov-report=xml --cov-report=html --cov-config=.coveragerc
displayName: "Pytest on Windows"
condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Windows_NT' ))
- bash: |
source activate qcodes
cd qcodes_contrib_drivers
xvfb-run --server-args="-screen 0 1024x768x24" pytest --junitxml=test-results.xml --cov=qcodes --cov-report=xml --cov-report=html --cov-config=.coveragerc
displayName: "Pytest on Linux"
condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Linux' ))
- task: PublishTestResults@2
displayName: "Publish test results"
condition: succeededOrFailed()
inputs:
testResultsFiles: 'qcodes_contrib_drivers/test-*.xml'
testRunTitle: 'Publish test results'
- task: PublishCodeCoverageResults@1
displayName: "Publish code coverage results"
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/qcodes_contrib_drivers/coverage.xml'
- script: |
CALL C:\Miniconda\condabin\conda_hook.bat
CALL conda activate qcodes
cd docs
REM Turn warnings into errors
set SPHINXOPTS=-W -v
make.bat html
displayName: "Build docs on Windows"
condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Windows_NT' ))
- script: |
source activate qcodes
cd docs
export SPHINXOPTS=-W -v
xvfb-run --server-args="-screen 0 1024x768x24" make html
displayName: "Build docs on Linux"
condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Linux' ))
- task: PublishBuildArtifacts@1
displayName: "Publish build docs to Azure DevOps"
condition: succeededOrFailed()
inputs:
pathtoPublish: 'docs/_build/html'
artifactName: 'qcodes_docs'
publishLocation: 'Container'
- script: |
cd ..
git config --global user.email "bot"
git config --global user.name "Documentation Bot"
git clone --single-branch --branch gh-pages [email protected]:QCoDeS/Qcodes_contrib_drivers.git gh-pages-dir
cd gh-pages-dir &&
rm -rf ./*
cp $(Build.Repository.LocalPath)/docs/_build/html/. . -R
git add -A
git commit -m "Docs build of $(Build.SourceVersion)"
git push
displayName: "Publish docs to gh-pages"
condition: and(succeeded(), eq( variables['Agent.OS'], 'Linux' ), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.Reason'], 'IndividualCI'))
- task: TwineAuthenticate@1
inputs:
pythonUploadServiceConnection: qcodes_contrib_drivers_upload
- script: |
source activate qcodes
python setup.py bdist_wheel
python setup.py sdist
condition: and(succeeded(), eq( variables['Agent.OS'], 'Linux' ))
displayName: "Build dist artifacts"
- script: |
source activate qcodes
twine upload -r "pypi" --config-file $(PYPIRC_PATH) dist/*
condition: and(succeeded(), eq( variables['Agent.OS'], 'Linux' ), contains(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: "Upload tagged release to PyPi"