forked from pikepdf/pikepdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
228 lines (223 loc) · 9.68 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
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
variables:
qpdf_version: "10.0.1"
qpdf_release: ${{ format('https://github.com/qpdf/qpdf/releases/download/release-qpdf-{0}/qpdf-{0}.tar.gz', variables.qpdf_version) }}
qpdf_min_version: "8.4.2"
qpdf_min_release: ${{ format('https://github.com/qpdf/qpdf/releases/download/release-qpdf-{0}/qpdf-{0}.tar.gz', variables.qpdf_min_version) }}
jpeg_release: "https://www.ijg.org/files/jpegsrc.v9c.tar.gz"
zlib_release: "https://www.zlib.net/zlib-1.2.11.tar.gz"
cibw_skip: "cp27-* cp34-* pp27-* pp36-*"
cibw_test_command: "pytest -nauto {project}/tests"
cibw_test_requires: "-r requirements/test.txt"
cibuildwheel_version: "1.5.2"
trigger:
tags:
include:
- v*
branches:
include:
- "*"
stages:
- stage: "sdist"
jobs:
- job: linux_sdist
pool: { vmImage: "Ubuntu-18.04" }
steps:
- task: UsePythonVersion@0
- bash: |
mkdir qpdf && wget -q $QPDF_MIN_RELEASE -O - | tar xz -C qpdf --strip-components=1
cd qpdf/
./configure
make -j 2
sudo make install
cd ..
displayName: "Build QPDF"
- bash: |
python -m pip install --upgrade pip
python setup.py sdist
python -m pip install pybind11
python -m pip install --verbose dist/*.tar.gz
python -m pip install -r requirements/test.txt
python -m pip install pytest-cov
displayName: "Build sdist"
- bash: |
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
python -m pytest -nauto --junitxml=test-sdist.xml --cov=pikepdf --cov-report=xml
displayName: "Test"
- task: PublishTestResults@2
inputs:
testResultsFiles: "test-sdist.xml"
testRunTitle: "$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/coverage.xml"
- publish: dist
artifact: sdist
- stage: "Wheels"
jobs:
- job: linux64
pool: { vmImage: "Ubuntu-16.04" }
variables:
cibw_environment: >-
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
CXXFLAGS="-I/usr/local/include"
LDFLAGS="-L/usr/local/lib"
cibw_build: "*-manylinux_x86_64"
cibw_test_command: "pytest -nauto --junitxml=/host/$(System.DefaultWorkingDirectory)/test.xml {project}/tests"
cibw_before_all: "bash {project}/azure-pipelines/linux-build-deps.bash {project}"
steps:
- task: UsePythonVersion@0
- bash: source azure-pipelines/linux-download-deps.bash
displayName: "Download QPDF and components"
- bash: source azure-pipelines/build.bash
displayName: "cibuildwheel"
- task: PublishTestResults@2
inputs:
testResultsFiles: "test.xml"
testRunTitle: "$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)"
condition: succeededOrFailed()
- publish: wheelhouse
artifact: linux64
- job: linux32
pool: { vmImage: "Ubuntu-16.04" }
variables:
cibw_environment: >-
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
CXXFLAGS="-I/usr/local/include"
LDFLAGS="-L/usr/local/lib"
cibw_build: "*-manylinux_i686"
cibw_test_command: "pytest -nauto --junitxml=/host/$(System.DefaultWorkingDirectory)/test.xml {project}/tests"
cibw_before_all: "bash {project}/azure-pipelines/linux-build-deps.bash {project}"
steps:
- task: UsePythonVersion@0
- bash: source azure-pipelines/linux-download-deps.bash
displayName: "Download QPDF and components"
- bash: source azure-pipelines/build.bash
displayName: "cibuildwheel"
- task: PublishTestResults@2
inputs:
testResultsFiles: "test.xml"
testRunTitle: "$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)"
condition: succeededOrFailed()
- publish: wheelhouse
artifact: linux32
- job: "macOS_Mojave"
pool: { vmImage: "macOS-10.14" }
variables:
cibw_before_all: brew install qpdf
cibw_before_build: pip install pybind11
steps:
- task: UsePythonVersion@0
- bash: source azure-pipelines/build.bash
displayName: cibuildwheel
- publish: wheelhouse
artifact: macos
- job: windows64
pool: { vmImage: "vs2017-win2016" }
variables:
qpdf_windows: ${{ format('https://github.com/qpdf/qpdf/releases/download/release-qpdf-{0}/qpdf-{0}-bin-msvc64.zip', variables.qpdf_version) }}
cibw_build: "*-win_amd64"
cibw_environment: >-
INCLUDE="$INCLUDE;c:\\qpdf\\include"
LIB="$LIB;c:\\qpdf\\lib"
LIBPATH="$LIBPATH;c:\\qpdf\\lib"
steps:
- task: UsePythonVersion@0
- powershell: azure-pipelines/win-download-qpdf.ps1
displayName: "Download QPDF"
- powershell: |
# https://github.com/qpdf/qpdf/issues/286#issuecomment-467101492
Set-Itemproperty -path 'HKLM:\SOFTWARE\Microsoft\Cryptography\Protect\Providers\df9d8cd0-1501-11d1-8c7a-00c04fc297eb' -name 'ProtectionPolicy' -value 1
displayName: "Fix 'unable to acquire crypt context' error"
- bash: source azure-pipelines/build.bash
displayName: "cibuildwheel"
- publish: wheelhouse
artifact: win64
- job: windows32
pool: { vmImage: "vs2017-win2016" }
variables:
qpdf_windows: ${{ format('https://github.com/qpdf/qpdf/releases/download/release-qpdf-{0}/qpdf-{0}-bin-msvc32.zip', variables.qpdf_version) }}
cibw_build: "*-win32"
cibw_environment: >-
INCLUDE="$INCLUDE;c:\\qpdf\\include"
LIB="$LIB;c:\\qpdf\\lib"
LIBPATH="$LIBPATH;c:\\qpdf\\lib"
steps:
- task: UsePythonVersion@0
- powershell: azure-pipelines/win-download-qpdf.ps1
displayName: "Download QPDF"
- powershell: |
# https://github.com/qpdf/qpdf/issues/286#issuecomment-467101492
Set-Itemproperty -path 'HKLM:\SOFTWARE\Microsoft\Cryptography\Protect\Providers\df9d8cd0-1501-11d1-8c7a-00c04fc297eb' -name 'ProtectionPolicy' -value 1
displayName: "Fix 'unable to acquire crypt context' error"
- bash: source azure-pipelines/build.bash
displayName: "cibuildwheel"
- publish: wheelhouse
artifact: win32
- stage: "Deploy"
jobs:
- deployment: "PyPI"
pool: { vmImage: "ubuntu-18.04" }
environment: "deploy"
strategy:
runOnce:
deploy:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.8"
architecture: x64
- download: current
artifact: sdist
- download: current
artifact: linux64
- download: current
artifact: linux32
- download: current
artifact: macos
- download: current
artifact: win64
- download: current
artifact: win32
- script: |
mkdir -p dist
mv $(Pipeline.Workspace)/sdist/* dist
mv $(Pipeline.Workspace)/linux64/* dist
mv $(Pipeline.Workspace)/linux32/* dist
mv $(Pipeline.Workspace)/macos/* dist
mv $(Pipeline.Workspace)/win64/* dist
mv $(Pipeline.Workspace)/win32/* dist
displayName: "Organize artifacts"
- script: |
# Azure is supposed to support PyPI uploads on its own,
# but the documentation is very vague, so it's easier just
# to roll our own.
python -m pip install -U pip
python -m pip install -U twine
cat <<FILE >.pypirc
[distutils]
index-servers =
pypi
testpypi
[pypi]
username: __token__
password: $(TOKEN_PYPI)
[testpypi]
repository: https://test.pypi.org/legacy/
username: __token__
password: $(TOKEN_TESTPYPI)
FILE
displayName: "Generate PyPI auth file"
- script: |
python -m twine upload -r "testpypi" --config-file .pypirc dist/*
displayName: "Upload to TestPyPI"
condition: not(always())
- script: |
python -m twine upload --config-file .pypirc dist/*
displayName: "Upload to PyPI"
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- script: |
curl -X POST -d "token=$(TOKEN_RTD)" https://readthedocs.org/api/v2/webhook/pikepdf/39557/
displayName: "Trigger ReadTheDocs"
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master')))