-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbuild-bindings-job.yml
executable file
·213 lines (186 loc) · 7.36 KB
/
build-bindings-job.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
parameters:
name: 'Generate bindings'
vmImage: 'Ubuntu-16.04'
py_maj: '3'
py_min: '7'
py_min_build:
- 6
- 7
- 8
config_file: 'ocp.toml'
conda_bld: '3.16.3'
conda_env_file: 'env.yml'
CXX: g++-8
jobs:
- job: ${{ parameters.name }}
timeoutInMinutes: 360
pool:
vmImage: ${{ parameters.vmImage }}
variables:
n_cores: 2
steps:
- checkout: self
submodules: true
- ${{ if contains(parameters.vmImage, 'Ubuntu') }}:
- bash: sudo apt-get install ${{ parameters.CXX }} mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
displayName: 'Install g++8 and gl headers'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
ln -s "$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/OpenGL.framework/Headers" /usr/local/include/OpenGL
displayName: 'Find GL headers'
- template: conda-enable.yml@templates
parameters:
vmImage: ${{ parameters.vmImage }}
- bash: |
conda env create -f ${{ parameters.conda_env_file }} && \
conda install -n cpp-py-bindgen -y python=${{ parameters.py_maj }}.${{ parameters.py_min }}
displayName: 'Prepare conda environment'
- bash: |
source activate cpp-py-bindgen && \
conda info -a && \
conda list && \
which python && \
env
displayName: 'Conda env sanity checks'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
source activate cpp-py-bindgen && \
echo | clang -v -E -x c - && \
cd $CONDA_PREFIX && \
find . -name type_traits\* && \
sudo find /usr/local/ -name type_traits\*
displayName: 'Mac header check'
- bash: |
source activate cpp-py-bindgen && \
OUTPUT=`python -c'import toml; print(toml.load("${{ parameters.config_file }}")["output_folder"])'` && \
echo $OUTPUT && \
echo "##vso[task.setvariable variable=OUTPUT;isOutput=true]$OUTPUT"
displayName: 'Read output dir from the config file'
name: 'conf'
- bash: |
ls && env && \
source activate cpp-py-bindgen && \
python -m bindgen -n $(n_cores) parse ${{ parameters.config_file }} out.pkl && \
python -m bindgen -n $(n_cores) transform ${{ parameters.config_file }} out.pkl out_f.pkl && \
python -m bindgen -n $(n_cores) generate ${{ parameters.config_file }} out_f.pkl
displayName: 'Generate'
env:
PYTHONPATH: pywrap
- task: CopyFiles@2
inputs:
contents: 'out*.pkl'
targetFolder: $(conf.OUTPUT)
displayName: 'Copy pkl outputs'
- publish: $(conf.OUTPUT)
artifact: OCP_src_${{ parameters.vmImage }}
- ${{ each py_min in parameters.py_min_build }}:
- job: ${{ parameters.name }}_${{ parameters.py_maj }}_${{ py_min }}
timeoutInMinutes: 360
dependsOn: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
variables:
n_cores: 2
OCP_src: OCP_src_${{ parameters.vmImage }}
steps:
- download: current
artifact: OCP_src_${{ parameters.vmImage }}
- ${{ if contains(parameters.vmImage, 'Ubuntu') }}:
- bash: sudo apt-get install ${{ parameters.CXX }} mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
displayName: 'Install g++8 and gl headers'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
sudo find /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ && \
ln -s "$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/OpenGL.framework/Headers" /usr/local/include/OpenGL
displayName: 'Search for GL'
- ${{ if contains(parameters.vmImage, 'win') }}:
- bash: ls "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build"
displayName: 'Find vcvars64'
- ${{ if contains(parameters.vmImage, 'win') }}:
- script: |
choco install --accept-license -y Ninja llvm
displayName: 'Install clang'
- template: conda-enable.yml@templates
parameters:
vmImage: ${{ parameters.vmImage }}
- bash: |
sed -e s/python=.../python=${{ parameters.py_maj }}.${{ py_min }}/ ${{ parameters.conda_env_file }} > _env.yml && \
conda env create -f _env.yml
displayName: 'Prepare conda environment'
- bash: |
source activate cpp-py-bindgen && \
conda info -a && \
conda list && \
which python && \
env
displayName: 'Conda env sanity checks'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
source activate cpp-py-bindgen && \
echo | clang -v -E -x c - && \
cd $CONDA_PREFIX && \
find . -name type_traits\* && \
sudo find /usr/local/ -name type_traits\*
displayName: 'Mac header check'
- ${{ if contains(parameters.vmImage, 'Ubuntu') }}:
- bash: |
source activate cpp-py-bindgen && \
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Release && \
cmake --build build -j $(n_cores) -- -k 0 && \
rm -rf build/CMakeFiles
displayName: 'Compile'
env:
CXX: ${{ parameters.CXX }}
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
source activate cpp-py-bindgen && \
cp -rf opencascade $CONDA_PREFIX/include && \
cat $CONDA_PREFIX/include/opencascade/OpenGl_HaltonSampler.hxx &&\
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Debug && \
cmake --build build -j $(n_cores) -- -k 0 && \
rm -rf build/CMakeFiles
displayName: 'Compile'
env:
CXX: "clang++"
- ${{ if contains(parameters.vmImage, 'win') }}:
- script: |
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"
call activate cpp-py-bindgen
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build -j $(n_cores) -- -k 0
rmdir /S /Q build\CMakeFiles
displayName: 'Compile'
env:
CXX: "cl.exe"
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'build'
artifactName: OCP_${{ parameters.vmImage }}
displayName: 'Publish compilation result'
- bash: |
source activate cpp-py-bindgen && \
cd build && \
LD_DEBUG=libs python -c"import OCP"
displayName: 'Test'
- bash: |
conda create -n build -y python=3.6 conda-build=${{ parameters.conda_bld }} anaconda-client && \
source activate build && \
cp build/OCP.cp*-*.* . && \
conda build --token $TOKEN --user cadquery -c conda-forge conda
displayName: 'Build conda package'
condition: ne(variables['Build.Reason'], 'PullRequest')
env:
BUILD_STRING: "1"
PYTHON_VERSION: ${{ parameters.py_maj }}.${{ py_min }}
TOKEN: $(anaconda.TOKEN)
- bash: |
conda create -n build -y python=3.6 conda-build=${{ parameters.conda_bld }} anaconda-client && \
source activate build && \
cp build/OCP.cp*-*.* . && \
conda build -c conda-forge conda
displayName: 'Build conda package'
condition: eq(variables['Build.Reason'], 'PullRequest')
env:
BUILD_STRING: "1"
PYTHON_VERSION: ${{ parameters.py_maj }}.${{ py_min }}
TOKEN: $(anaconda.TOKEN)