Repository navigation
353 lines (329 loc) · 12.5 KB
/
Copy pathPackage.yml
File metadata and controls
353 lines (329 loc) · 12.5 KB
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
name: Package
on:
push:
tags:
- 'latest'
- 'v*'
branches-ignore:
- '**'
pull_request:
branches: [ master, main ]
paths:
- .github/workflows/Package.yml
workflow_dispatch:
concurrency:
group: '${{ github.workflow }}@${{ github.event.pull_request.head.sha || github.head_ref || github.ref }}'
# Set minimal permissions for all jobs (read-only)
permissions:
contents: read
actions: read
jobs:
package-docker:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
include:
- os: ubuntu-22.04-arm
dockerfile: Dockerfile-2014-aarch64
- os: ubuntu-latest
dockerfile: Dockerfile-2014-x86_64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Docker Build Image
shell: bash
working-directory: Utilities/Distribution/manylinux
run: |
docker build --pull=true --rm=true -t simpleitk_manylinux -f "${{ matrix.dockerfile }}" .
- name: Build ${{ matrix.dockerfile }}
shell: bash
env:
PYTHON_VERSIONS: "cp39-cp39 cp310-cp310"
BUILD_CSHARP: ${{ contains(matrix.os, 'arm') && '0' || '1' }}
BUILD_JAVA: 1
BUILD_PYTHON_LIMITED_API: 1
run: |
echo "BUILD_CSHARP: ${BUILD_CSHARP}"
echo "BUILD_JAVA: ${BUILD_JAVA}"
docker run --rm \
--user "$(id -u):$(id -g)" \
--env PYTHON_VERSIONS \
--env BUILD_CSHARP \
--env BUILD_JAVA \
--env BUILD_PYTHON_LIMITED_API \
--env SIMPLEITK_SRC_DIR="/work/src" \
-v "${{ github.workspace }}:/work/src" \
-v "${{ github.workspace }}/Utilities/Distribution/manylinux:/work/io" \
-t simpleitk_manylinux
- name: ls
shell: bash
working-directory: Utilities/Distribution/manylinux
run: |
ls -lhR .
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.os }}
path: |
Utilities/Distribution/manylinux/wheelhouse/*.whl
Utilities/Distribution/manylinux/SimpleITK*.zip
build:
if: github.repository == 'SimpleITK/SimpleITK'
runs-on: ${{ matrix.os }}
env:
COREBINARYDIRECTORY: "${{ github.workspace }}/bld"
ExternalData_OBJECT_STORES: "${{ github.workspace }}/.ExternalData"
DASHBOARD_BRANCH_DIRECTORY: "${{ github.workspace }}/SimpleITK-dashboard"
CTEST_SOURCE_DIRECTORY: "${{ github.workspace }}"
CTEST_CONFIGURATION_TYPE: "${{ matrix.cmake-build-type }}"
strategy:
fail-fast: false
max-parallel: 5
matrix:
include:
- os: macos-13
cmake-build-type: "Release"
cmake-generator: "Ninja"
ctest-cache: |
CMAKE_CXX_FLAGS:STRING=-fvisibility=hidden -fvisibility-inlines-hidden
CMAKE_C_FLAGS:STRING=-fvisibility=hidden
CMAKE_OSX_DEPLOYMENT_TARGET=10.9
ITK_C_OPTIMIZATION_FLAGS:STRING=
ITK_CXX_OPTIMIZATION_FLAGS:STRING=
SimpleITK_BUILD_DISTRIBUTE:BOOL=ON
SimpleITK_BUILD_STRIP:BOOL=1
- os: mac-arm64
cmake-build-type: "Release"
cmake-generator: "Ninja"
ctest-cache: |
CMAKE_CXX_FLAGS:STRING=-fvisibility=hidden -fvisibility-inlines-hidden
CMAKE_C_FLAGS:STRING=-fvisibility=hidden
CMAKE_OSX_DEPLOYMENT_TARGET=11.0
ITK_C_OPTIMIZATION_FLAGS:STRING=
ITK_CXX_OPTIMIZATION_FLAGS:STRING=
SimpleITK_BUILD_DISTRIBUTE:BOOL=ON
SimpleITK_BUILD_STRIP:BOOL=1
- os: windows-2022
cmake-build-type: "Release"
cmake-generator: "Visual Studio 17 2022"
cmake-generator-toolset: v142,host=x64
cmake-generator-platform: x64
ctest-cache: |
BUILD_EXAMPLES:BOOL=ON
BUILD_TESTING:BOOL=ON
ITK_C_OPTIMIZATION_FLAGS:STRING=
ITK_CXX_OPTIMIZATION_FLAGS:STRING=
SimpleITK_BUILD_DISTRIBUTE:BOOL=ON
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
path: SimpleITK-dashboard
ref: dashboard
- name: Generate External Data Hash
shell: bash
run: |
mkdir -p ${ExternalData_OBJECT_STORES}
ls -la "${{ github.workspace }}/Testing/Data/"
git log -n 1 "${{ github.workspace }}/Testing/Data/" | tee "${{ github.workspace }}/external-data.hashable"
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.ExternalData_OBJECT_STORES }}
key: external-data-v1-${{ hashFiles( format( '{0}/{1}', github.workspace, 'external-data.hashable') ) }}
enableCrossOsArchive: true
restore-keys: |
external-data-v1-
- name: Set up Python 3.11
uses: actions/setup-python@v5
id: cpy
with:
python-version: 3.11
- name: Install build dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install -r ./.github/workflows/requirements-build.txt
if [ ! -z "${{ matrix.xcode-version }}" ]; then
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer/
xcode-select -p
fi
- name: Build and Test
shell: bash
env:
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
CTEST_BINARY_DIRECTORY: "${{ env.COREBINARYDIRECTORY }}"
CTEST_CMAKE_GENERATOR: "${{ matrix.cmake-generator }}"
CTEST_CMAKE_GENERATOR_TOOLSET: "${{ matrix.cmake-generator-toolset }}"
CTEST_CMAKE_GENERATOR_PLATFORM: "${{ matrix.cmake-generator-platform }}"
CTEST_OUTPUT_ON_FAILURE: 1
CTEST_CACHE: |
WRAP_DEFAULT:BOOL=OFF
BUILD_EXAMPLES:BOOL=ON
BUILD_TESTING:BOOL=ON
${{ matrix.ctest-cache }}
run: |
cmake --version
ninja --version
ctest -D "dashboard_track:STRING=Package" -S ${CTEST_SOURCE_DIRECTORY}/.github/workflows/github_actions.cmake -VV
- name: Generate Source and Data Archives
shell: bash
if: matrix.os == 'macos-13'
run: |
set -xe
Utilities/Maintenance/SourceTarball.bash --tgz --zip --verbose "${{ env.COREBINARYDIRECTORY }}/SimpleITK-build" ${{ github.sha }}
mkdir -p ${{ github.workspace }}/artifacts
ls -la
shopt -s extglob
mv SimpleITK@(Data|)-*@(zip|gz) ${{ github.workspace }}/artifacts
- name: Cleanup build
shell: bash
run: |
rm -rf ${COREBINARYDIRECTORY}/ITK ${COREBINARYDIRECTORY}/ITK-build
rm -rf ${COREBINARYDIRECTORY}/SimpleITK-build
- name: Package CSharp
uses: ./.github/actions/package_csharp
with:
continue-on-error: true
- name: Package Java
uses: ./.github/actions/package_java
with:
continue-on-error: true
- name: Package Python 3.11
uses: ./.github/actions/package_python
with:
python-version: 3.11
use_limited_api: true
- name: Package Python 3.10
uses: ./.github/actions/package_python
with:
python-version: "3.10"
- name: Package Python 3.9
uses: ./.github/actions/package_python
with:
python-version: 3.9
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.os }}
path: |
${{ github.workspace }}/artifacts/*.whl
${{ github.workspace }}/artifacts/*.zip
${{ github.workspace }}/artifacts/*.gz
doxygen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Docker Image for Doxygen
run: |
cd $GITHUB_WORKSPACE/Utilities/Doxygen/docker
docker build -f Dockerfile -t simpleitk-doxygen .
- name: Docker Doxygen generation
run: |
docker run \
--mount type=bind,source=$GITHUB_WORKSPACE,destination=/work/SimpleITK,readonly \
--name sitk-dox simpleitk-doxygen
mkdir -p artifacts
TAG=$(git describe --tags --match=v\*)
docker cp sitk-dox:/SimpleITKDoxygen.tar.gz artifacts/SimpleITKDoxygen-${TAG}.tar.gz
docker cp sitk-dox:/SimpleITKDoxygenXML.tar.gz artifacts/SimpleITKDoxygenXML-${TAG}.tar.gz
- name: Archive Doxygen Artifacts
uses: actions/upload-artifact@v4
with:
name: doxygen-xml
path: |
artifacts/SimpleITKDoxygenXML-*.tar.gz
artifacts/SimpleITKDoxygen-*.tar.gz
publish:
if: github.event_name != 'pull_request' && (github.ref_name == 'latest' || startsWith(github.ref_name, 'v'))
environment:
name: release
permissions:
id-token: write # for PyPI publish
contents: write # for creating and uploading GitHub releases
needs:
- build
- doxygen
- package-docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
id: download
with:
path: ${{ github.workspace }}/artifacts
- name: Checksums
shell: bash
run: |
sha256sum $( find ${{ steps.download.outputs.download-path }} -type f -name "*.gz" "*.whl" -o -name "*.zip" ) > checksums.txt
echo "== checksums.txt =="
cat checksums.txt
- name: Set tag name
id: tag
run: |
echo "TAG NAME: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "name=${{github.ref_name}}" >> $GITHUB_OUTPUT
- name: Create Release Notes
shell: bash
run: |
echo "Tag Name: ${{ steps.tag.outputs.name }}"
if [ "${{ steps.tag.outputs.name }}" == "latest" ]; then
echo "This is an automatic packaging of SimpleITK based on the master branch. It contains the latest features and experimental developments." > notes.txt
else
echo "This is an automatic packaging of SimpleITK based on the ${{ steps.tag.outputs.name }} tag." > notes.txt
fi
echo "
To upgrade to this Python binary package run:
\`\`\`pip install --upgrade --pre simpleitk --find-links https://github.com/SimpleITK/SimpleITK/releases/tag/${{ steps.tag.outputs.name }}\`\`\`
" >notes.txt
${{ github.workspace }}/Utilities/Maintenance/GeneratePythonDownloadsPage.py \
--hash md5 \
--format gh \
--tag "${{ steps.tag.outputs.name }}" \
$( find ${{ steps.download.outputs.download-path }} -type f -name \*.whl ) \
>> notes.txt
echo "== notes.txt =="
cat notes.txt
- name: Create Release and Upload Artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ steps.tag.outputs.name }}" == "latest" ]; then
gh release delete ${{ steps.tag.outputs.name }} --yes || true
fi
if [[ "${{ steps.tag.outputs.name }}" == "latest" ||
"${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?((-.)?[a-zA-Z]+[0-9]*)$ ]]; then
create_args="--prerelease"
fi
gh release create ${{ steps.tag.outputs.name }} \
--target ${{ github.sha }} \
--verify-tag \
--draft \
--generate-notes \
$create_args \
--notes-file notes.txt \
--title "Release ${{ github.ref_name }}"
gh release upload ${{ steps.tag.outputs.name }} $( find ${{ steps.download.outputs.download-path }} -type f -name "*.whl" -o -name "*.zip" -o -name "*.gz" )
if [ "${{ steps.tag.outputs.name }}" == "latest" ]; then
gh release edit ${{ steps.tag.outputs.name }} --draft=false
fi
- name: Prepare for PyPI upload
shell: bash
run: |
mkdir -p dist
mv $( find ${{ steps.download.outputs.download-path }} -type f -name "*.whl" ) dist/
- name: PyPI Publish package
if: startsWith(github.ref_name, 'v')
# hash for release/v1.12.4
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
with:
repository-url: https://test.pypi.org/legacy/