This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
macOS-10.13-azure-pipelines.yml
171 lines (150 loc) · 5.9 KB
/
macOS-10.13-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
# https://aka.ms/yaml
# https://aka.ms/hosted-agent-software
# https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/cross-platform-scripting
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azdevops&tabs=yaml
# https://github.com/OpenImageIO/oiio/blob/master/INSTALL.md
jobs:
- job: 'oiio'
strategy:
matrix:
macos-py36:
python.version_major: '3'
python.version_minor: '6'
python.version_patch: '5'
macos-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: 'macOS-10.13'
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 :: MacOS'
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'' -e 's/PACKAGE_VERSION/$(oiio.version)/g' setup.py
sed -i'' -e 's/PYTHON_VERSION/$(python.version)/g' setup.py
sed -i'' -e 's/OS_NAME/$(pypackage.os_name)/g' setup.py
cat setup.py
displayName: Inject variable values into setup.py
# Install tree
- bash: |
brew install tree
displayName: Install tree
# Install vcpkg
- bash: |
brew install gcc6
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
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 python3 and pybind11 via vcpkg
- bash: |
cd $(install.vcpkg)
./vcpkg list
./vcpkg install python3:x64-osx
./vcpkg install pybind11:x64-osx
./vcpkg list
displayName: Install python3 and pybind11
# Install oiio prerequisites via vcpkg
- bash: |
cd $(install.vcpkg)
./vcpkg list
./vcpkg install openexr:x64-osx
./vcpkg install tiff:x64-osx
./vcpkg list
displayName: Install oiio prerequisites
# Install oiio
- bash: |
$env:OIIO_PYTHON_VERSION = "$(python.version)"
cd $(install.vcpkg)
./vcpkg list
./vcpkg install openimageio:x64-osx
./vcpkg list
displayName: Install oiio
# View files from built and installed oiio
- bash: |
cd $(install.vcpkg)/installed/x64-osx/lib/python$(python.version)/site-packages
tree
displayName: Show contents of oiio site-packages folder tree
# Copy files into Python package
- bash: |
cp -r -v $(install.vcpkg)/installed/x64-osx/lib/python$(python.version)/site-packages/* $(src.python)/oiio
cd $(src.python)
tree
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=macosx-10.13-x86_64 --dist-dir="$(Build.ArtifactStagingDirectory)"
cd $(Build.ArtifactStagingDirectory)
tree
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')