-
Notifications
You must be signed in to change notification settings - Fork 109
557 lines (556 loc) · 16.9 KB
/
release.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
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
# DO NOT EDIT - GENERATED FROM .github/workflows/release.ys
name: release
defaults:
run:
shell: bash -e -x {0}
'on':
workflow_dispatch: null
push:
tags:
- v0.*
- v1.*
- v2.*
branches:
- master
pull_request:
branches:
- master
env:
PROJ_PKG_NAME: rapidyaml-
PROJ_PFX_TARGET: ryml-
PROJ_PFX_CMAKE: RYML_
CMAKE_FLAGS: -DRYML_TEST_SUITE=OFF
NUM_JOBS_BUILD: null
jobs:
gettag:
if: always()
continue-on-error: false
runs-on: ubuntu-latest
steps:
- name: checkout (action)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Variables (from tag)
if: contains(github.ref, 'tags/v')
run: |
set -exo pipefail
# https://github.community/t/how-to-get-just-the-tag-name/16241/11
SRC_TAG=${GITHUB_REF#refs/tags/}
SRC_VERSION=${GITHUB_REF#refs/tags/v}
SRC_VERSION_BODY=`pwd`/changelog/$SRC_VERSION.md
if [ ! -f $SRC_VERSION_BODY ] ; then
echo "version body file was not found: $SRC_VERSION_BODY"
exit 1
fi
cat <<EOF >> vars.sh
export SRC_TAG=$SRC_TAG
export SRC_VERSION=$SRC_VERSION
export SRC_VERSION_BODY=$SRC_VERSION_BODY
EOF
- name: Variables (from commit, no tag)
if: ${{ !contains(github.ref, 'tags/v') }}
run: |
set -exo pipefail
branch_name=${GITHUB_REF#refs/heads/}
# builds triggered from PRs have the branch_name like this: refs/pull/150/merge
# so filter to eg pr0150_merge
branch_name=`echo $branch_name | sed "s:refs/pull/\([0-9]*\)/\(.*\):pr0\1_\2:"`
# sanitize the branch name; eg merge/foo-bar -> merge_foo_bar
branch_name=`echo $branch_name | sed 's:[/.-]:_:g'`
SRC_TAG=$(git describe || git rev-parse --short HEAD) # eg v0.2.0-110-gda837e0
SRC_VERSION="${branch_name}-${SRC_TAG}"
cat <<EOF > vars.sh
export SRC_TAG=$SRC_TAG
export SRC_VERSION=$SRC_VERSION
EOF
- name: Save vars.sh
uses: actions/upload-artifact@v4
with:
name: vars.sh
path: ./vars.sh
- name: Show vars.sh
run: cat vars.sh
- name: Source vars.sh
run: source vars.sh
- name: Env (common)
run: |
source vars.sh
echo "SRC_TAG=$SRC_TAG" >> $GITHUB_ENV
echo "SRC_VERSION=$SRC_VERSION" >> $GITHUB_ENV
- name: Env (from tag)
if: contains(github.ref, 'tags/v')
run: |
echo "SRC_VERSION_BODY=$SRC_VERSION_BODY" >> $GITHUB_ENV
- name: Variables (from commit, no tag)
if: ${{ !contains(github.ref, 'tags/v') }}
run: echo 'nothing to do'
- name: Verify vars.sh
run: env | grep SRC
src:
if: always()
continue-on-error: false
needs: gettag
runs-on: ubuntu-latest
steps:
- name: checkout (action)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Download vars.sh
uses: actions/download-artifact@v4
with:
name: vars.sh
path: ./
- name: Show vars.sh
run: cat vars.sh
- name: Source vars.sh
run: source vars.sh
- name: Env (common)
run: |
source vars.sh
echo "SRC_TAG=$SRC_TAG" >> $GITHUB_ENV
echo "SRC_VERSION=$SRC_VERSION" >> $GITHUB_ENV
- name: Env (from tag)
if: contains(github.ref, 'tags/v')
run: |
echo "SRC_VERSION_BODY=$SRC_VERSION_BODY" >> $GITHUB_ENV
- name: Variables (from commit, no tag)
if: ${{ !contains(github.ref, 'tags/v') }}
run: echo 'nothing to do'
- name: Verify vars.sh
run: env | grep SRC
- name: Install python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install requirements
run: sudo -E pip install git-archive-all
- name: Create source packages
run: |
pwd
ls -lFhp
source vars.sh
echo SRC_TAG=$SRC_TAG
echo SRC_VERSION=$SRC_VERSION
id=${PROJ_PKG_NAME}${SRC_VERSION}
name=${id}-src
mkdir -p assets
git-archive-all --prefix $name assets/$name.tgz
git-archive-all --prefix $name assets/$name.zip
python --version
python tools/amalgamate.py assets/$id.hpp
- name: Save source artifacts
uses: actions/upload-artifact@v4
with:
name: assets-src
path: assets/
cpp:
if: always()
continue-on-error: false
name: cpp/${{matrix.config.os}}/${{matrix.config.gen}}
needs: gettag
runs-on: ${{matrix.config.os}}
env:
DEV: 'OFF'
BT: Release
OS: ${{matrix.config.os}}
CXX_: ${{matrix.config.cxx}}
GEN: ${{matrix.config.gen}}
strategy:
fail-fast: false
matrix:
config:
- name: Ubuntu 22.04 deb
sfxg: unix64.deb
sfxp: ubuntu-22.04.deb
gen: DEB
mime: vnd.debian.binary-package
os: ubuntu-22.04
- name: Ubuntu 20.04 deb
sfxg: unix64.deb
sfxp: ubuntu-20.04.deb
gen: DEB
mime: vnd.debian.binary-package
os: ubuntu-20.04
- name: Windows VS2019 zip
sfxg: win64.zip
sfxp: windows-vs2019.zip
gen: ZIP
mime: zip
os: windows-2019
cxx: vs2019
- name: MacOSX sh
sfxg: apple64.sh
sfxp: macosx-xcode.sh
gen: STGZ
mime: x-sh
os: macos-13
cxx: xcode
steps:
- name: checkout (action)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Download vars.sh
uses: actions/download-artifact@v4
with:
name: vars.sh
path: ./
- name: Show vars.sh
run: cat vars.sh
- name: Source vars.sh
run: source vars.sh
- name: Env (common)
run: |
source vars.sh
echo "SRC_TAG=$SRC_TAG" >> $GITHUB_ENV
echo "SRC_VERSION=$SRC_VERSION" >> $GITHUB_ENV
- name: Env (from tag)
if: contains(github.ref, 'tags/v')
run: |
echo "SRC_VERSION_BODY=$SRC_VERSION_BODY" >> $GITHUB_ENV
- name: Variables (from commit, no tag)
if: ${{ !contains(github.ref, 'tags/v') }}
run: echo 'nothing to do'
- name: Verify vars.sh
run: env | grep SRC
- name: install requirements
run: source .github/reqs.sh && c4_install_test_requirements $OS
- name: show info
run: source .github/setenv.sh && c4_show_info
- name: shared64-configure-------------------------------------------------
run: source .github/setenv.sh && c4_cfg_test shared64
- name: shared64-build
run: source .github/setenv.sh && c4_build_target shared64
- name: shared64-pack
run: source .github/setenv.sh && c4_package shared64 $GEN
- name: shared64-normalize
run: |
set -x
source vars.sh
mkdir -p assets
asset_src=`ls -1 ./build/shared64/*-${{matrix.config.sfxg}}`
asset_dst=./assets/${PROJ_PKG_NAME}${SRC_VERSION}-${{matrix.config.sfxp}}
[ ! -f $asset_src ] && exit 1
cp -fav $asset_src $asset_dst
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: assets-${{matrix.config.sfxp}}
path: assets/
python_src:
if: always()
continue-on-error: false
name: python/src
runs-on: ubuntu-latest
steps:
- name: checkout (action)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: install python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: package python src packages
run: |
python --version
pip install -v -r requirements.txt
python setup.py sdist --formats=zip
- name: normalize src package names
run: |
sdist_orig=`find dist -type f -name 'rapidyaml-*.zip'`
[ ! -f $sdist_orig ] && exit 1
sdist=`echo $sdist_orig | sed 's:\.zip:-python_src.zip:'`
mv -fv $sdist_orig $sdist
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: dist-python_src
path: dist/
python_wheels:
if: always()
continue-on-error: false
name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
env:
CMAKE_FLAGS: ${{matrix.config.cmakeflags}} -DRYML_DEV=OFF -DRYML_BUILD_API=ON -DRYML_API_TESTS=OFF -DRYML_API_BENCHMARKS=OFF
CIBW_BUILD: cp${{matrix.config.cibw_pyv}}-${{matrix.config.cibw_platform}}
CIBW_ARCHS: ${{matrix.config.cibw_arch}}
strategy:
fail-fast: false
matrix:
config:
- pythonv: '3.12'
cibw_pyv: 312
cibw_arch: x86_64
cibw_platform: manylinux_x86_64
name: python/3.12/linux/x86_64
sfx: python3.12_linuxx86_64
osname: linux
os: ubuntu-20.04
- pythonv: '3.12'
cibw_pyv: 312
cibw_arch: i686
cibw_platform: manylinux_i686
name: python/3.12/linux/i686
sfx: python3.12_linuxi686
osname: linux
os: ubuntu-20.04
- pythonv: '3.11'
cibw_pyv: 311
cibw_arch: x86_64
cibw_platform: manylinux_x86_64
name: python/3.11/linux/x86_64
sfx: python3.11_linuxx86_64
osname: linux
os: ubuntu-20.04
- pythonv: '3.11'
cibw_pyv: 311
cibw_arch: i686
cibw_platform: manylinux_i686
name: python/3.11/linux/i686
sfx: python3.11_linuxi686
osname: linux
os: ubuntu-20.04
- pythonv: '3.10'
cibw_pyv: 310
cibw_arch: x86_64
cibw_platform: manylinux_x86_64
name: python/3.10/linux/x86_64
sfx: python3.10_linuxx86_64
osname: linux
os: ubuntu-20.04
- pythonv: '3.10'
cibw_pyv: 310
cibw_arch: i686
cibw_platform: manylinux_i686
name: python/3.10/linux/i686
sfx: python3.10_linuxi686
osname: linux
os: ubuntu-20.04
- pythonv: '3.9'
cibw_pyv: 39
cibw_arch: x86_64
cibw_platform: manylinux_x86_64
name: python/3.9/linux/x86_64
sfx: python3.9_linuxx86_64
osname: linux
os: ubuntu-20.04
- pythonv: '3.9'
cibw_pyv: 39
cibw_arch: i686
cibw_platform: manylinux_i686
name: python/3.9/linux/i686
sfx: python3.9_linuxi686
osname: linux
os: ubuntu-20.04
- pythonv: '3.8'
cibw_pyv: 38
cibw_arch: x86_64
cibw_platform: manylinux_x86_64
name: python/3.8/linux/x86_64
sfx: python3.8_linuxx86_64
osname: linux
os: ubuntu-20.04
- pythonv: '3.8'
cibw_pyv: 38
cibw_arch: i686
cibw_platform: manylinux_i686
name: python/3.8/linux/i686
sfx: python3.8_linuxi686
osname: linux
os: ubuntu-20.04
- pythonv: '3.7'
cibw_pyv: 37
cibw_arch: x86_64
cibw_platform: manylinux_x86_64
name: python/3.7/linux/x86_64
sfx: python3.7_linuxx86_64
osname: linux
os: ubuntu-20.04
- pythonv: '3.7'
cibw_pyv: 37
cibw_arch: i686
cibw_platform: manylinux_i686
name: python/3.7/linux/i686
sfx: python3.7_linuxi686
osname: linux
os: ubuntu-20.04
- pythonv: '3.6'
cibw_pyv: 36
cibw_arch: x86_64
cibw_platform: manylinux_x86_64
name: python/3.6/linux/x86_64
sfx: python3.6_linuxx86_64
osname: linux
os: ubuntu-20.04
- pythonv: '3.6'
cibw_pyv: 36
cibw_arch: i686
cibw_platform: manylinux_i686
name: python/3.6/linux/i686
sfx: python3.6_linuxi686
osname: linux
os: ubuntu-20.04
steps:
- name: checkout (action)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: create wheel
uses: pypa/[email protected]
- name: rename wheelhouse -> dist
run: mv -fv wheelhouse dist
- name: Verify artifacts
run: ls -lFhp dist/
- name: Save artifacts for publishing to PyPI
uses: actions/upload-artifact@v4
with:
name: dist-${{matrix.config.sfx}}
path: dist/
- name: install python ${{matrix.config.pythonv}}
uses: actions/setup-python@v5
with:
python-version: ${{matrix.config.pythonv}}
- name: test with python ${{matrix.config.pythonv}}
run: |
set -x
echo "python ${{matrix.config.pythonv}} ${{matrix.config.py_arch}} ${{matrix.config.cibw_arch}}"
# skip 32 bit tests, as Python 32 bits are not available in ubuntu
arch="${{matrix.config.cibw_arch}}"
if [ "$arch" == "x86" ] || [ "$arch" == "i686" ] ; then
exit 0
fi
python --version
python -c 'import sys ; import struct ; print("python:", sys.version, struct.calcsize("P") * 8, "bits")'
pip --version
pip install -v -r requirements.txt
pip install -v -r api/python/requirements.txt
for whl in dist/* ; do
pip install -v $whl
pip show -f rapidyaml
python -c 'import ryml ; print("ryml", ryml.version, ryml.version_tuple)'
python -c 'import ryml ; tree = ryml.parse_in_arena(b"{foo: bar}") ; assert tree.key(1) == b"foo" ; assert tree.val(1) == b"bar" ; print(str(tree.key(1), "utf8")) ; print(str(tree.val(1), "utf8"))'
python -m pytest -vvv api/python/tests
pip uninstall -y -v rapidyaml
done
merge_artifacts:
if: always()
continue-on-error: false
runs-on: ubuntu-latest
needs:
- src
- cpp
- python_src
- python_wheels
steps:
- name: Merge assets artifacts
uses: actions/upload-artifact/merge@v4
with:
name: assets
pattern: assets-*
separate-directories: true
delete-merged: true
- name: Merge dist artifacts
uses: actions/upload-artifact/merge@v4
with:
name: dist
pattern: dist-*
separate-directories: true
delete-merged: true
release:
if: always()
continue-on-error: false
runs-on: ubuntu-latest
needs:
- merge_artifacts
steps:
- name: checkout (action)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Download vars.sh
uses: actions/download-artifact@v4
with:
name: vars.sh
path: ./
- name: Show vars.sh
run: cat vars.sh
- name: Source vars.sh
run: source vars.sh
- name: Env (common)
run: |
source vars.sh
echo "SRC_TAG=$SRC_TAG" >> $GITHUB_ENV
echo "SRC_VERSION=$SRC_VERSION" >> $GITHUB_ENV
- name: Env (from tag)
if: contains(github.ref, 'tags/v')
run: |
echo "SRC_VERSION_BODY=$SRC_VERSION_BODY" >> $GITHUB_ENV
- name: Variables (from commit, no tag)
if: ${{ !contains(github.ref, 'tags/v') }}
run: echo 'nothing to do'
- name: Verify vars.sh
run: env | grep SRC
- name: Verify existing artifacts
run: |
ls -lFhp .
ls -lFhp assets*/ dist*/ || echo 'none found'
- name: Gather artifacts - ./assets
uses: actions/download-artifact@v4
with:
pattern: assets
- name: Gather artifacts - ./dist
uses: actions/download-artifact@v4
with:
pattern: dist
- name: Verify existing artifacts
run: |
ls -lFhp .
ls -lFhp assets*/ dist*/ || echo 'none found'
- name: Move Python packages to assets folder
if: contains(github.ref, 'tags/v')
run: mv -fv dist/*src.zip assets/.
- name: Create Github Release
if: contains(github.ref, 'tags/v')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: Release ${{steps.vars.outputs.SRC_VERSION}}
body_path: ${{steps.vars.outputs.SRC_VERSION_BODY}}
draft: true
prerelease: ${{contains(github.ref, 'rc')}}
- name: Upload assets to Github Release
if: contains(github.ref, 'tags/v')
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
release_id: ${{steps.create_release.outputs.id}}
assets_path: ./assets/
- name: Publish python packages to test PyPI
uses: pypa/[email protected]
with:
repository_url: https://test.pypi.org/legacy/
user: __token__
password: ${{secrets.PYPI_TOKEN_TEST}}
verbose: true
skip_existing: true
- name: Publish python packages to production PyPI
if: contains(github.ref, 'tags/v')
uses: pypa/[email protected]
with:
user: __token__
password: ${{secrets.PYPI_TOKEN}}
verbose: true