forked from fredrikaverpil/oiio-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu16.04-azure-pipelines.yml
179 lines (158 loc) · 7.35 KB
/
ubuntu16.04-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
# 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:
ubuntu-py36:
python.version_major: '3'
python.version_minor: '6'
python.version_patch: '5'
ubuntu-py37:
python.version_major: '3'
python.version_minor: '7'
python.version_patch: '0'
variables:
python.version: '$(python.version_major).$(python.version_minor)'
azure.vm_image: 'ubuntu-16.04'
src.python: '$(Agent.BuildDirectory)/s/src/python'
src.vcpkg: '$(Agent.BuildDirectory)/s/src/vcpkg'
tests: '$(Agent.BuildDirectory)/s/tests'
install.vcpkg: $(Agent.BuildDirectory)/s/vcpkg
oiio.version: '2.0.5'
pypackage.os_name: 'Microsoft :: POSIX :: Linux'
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
- bash: |
DATE=`date +%Y%m%d`
echo "##vso[task.setvariable variable=build.date]$DATE"
displayName: Create build.date variable
# Make setup.py ready by substituting placeholders
- bash: |
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
displayName: Inject variable values into setup.py
# Install vcpkg prerequisites
- bash: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install g++-7 -y
displayName: Install prerequisites for vcpkg
# Install vcpkg
- bash: |
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg update
pwd
displayName: Install vcpkg
# Copy customized port(s) into place
- bash: |
cp -r -v $(src.vcpkg)/ports/python3-py$(python.version).$(python.version_patch)/* $(install.vcpkg)/ports/python3
cp -r -v $(src.vcpkg)/ports/openimageio-py$(python.version)/* $(install.vcpkg)/ports/openimageio
cp -r -v $(src.vcpkg)/ports/pybind11-py$(python.version)/* $(install.vcpkg)/ports/pybind11
displayName: Override vcpkg port files
# Install oiio prerequisites via vcpkg
# - bash: |
# cd vcpkg
# ./vcpkg list
# ./vcpkg install openexr:x64-linux
# ./vcpkg install tiff:x64-linux
# ./vcpkg install python3:x64-linux
# ./vcpkg install pybind11:x64-linux
# ./vcpkg list
# condition: eq( variables['Agent.OS'], 'Linux' )
# displayName: Install prerequisites
# Install oiio
- bash: |
$env:OIIO_PYTHON_VERSION = "$(python.version)"
cd vcpkg
./vcpkg list
./vcpkg install python3:x64-linux
./vcpkg install pybind11:x64-linux
./vcpkg install openimageio:x64-linux
./vcpkg list
displayName: Install oiio
# Debug Logs
- bash: |
[ -f $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-dbg-err.log ] && cat $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-dbg-err.log || echo "Not found"
[ -f $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-dbg-out.log ] && cat $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-dbg-out.log || echo "Not found"
[ -f $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-rel-err.log ] && cat $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-rel-err.log || echo "Not found"
[ -f $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-rel-out.log ] && cat $(install.vcpkg)/buildtrees/openimageio/config-x64-linux-rel-out.log || echo "Not found"
[ -f $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-dbg-err.log ] && cat $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-dbg-err.log || echo "Not found"
[ -f $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-dbg-out.log ] && cat $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-dbg-out.log || echo "Not found"
[ -f $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-rel-err.log ] && cat $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-rel-err.log || echo "Not found"
[ -f $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-rel-out.log ] && cat $(install.vcpkg)/buildtrees/openimageio/install-x64-linux-rel-out.log || echo "Not found"
displayName: Build logs for oiio
# View files from built and installed oiio
- bash: |
cd $(install.vcpkg)/installed/x64-linux/lib/python$(python.version)/site-packages
ls -alh
displayName: Show contents of oiio site-packages folder
# # Copy files into Python package
- bash: |
cp -r -v $(install.vcpkg)/installed/x64-linux/lib/python$(python.version)/site-packages/*.so $(src.python)/oiio
displayName: Copy files into oiio Python package
# Build wheel
- bash: |
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=linux-x86_64 --dist-dir="$(Build.ArtifactStagingDirectory)"
cd $(Build.ArtifactStagingDirectory)
ls -alh
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)
# Tests
- bash: |
cd $(tests)
python --version
pip list
pip install $(Build.ArtifactStagingDirectory)/*.whl
pip install pytest
pip list
pytest --verbose
displayName: Run rudimental test(s)
# GitHub Release
# Create, edit, or discard a GitHub release.
# https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks/GitHubReleaseV0
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/github-release?view=azdevops
- task: GithubRelease@0
inputs:
gitHubConnection: 'oiio-python-releases'
repositoryName: 'fredrikaverpil/oiio-python'
action: 'edit' # Options: create, edit, discard
target: '$(build.sourceVersion)' # Required when action == create || action == edit
tagSource: 'Git tag' # Required when action == create. Options: auto, manual
tag: '$(oiio.version)+$(build.date)' # Required when action == edit || action == discard || tagSource == manual
title: '$(oiio.version)+$(build.date)'
#releaseNotesSource: 'file' # Optional. Options: file, input
#releaseNotesFile: # Optional
#releaseNotes: # Optional
# assets: '$(build.artifactStagingDirectory)/*' # Optional
# assets: '$(Build.ArtifactStagingDirectory)' # Optional
assetUploadMode: 'replace' # Optional. Options: delete, replace
#isDraft: false # Optional
#isPreRelease: false # Optional
addChangeLog: false # Optional
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')