forked from CATIA-Systems/FMPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
231 lines (185 loc) · 5.85 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
variables:
- name: create_environment
value: conda create --yes --quiet --name fmpy-env -c conda-forge python=3.8 attrs dask ipython=7 jinja2 lark lxml matplotlib notebook numpy plotly pyqt pyqtgraph pytest-cov requests scipy
jobs:
- job: linux
displayName: 'Ubuntu 20.04'
pool:
vmImage: 'ubuntu-20.04'
steps:
- checkout: self
submodules: true
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: conda create --yes --name fmpy-env -c conda-forge python=3.10
displayName: Create Anaconda environment
- bash: |
source activate fmpy-env
conda install -c conda-forge --yes attrs dask ipython=7 jinja2 lark lxml matplotlib notebook numpy plotly pyqt pyqtgraph pytest-cov requests scipy cmake
displayName: Install conda packages
- bash: |
source activate fmpy-env
python build_cvode.py
displayName: Build CVode binaries
- bash: |
source activate fmpy-env
python build_binaries.py
displayName: Build FMPy binaries
- bash: |
source activate fmpy-env
python build_remoting.py
displayName: Build remoting binaries
- bash: |
source activate fmpy-env
python setup.py bdist_wheel --universal
for f in dist/FMPy-*.whl; do
pip install $f --no-deps -vv
done
cd tests
pytest --junitxml=junit/test-results.xml --cov=fmpy --cov-report=xml
cd ..
displayName: Build, install and run tests
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
- task: PublishPipelineArtifact@1
inputs:
path: dist
artifact: 'linux'
- job: macosx
displayName: 'macOS 11'
pool:
vmImage: 'macOS-11'
steps:
- checkout: self
submodules: true
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
# On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation directory/
# We need to take ownership if we want to update conda or install packages globally
- bash: sudo chown -R $USER $CONDA
displayName: Take ownership of conda installation
- bash: $(create_environment)
displayName: Create Anaconda environment
- bash: |
source activate fmpy-env
python build_cvode.py
displayName: Build CVode binaries
- bash: |
source activate fmpy-env
python build_binaries.py
displayName: Build FMPy binaries
- bash: |
source activate fmpy-env
python setup.py bdist_wheel --universal
for f in dist/FMPy-*.whl; do
pip install $f --no-deps -vv
done
cd tests
pytest --junitxml=junit/test-results.xml --cov=fmpy --cov-report=xml
cd ..
displayName: Build, install and run tests
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
- task: PublishPipelineArtifact@1
inputs:
path: dist
artifact: 'macosx'
- job: windows
displayName: 'Windows Server 2022'
pool:
vmImage: 'windows-2022'
steps:
- checkout: self
submodules: true
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to PATH
- script: $(create_environment) cmake pywin32
displayName: Create Anaconda environment
- script: |
call activate fmpy-env
python build_cvode.py
displayName: Build CVode binaries
- bash: |
source activate fmpy-env
python build_binaries.py
displayName: Build FMPy binaries
- script: |
call activate fmpy-env
python build_remoting.py
displayName: Build Remoting binaries
- script: |
call activate fmpy-env
python setup.py bdist_wheel --universal
displayName: Build wheel
- task: PublishPipelineArtifact@1
inputs:
path: dist
artifact: 'windows'
- script: |
call activate fmpy-env
for %%f in (dist\FMPy-*.whl) do pip install %%f --no-deps
cd tests
pytest --junitxml=junit/test-results.xml --cov=fmpy --cov-report=xml
cd ..
displayName: Install wheel and run tests
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results'
failTaskOnFailedTests: true
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
- job: merge
dependsOn:
- linux
- macosx
- windows
displayName: 'Merge Python Wheels'
pool:
vmImage: 'ubuntu-20.04'
steps:
- bash: mkdir temp
displayName: Merge Python Wheels
- task: DownloadPipelineArtifact@2
inputs:
artifact: linux
downloadPath: linux
- task: DownloadPipelineArtifact@2
inputs:
artifact: macosx
downloadPath: macosx
- task: DownloadPipelineArtifact@2
inputs:
artifact: windows
downloadPath: windows
- bash: |
unzip -o linux/*.whl -d merged
unzip -o macosx/*.whl -d merged
unzip -o windows/*.whl -d merged
cd merged
zip -r FMPy-x.x.x-py3-none-any.whl .
displayName: Merge Python Wheels
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: merged/FMPy-x.x.x-py3-none-any.whl
artifactName: merged