forked from tinyobjloader/tinyobjloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
163 lines (144 loc) · 5.22 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
variables:
# https://cibuildwheel.readthedocs.io/en/stable/cpp_standards/
# cibuildwheel now supports python 3.6+(as of 2022 Oct)
#CIBW_SKIP: "pp*"
CIBW_BEFORE_BUILD: "pip install pybind11"
CIBW_ARCHS_LINUXBEFORE_BUILD: "pip install pybind11"
# disable aarch64 build for a while since it(pulling docker aarch64 image) exceeds Azure's 60 min limit
# NOTE: aarch64 linux support in Azure pipeline is not yet officially supported(as of 2022 Oct) https://github.com/microsoft/azure-pipelines-agent/issues/3935
#CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
#CIBW_BEFORE_BUILD_MACOS: "pip install -U pip setuptools"
#CIBW_BEFORE_BUILD_LINUX: "pip install -U pip setuptools"
#CIBW_TEST_COMMAND: TODO "python -c \"import tinyobjloader; tinyobjloader.test()\""
CIBW_BUILD_VERBOSITY: "2"
#CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
#CIBW_MANYLINUX_I686_IMAGE: manylinux2014
jobs:
- job: unit_linux
pool: { vmImage: "ubuntu-latest" }
steps:
- script: |
cd tests
make && ./tester
displayName: Run unit tests
- job: python_format
pool: { vmImage: "ubuntu-latest" }
steps:
- task: UsePythonVersion@0
- script: |
# 19.10b0 triggers 'cannot import name '_unicodefun' from 'click'' error.
# https://stackoverflow.com/questions/71673404/importerror-cannot-import-name-unicodefun-from-click
#pip install black==19.10b0
#pip install black==22.3.0
pip install black==22.10.0
black --check python/
displayName: Check Python code format
# Ubuntu16.04 seems now deprecated(as of 2021/12/01),
# so use `ubuntu-latest`
- job: linux
pool: {vmImage: "ubuntu-latest"}
steps:
- task: UsePythonVersion@0
- bash: |
python3 -m pip install --upgrade pip
pip3 install cibuildwheel twine
# Use pipx to build source dist
pip3 install pipx
# Source dist
pipx run build --sdist
ls -la dist/*
# build binary wheels
cibuildwheel --platform linux --output-dir wheelhouse .
- task: CopyFiles@2
inputs:
contents: 'wheelhouse/**'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: CopyFiles@2
inputs:
contents: 'dist/**'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: tinyobjDeployLinux
- job: macos
pool: {vmImage: 'macOS-latest'}
variables:
# Support C++11: https://github.com/joerick/cibuildwheel/pull/156
MACOSX_DEPLOYMENT_TARGET: 10.9
steps:
- task: UsePythonVersion@0
- bash: |
python3 -m pip install --upgrade pip
pip3 install cibuildwheel
cibuildwheel --platform macos --output-dir wheelhouse .
- task: CopyFiles@2
inputs:
contents: 'wheelhouse/*.whl'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: tinyobjDeployMacOS
- job: windows
pool: {vmImage: 'windows-latest'}
steps:
- task: UsePythonVersion@0
- bash: |
python -m pip install --upgrade pip
pip install cibuildwheel
cibuildwheel --platform windows --output-dir wheelhouse .
- task: CopyFiles@2
inputs:
contents: 'wheelhouse/*.whl'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: tinyobjDeployWindows
- job: deployPyPI
# Based on vispy: https://github.com/vispy/vispy/blob/master/azure-pipelines.yml
pool: {vmImage: 'ubuntu-latest'}
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
dependsOn:
- linux
- macos
- windows
steps:
- task: UsePythonVersion@0
# TODO(syoyo): Use buildType: specific to download multiple artifacts at once?
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'tinyobjDeployLinux'
downloadPath: $(Pipeline.Workspace)
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'tinyobjDeployMacOS'
downloadPath: $(Pipeline.Workspace)
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'tinyobjDeployWindows'
downloadPath: $(Pipeline.Workspace)
# Publish to PyPI through twine
- bash: |
cd $(Pipeline.Workspace)
find .
python -m pip install --upgrade pip
pip install twine
echo tinyobjDeployLinux/dist/*
echo tinyobjDeployLinux/wheelhouse/* tinyobjDeployMacOS/wheelhouse/* tinyobjDeployWindows/wheelhouse/*
twine upload -u "__token__" --skip-existing tinyobjDeployLinux/dist/* tinyobjDeployLinux/wheelhouse/* tinyobjDeployMacOS/wheelhouse/* tinyobjDeployWindows/wheelhouse/*
env:
TWINE_PASSWORD: $(pypiToken2)
trigger:
branches:
include:
- '*'
tags:
include:
- 'v*'
pr:
branches:
include:
- "*"