-
Notifications
You must be signed in to change notification settings - Fork 20
/
publish.yml
246 lines (221 loc) · 10.1 KB
/
publish.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
parameters:
npm_dir: "."
libraries: []
jobs:
- ${{ each target in parameters.targets }}:
- ${{ if and(startsWith(target, 'wheels_'),ne(target, 'wheels_universal')) }}:
- job: ${{ replace(replace(replace(replace(replace(replace(replace(replace(replace(target, '?', ''), '*', ''), '[', ''), ']', ''), '!', ''), '-', '_'), '{', ''), '}', ''), ',', '') }}
displayName: ${{ target }}
dependsOn: ${{ parameters.dependsOn }}
condition: succeeded()
variables:
CIBW_TEST_COMMAND: ${{ parameters.test_command }}
CIBW_TEST_EXTRAS: ${{ parameters.test_extras }}
OA_TARGET: ${{ target }}
job_name: ${{ replace(replace(replace(replace(replace(replace(replace(replace(replace(target, '?', ''), '*', ''), '[', ''), ']', ''), '!', ''), '-', '_'), '{', ''), '}', ''), ',', '') }}
${{ if contains(target, 'macos') }}:
os: 'macos'
${{ if contains(target, 'win') }}:
os: 'win'
${{ if contains(target, 'linux') }}:
os: 'linux'
${{ if not(or(eq(target, 'wheels_macos'), eq(target, 'wheels_linux'), eq(target, 'wheels_windows'))) }}:
CIBW_BUILD: ${{ replace(target, 'wheels_', '') }}
${{ if contains(target, 'aarch64') }}:
CIBW_ARCHS: aarch64
pool:
${{ if eq(variables.os, 'macos') }}:
vmImage: macos-latest
${{ if eq(variables.os, 'linux') }}:
vmImage: ubuntu-latest
${{ if eq(variables.os, 'win') }}:
vmImage: windows-latest
steps:
- checkout: self
lfs: true
submodules: ${{ coalesce(parameters.submodules, true) }}
fetchDepth: 999999999
- task: UsePythonVersion@0
displayName: setup python3.9
inputs:
versionSpec: '3.9'
- bash: python -m pip install --upgrade pip execute-517
displayName: Upgrading pip
- ${{ if contains(target, 'aarch64') }}:
- bash: |
docker run --rm --privileged hypriot/qemu-register
displayName: Registering qemu
- ${{ if parameters.remove_local_scheme }}:
- bash: |
version=$(execute-517 'setup.py --version' | tail -1 | cut -d '+' -f 1)
echo "##vso[task.setvariable variable=SETUPTOOLS_SCM_PRETEND_VERSION]$version"
echo "##vso[task.setvariable variable=CIBW_ENVIRONMENT]SETUPTOOLS_SCM_PRETEND_VERSION=\"$version\""
displayName: Remove local scheme from version
- bash: |
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$SETUPTOOLS_SCM_PRETEND_VERSION"
echo "CIBW_ENVIRONMENT=$CIBW_ENVIRONMENT"
displayName: Display modified version number
- bash: python -m pip install cibuildwheel!=2.2.0
displayName: Installing cibuildwheel
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Running cibuildwheel
- publish: 'wheelhouse'
artifact: ${{ variables.job_name }}
- ${{ if eq(target, 'npm') }}:
- job: ${{ target }}
dependsOn: ${{ parameters.dependsOn }}
condition: succeeded()
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
submodules: ${{ coalesce(parameters.submodules, true) }}
fetchDepth: 999999999
- task: Npm@1
inputs:
command: 'install'
workingDir: ${{ parameters.npm_dir }}
- ${{ if eq(target, 'sdist') }}:
- job: ${{ target }}
dependsOn: ${{ parameters.dependsOn }}
condition: succeeded()
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
submodules: ${{ coalesce(parameters.submodules, true) }}
fetchDepth: 999999999
- task: UsePythonVersion@0
displayName: setup python3.9
inputs:
versionSpec: '3.9'
- ${{ each library in parameters.libraries }}:
- script: sudo apt-get install -y ${{ library }}
displayName: Installing ${{ library }} with apt
- script: 'python -m pip install -U --force-reinstall build execute-517'
displayName: "Install build tools"
- ${{ if parameters.remove_local_scheme }}:
- bash: |
version=$(execute-517 'setup.py --version' | tail -1 | cut -d '+' -f 1)
echo "##vso[task.setvariable variable=SETUPTOOLS_SCM_PRETEND_VERSION]$version"
displayName: Remove local scheme from version
- bash: |
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$SETUPTOOLS_SCM_PRETEND_VERSION"
displayName: Display modified version number
- script: 'python -m build --sdist --outdir wheelhouse .'
displayName: "Build source distribution"
- ${{ if parameters.test_extras }}:
- script: ${{ format('python -m pip install --force-reinstall $(find wheelhouse -name "*.tar.gz")[{0}]', parameters.test_extras) }}
displayName: "Installing source distribution"
- ${{ if not(parameters.test_extras) }}:
- script: 'python -m pip install $(find wheelhouse -name "*.tar.gz")'
displayName: "Installing source distribution"
- ${{ if parameters.test_command }}:
- script: ${{ parameters.test_command }}
displayName: "Test source distribution"
workingDirectory: $(Agent.TempDirectory)
- publish: 'wheelhouse'
artifact: ${{ target }}
- ${{ if eq(target, 'wheels_universal') }}:
- job: ${{ target }}
dependsOn: ${{ parameters.dependsOn }}
condition: succeeded()
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
submodules: ${{ coalesce(parameters.submodules, true) }}
fetchDepth: 999999999
- task: UsePythonVersion@0
displayName: setup python3.9
inputs:
versionSpec: '3.9'
- script: 'python -m pip install -U --force-reinstall build execute-517'
displayName: "Install build tools"
- ${{ if parameters.remove_local_scheme }}:
- bash: |
version=$(execute-517 'setup.py --version' | tail -1 | cut -d '+' -f 1)
echo "##vso[task.setvariable variable=SETUPTOOLS_SCM_PRETEND_VERSION]$version"
displayName: Remove local scheme from version
- bash: |
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$SETUPTOOLS_SCM_PRETEND_VERSION"
displayName: Display modified version number
- script: 'python -m build --wheel --outdir wheelhouse .'
displayName: "Build universal wheel"
- ${{ if parameters.test_extras }}:
- script: ${{ format('python -m pip install --force-reinstall $(find wheelhouse -name "*.whl")[{0}]', parameters.test_extras) }}
displayName: "Installing universal wheel"
- ${{ if not(parameters.test_extras) }}:
- script: 'python -m pip install $(find wheelhouse -name "*.whl")'
displayName: "Installing universal wheel"
- ${{ if parameters.test_command }}:
- script: ${{ parameters.test_command }}
displayName: "Test universal wheel"
workingDirectory: $(Agent.TempDirectory)
- publish: 'wheelhouse'
artifact: ${{ target }}
- ${{ if coalesce(parameters.pypi_connection_name, parameters.artifact_feed) }}:
- job: publish
dependsOn:
- ${{ each target in parameters.targets }}:
- ${{ replace(replace(replace(replace(replace(replace(replace(replace(replace(target, '?', ''), '*', ''), '[', ''), ']', ''), '!', ''), '-', '_'), '{', ''), '}', ''), ',', '') }}
condition: succeeded()
pool:
vmImage: ubuntu-latest
steps:
- checkout: none
- task: UsePythonVersion@0
displayName: setup python3.9
inputs:
versionSpec: '3.9'
- script: 'python -m pip install -U --user --force-reinstall twine'
displayName: "install twine"
# Get all artifacts from this build
- ${{ each target in parameters.targets }}:
- ${{ if ne(target, 'npm') }}:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: 'wheelhouse'
artifactName: ${{ replace(replace(replace(replace(replace(replace(replace(replace(replace(target, '?', ''), '*', ''), '[', ''), ']', ''), '!', ''), '-', '_'), '{', ''), '}', ''), ',', '') }}
- script: 'ls -R wheelhouse'
displayName: "List files for upload"
- ${{ if parameters.pypi_connection_name }}:
- task: TwineAuthenticate@1
inputs:
pythonUploadServiceConnection: ${{ parameters.pypi_connection_name }}
- script: ${{ format('python -m twine upload --skip-existing -r {0} --config-file $(PYPIRC_PATH) "wheelhouse/*"', coalesce(parameters.pypi_endpoint_name, parameters.pypi_connection_name)) }}
displayName: "upload sdist and wheels to PyPI"
# If you want to specify an organisation scoped feed then you don't prefix with the project,
# if you want a project scoped feed, you must prefix the Authenticate task with the project
# however, twine only gets the feed name.
- ${{ if parameters.artifact_feed }}:
- ${{ if not(parameters.artifact_project) }}:
- task: TwineAuthenticate@1
inputs:
artifactFeed: ${{ parameters.artifact_feed }}
- ${{ if parameters.artifact_project }}:
- task: TwineAuthenticate@1
inputs:
artifactFeed: ${{ format('{0}/{1}', parameters.artifact_project, parameters.artifact_feed) }}
- script: ${{ format('python -m twine upload --skip-existing -r {0} --config-file $(PYPIRC_PATH) "wheelhouse/*"', parameters.artifact_feed) }}
displayName: "upload sdist and wheels to Artifact feed"
- ${{ if parameters.npm_connection_name }}:
- job: publish_npm
dependsOn: ${{ parameters.targets }}
condition: succeeded()
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
submodules: ${{ coalesce(parameters.submodules, true) }}
fetchDepth: 999999999
- task: Npm@1
inputs:
command: 'install'
workingDir: ${{ parameters.npm_dir }}
- task: Npm@1
inputs:
command: 'publish'
publishEndpoint: ${{ parameters.npm_connection_name}}
workingDir: ${{ parameters.npm_dir }}