forked from fredrikaverpil/oiio-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
165 lines (145 loc) · 6.65 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
# https://aka.ms/yaml
# https://aka.ms/hosted-agent-software
# https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/cross-platform-scripting
# https://github.com/OpenImageIO/oiio/blob/master/INSTALL.md
jobs:
- job: 'oiio'
strategy:
matrix:
windows-py36:
python.version_major: '3'
python.version_minor: '6'
python.version_patch: '4'
variables:
python.version: '$(python.version_major).$(python.version_minor)'
azure.vm_image: 'vs2017-win2016'
src.python: '$(Agent.BuildDirectory)/s/src/python'
src.vcpkg: '$(Agent.BuildDirectory)/s/src/vcpkg'
tests: '$(Agent.BuildDirectory)/s/tests'
oiio.version: '2.2.13.0'
pypackage.os_name: 'Microsoft :: Windows'
pool:
vmImage: $(azure.vm_image)
steps:
# Select Python version to run on agent
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-python-version?view=azdevops
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version).$(python.version_patch)'
architecture: 'x64'
addToPath: true
# Create $(build.date) variable, to be used for GitHub release
- powershell: |
$Date = Get-Date -format "yyyyMMdd"
$DateStr = $Date.ToString()
echo "##vso[task.setvariable variable=build.date]$DateStr"
displayName: Create build.date variable
# Make setup.py ready by substituting placeholders
- powershell: |
cd $(src.python)
sed -i 's/PACKAGE_VERSION/$(oiio.version)/g' setup.py
sed -i 's/PYTHON_VERSION/$(python.version)/g' setup.py
sed -i 's/OS_NAME/$(pypackage.os_name)/g' setup.py
cat setup.py
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Inject variable values into setup.py
# Instal vcpkg
- powershell: |
cd C:/
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install
.\vcpkg update
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Install vcpkg
# Copy customized port(s) into place
- powershell: |
cp -r -v $(src.vcpkg)/ports/python3-py$(python.version).$(python.version_patch)/* C:/vcpkg/ports/python3
cp -r -v $(src.vcpkg)/ports/openimageio-py$(python.version)/* C:/vcpkg/ports/openimageio
cp -r -v $(src.vcpkg)/ports/pybind11-py$(python.version)/* C:/vcpkg/ports/pybind11
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Override vcpkg port files
# Install Python Interpreter to default location
# We have to do this because pybind11 currently can't find the
# Azure-provided Python:
# Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "3.6")
- powershell: |
choco install python --version $(python.version).$(python.version_patch)
if (Test-Path "C:/Python37/python.exe") { echo "PYTHON INTERPRETER FOUND!" }
condition: eq(variables['python.version'], '3.6')
displayName: 'Workaround: Install Python 3.6 Interpreter'
# Install pybind11 via vcpkg
- powershell: |
cd C:/vcpkg
.\vcpkg list
.\vcpkg install pybind11:x64-windows
.\vcpkg list
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Install pybind11
# Uninstall Python Interpreter
- powershell: |
if (Test-Path "C:/Python37/python.exe") { choco uninstall python -y --version $(python.version).$(python.version_patch) }
condition: eq(variables['python.version'], '3.6')
displayName: 'Workaround: Uninstall Python 3.6 Interpreter'
# Install oiio prerequisites via vcpkg
- powershell: |
cd C:/vcpkg
.\vcpkg list
.\vcpkg install openexr:x64-windows
.\vcpkg install tiff:x64-windows
.\vcpkg list
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Install oiio prerequisites
- powershell: |
$env:OIIO_PYTHON_VERSION = "$(python.version)"
cd C:/vcpkg
.\vcpkg list
.\vcpkg install openimageio:x64-windows
.\vcpkg list
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Install oiio
# Debug logs
- powershell: |
if (Test-Path "C:/vcpkg/buildtrees/openimageio/config-x64-windows-err.log") { cat C:/vcpkg/buildtrees/openimageio/config-x64-windows-err.log }
if (Test-Path "C:/vcpkg/buildtrees/openimageio/config-x64-windows-out.log") { cat C:/vcpkg/buildtrees/openimageio/config-x64-windows-out.log }
if (Test-Path "C:/vcpkg/buildtrees/openimageio/install-x64-windows-dbg-err.log") { cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-dbg-err.log }
if (Test-Path "C:/vcpkg/buildtrees/openimageio/install-x64-windows-dbg-out.log") { cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-dbg-out.log }
if (Test-Path "C:/vcpkg/buildtrees/openimageio/install-x64-windows-rel-err.log") { cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-rel-err.log }
if (Test-Path "C:/vcpkg/buildtrees/openimageio/install-x64-windows-rel-out.log") { cat C:/vcpkg/buildtrees/openimageio/install-x64-windows-rel-out.log }
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Build logs for oiio
# View files from built and installed oiio
- powershell: |
cd C:\vcpkg\installed\x64-windows\bin
tree /F
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Show contents of oiio bin folder tree
- powershell: |
cd C:\vcpkg\installed\x64-windows\lib\python$(python.version)\site-packages
tree /F
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Show contents of oiio site-packages folder tree
# Copy files into Python package
- powershell: |
cp -r -v C:\vcpkg\installed\x64-windows\lib\python$(python.version)\site-packages\*.pyd $(src.python)/oiio
cp -r -v C:\vcpkg\installed\x64-windows\bin\*.dll $(src.python)/oiio
cd $(src.python)
tree /F
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Copy files into oiio Python package
- powershell: |
cd $(src.python)
python -m pip install -U pip
pip install -U setuptools wheel
python setup.py bdist_wheel --python-tag=cp$(python.version_major)$(python.version_minor) --plat-name=win-amd64 --dist-dir="$(Build.ArtifactStagingDirectory)"
cd $(Build.ArtifactStagingDirectory)
tree /F
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Build wheel
# Publish wheel as build artifact (see "Summary" in Azure Pipelines build)
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azdevops
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop-$(python.version)