forked from calliope-project/calliope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.azure-pipelines.yml
169 lines (149 loc) · 5.46 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
trigger:
branches:
include:
- "main"
- "0.6"
paths:
exclude:
- ".gitattributes"
- ".github"
- ".gitignore"
- ".hound.yml"
- ".pre-commit-config.yaml"
- ".readthedocs.yml"
- "AUTHORS"
- "CITATION"
- "LICENSE"
- "Makefile"
- "changelog.rst"
- "doc"
- "paper"
- "requirements_docs.yml"
- "*.md"
pr:
autoCancel: true # new PR commits will cancel current pipeline jobs in favour of latest commit
branches:
include:
- "main"
- "0.6"
paths:
exclude:
- ".gitattributes"
- ".github/*"
- ".gitignore"
- ".hound.yml"
- ".pre-commit-config.yaml"
- ".readthedocs.yml"
- "AUTHORS"
- "CITATION"
- "LICENSE"
- "Makefile"
- "changelog.rst"
- "doc"
- "paper"
- "requirements_docs.yml"
- "*.md"
pool:
vmImage: $(IMAGE_NAME)
strategy:
maxParallel: 10 # free limit is 10 parallel jobs
matrix:
linux-py3.8:
IMAGE_NAME: ubuntu-latest
PYTHON_VERSION: 3.8
linux-py3.9:
IMAGE_NAME: ubuntu-latest
PYTHON_VERSION: 3.9
CODECOV: True # Only run on one build
macos-py3.9:
IMAGE_NAME: macOS-latest
PYTHON_VERSION: 3.9
windows-py3.9:
IMAGE_NAME: windows-latest
PYTHON_VERSION: 3.9
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Enable conda (UNIX)
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Enable conda (Windows)
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- task: Cache@2
displayName: Use cached Anaconda environment
inputs:
key: 'conda | "$(Agent.OS)" | "$(PYTHON_VERSION)" | requirements.yml | requirements.txt'
restoreKeys: |
python | "$(Agent.OS)"
python
path: $(CONDA)/envs/calliope
cacheHitVar: CONDA_CACHE_RESTORED
- powershell: wget https://github.com/coin-or/Cbc/releases/download/releases%2F2.10.8/Cbc-releases.2.10.8-w64-msvc17-md.zip -O cbc.zip
displayName: Download CBC (Windows)
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- task: ExtractFiles@1
inputs:
archiveFilePatterns: 'cbc.zip' # string. Required. Archive file patterns. Default: **/*.zip.
destinationFolder: $(agent.builddirectory)\cbc # string. Required. Destination folder.
cleanDestinationFolder: true # boolean. Required. Clean destination folder before extracting. Default: true.
overwriteExistingFiles: false # boolean. Required. Overwrite existing files. Default: false.
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- powershell: Write-Host "##vso[task.prependpath]$(agent.builddirectory)\cbc\bin"
displayName: set path for CBC (Windows)
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- bash: sudo chown -R $USER $CONDA
displayName: Take ownership of conda installation (macOS)
condition: eq( variables['Agent.OS'], 'Darwin' )
- bash: |
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda info -a
displayName: Configure and update conda
- bash: |
conda config --add channels conda-forge
conda create --yes --quiet -n calliope python=$(PYTHON_VERSION)
conda env update --file requirements.yml --name calliope
conda env update --file requirements.txt --name calliope
displayName: Set up environment
condition: eq(variables.CONDA_CACHE_RESTORED, 'false')
- bash: |
conda install --yes -n calliope coin-or-cbc
displayName: Install coincbc (UNIX)
condition: and(ne(variables['Agent.OS'], 'Windows_NT'), eq(variables.CONDA_CACHE_RESTORED, 'false'))
- bash: |
source activate calliope
pip install --no-cache-dir --verbose -e .
displayName: Install calliope (UNIX)
condition: and(ne(variables['Agent.OS'], 'Windows_NT'), eq(variables.CONDA_CACHE_RESTORED, 'false'))
- script: |
call activate calliope
pip install --no-cache-dir --verbose -e .
displayName: Install calliope (Windows)
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables.CONDA_CACHE_RESTORED, 'false'))
- bash: | # cbc -quit may be required to make sure that cbc is 'reset' so its timeout time fits within pyomo's strict limit (see: https://github.com/Pyomo/pyomo/issues/2102)
source activate calliope
cbc -quit
py.test -n 2 --junitxml=junit/test-results.xml --cov=calliope --cov-report=term-missing --cov-report=xml -W ignore::FutureWarning --dist=loadscope
displayName: Run tests (UNIX)
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- script: |
call activate calliope
py.test -n 2 --junitxml=junit/test-results.xml --cov=calliope --cov-report=term-missing --cov-report=xml -W ignore::FutureWarning --dist=loadscope
displayName: Run tests (Windows)
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: '$(Agent.JobName)'
- task: PublishCodeCoverageResults@1
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
- bash: |
source activate calliope
codecov
displayName: Send results to Codecov
condition: eq( variables['CODECOV'], 'True' )
env:
CODECOV_TOKEN: $(CodecovToken)