1
1
name : " QCoDeS CI"
2
2
3
+ # A note on activating conda environments
4
+ # At the time of writing the prefered way to activate conda envs (conda 4.6.x)
5
+ # is to use conda activate env, and source activate is deprecated. However, this
6
+ # requires the user to run conda init which will configure a startup hook for the relevant terminal
7
+ # However, azure pipelines does (at the time of writing may 2019) not execute the hook scrips in cmd.exe or bash
8
+ # To work around this we use standard source activate qcodes in bash and run the hook manually in cmd.exe
9
+ # The hook needs to be rerun for each step.
10
+ # We could also run the hooks for bash steps but there is no obvious way to do that in a platform independent way.
11
+
3
12
trigger :
4
13
branches :
5
14
include :
6
15
- master
7
16
8
17
jobs :
9
18
- job : " run_the_tests"
19
+ strategy :
20
+ matrix :
21
+ linux :
22
+ imageName : ' ubuntu-16.04'
23
+ windows :
24
+ imageName : ' vs2017-win2016'
10
25
pool :
11
- vmImage : " vs2017-win2016 "
26
+ vmImage : $(imageName)
12
27
13
28
steps :
14
29
- powershell : Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
15
- displayName : " Add conda to PATH"
16
- - script : |
17
- conda update -n base conda
18
- conda init cmd.exe powershell
19
- displayName: "Conda setup"
30
+ displayName : " Add conda to PATH on Windows "
31
+ condition : eq( variables['Agent.OS'], 'Windows_NT' )
32
+ - bash : echo "##vso[task.prependpath]/usr/share/miniconda/bin"
33
+ displayName : " Add conda to PATH on Linux "
34
+ condition : eq( variables['Agent.OS'], 'Linux' )
20
35
- script : |
21
- CALL C:\Miniconda\condabin\conda_hook.bat
22
- CALL conda --version
23
- CALL conda env create --file environment.yml
24
- CALL conda activate qcodes
36
+ conda update -n base conda -y
37
+ conda init --all
38
+ displayName: "Conda setup on Windows"
39
+ condition: eq( variables['Agent.OS'], 'Windows_NT' )
40
+ - bash : |
41
+ sudo conda update -n base conda -y
42
+ sudo conda init bash
43
+ displayName: "Conda setup on Linux"
44
+ condition: eq( variables['Agent.OS'], 'Linux' )
45
+ - bash : |
46
+ conda --version
47
+ conda env create --file environment.yml
48
+ source activate qcodes
25
49
pip install -r test_requirements.txt
26
50
pip install -r docs_requirements.txt
27
51
pip install -e .
28
52
displayName: "Install environment, qcodes"
29
- - script : |
30
- CALL C:\Miniconda\condabin\conda_hook.bat
31
- CALL conda activate qcodes
53
+ - bash : |
54
+ source activate qcodes
32
55
mypy qcodes
33
56
displayName: "mypy"
34
- - script : |
35
- CALL C:\Miniconda\condabin\conda_hook.bat
36
- CALL conda activate qcodes
57
+ - bash : |
58
+ source activate qcodes
37
59
cd ..
38
60
git clone https://github.com/QCoDeS/qcodes_generate_test_db.git
39
61
cd qcodes_generate_test_db
@@ -50,29 +72,42 @@ jobs:
50
72
CALL conda activate qcodes
51
73
cd qcodes
52
74
pytest --junitxml=test-results.xml --cov=qcodes --cov-report=xml --cov-report=html --cov-config=.coveragerc
53
- displayName: "Run pytest"
54
- condition: succeededOrFailed()
75
+ displayName: "Pytest on Windows"
76
+ condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Windows_NT' ))
77
+ - bash : |
78
+ source activate qcodes
79
+ cd qcodes
80
+ xvfb-run --server-args="-screen 0 1024x768x24" pytest --junitxml=test-results.xml --cov=qcodes --cov-report=xml --cov-report=html --cov-config=.coveragerc
81
+ displayName: "Pytest on Linux"
82
+ condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Linux' ))
55
83
- task : PublishTestResults@1
56
84
displayName : " Publish test results"
57
85
condition : succeededOrFailed()
58
86
inputs :
59
- testResultsFiles : ' qcodes\ test-*.xml'
87
+ testResultsFiles : ' qcodes/ test-*.xml'
60
88
testRunTitle : ' Publish test results'
61
89
- task : PublishCodeCoverageResults@1
62
90
displayName : " Publish code coverage results"
63
91
condition : succeededOrFailed()
64
92
inputs :
65
93
codeCoverageTool : Cobertura
66
- summaryFileLocation : ' $(System.DefaultWorkingDirectory)\ qcodes\ coverage.xml'
94
+ summaryFileLocation : ' $(System.DefaultWorkingDirectory)/ qcodes/ coverage.xml'
67
95
- script : |
68
96
CALL C:\Miniconda\condabin\conda_hook.bat
69
97
CALL conda activate qcodes
70
98
cd docs
71
99
REM Turn warnings into errors
72
100
set SPHINXOPTS=-W -v
73
101
make.bat htmlapi
74
- displayName: "Build docs"
75
- condition: succeededOrFailed()
102
+ displayName: "Build docs on Windows"
103
+ condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Windows_NT' ))
104
+ - script : |
105
+ source activate qcodes
106
+ cd docs
107
+ export SPHINXOPTS=-W -v
108
+ xvfb-run --server-args="-screen 0 1024x768x24" make htmlapi
109
+ displayName: "Build docs on Linux"
110
+ condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Linux' ))
76
111
- task : PublishBuildArtifacts@1
77
112
displayName : " Publish build docs to Azure DevOps"
78
113
condition : succeededOrFailed()
0 commit comments