Skip to content

Commit 5521d9e

Browse files
authored
Merge pull request #1487 from jenshnielsen/ci/azure_multi_platform
Add linux to azure builds
2 parents f2704ad + 242b995 commit 5521d9e

File tree

1 file changed

+57
-22
lines changed

1 file changed

+57
-22
lines changed

azure-pipelines.yml

+57-22
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,61 @@
11
name: "QCoDeS CI"
22

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+
312
trigger:
413
branches:
514
include:
615
- master
716

817
jobs:
918
- job: "run_the_tests"
19+
strategy:
20+
matrix:
21+
linux:
22+
imageName: 'ubuntu-16.04'
23+
windows:
24+
imageName: 'vs2017-win2016'
1025
pool:
11-
vmImage: "vs2017-win2016"
26+
vmImage: $(imageName)
1227

1328
steps:
1429
- 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' )
2035
- 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
2549
pip install -r test_requirements.txt
2650
pip install -r docs_requirements.txt
2751
pip install -e .
2852
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
3255
mypy qcodes
3356
displayName: "mypy"
34-
- script: |
35-
CALL C:\Miniconda\condabin\conda_hook.bat
36-
CALL conda activate qcodes
57+
- bash: |
58+
source activate qcodes
3759
cd ..
3860
git clone https://github.com/QCoDeS/qcodes_generate_test_db.git
3961
cd qcodes_generate_test_db
@@ -50,29 +72,42 @@ jobs:
5072
CALL conda activate qcodes
5173
cd qcodes
5274
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' ))
5583
- task: PublishTestResults@1
5684
displayName: "Publish test results"
5785
condition: succeededOrFailed()
5886
inputs:
59-
testResultsFiles: 'qcodes\test-*.xml'
87+
testResultsFiles: 'qcodes/test-*.xml'
6088
testRunTitle: 'Publish test results'
6189
- task: PublishCodeCoverageResults@1
6290
displayName: "Publish code coverage results"
6391
condition: succeededOrFailed()
6492
inputs:
6593
codeCoverageTool: Cobertura
66-
summaryFileLocation: '$(System.DefaultWorkingDirectory)\qcodes\coverage.xml'
94+
summaryFileLocation: '$(System.DefaultWorkingDirectory)/qcodes/coverage.xml'
6795
- script: |
6896
CALL C:\Miniconda\condabin\conda_hook.bat
6997
CALL conda activate qcodes
7098
cd docs
7199
REM Turn warnings into errors
72100
set SPHINXOPTS=-W -v
73101
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' ))
76111
- task: PublishBuildArtifacts@1
77112
displayName: "Publish build docs to Azure DevOps"
78113
condition: succeededOrFailed()

0 commit comments

Comments
 (0)