-
-
Notifications
You must be signed in to change notification settings - Fork 363
1083 lines (1057 loc) · 47.8 KB
/
ci.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
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: CI
on:
push:
branches:
- "master"
- "dev"
- "stable"
- "container-*"
tags:
- v*
schedule:
- cron: "0 18 * * 1,3,5" # Three-weekly at 18:00 UTC on Monday, Wednesday, and Friday
pull_request:
branches:
- master
- dev
- stable
- "release-*"
# Automatically cancel any previous workflow on new push.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-22.04
outputs:
edited: ${{ steps.filter.outputs.edited }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: |
edited:
- '**.c'
- '**.h'
- '**.in'
- '**.inc'
- '**/meson.build'
- 'subprojects/**'
- '.github/workflows/ci.yml'
- 'test/**'
build-and-test:
needs: changes
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow_failure }}
timeout-minutes: ${{ matrix.timeout }}
strategy:
fail-fast: false
matrix:
name:
[
linux-meson-clang-tests,
linux-meson-gcc-tests,
macos-meson-clang-tests,
linux-gcc-tests-asan,
linux-clang-tests-asan,
linux-gcc-tests-codecov,
capstone-v4,
capstone-v5,
]
include:
- name: linux-meson-clang-tests
os: ubuntu-22.04
build_system: meson
compiler: clang
run_tests: true
meson_options: -Dbuildtype=release --werror
enabled: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'clang')) && needs.changes.outputs.edited == 'true' }}
timeout: 45
allow_failure: false
- name: linux-meson-gcc-tests
os: ubuntu-22.04
build_system: meson
compiler: gcc
run_tests: true
meson_options: -Dbuildtype=release --werror
enabled: ${{ needs.changes.outputs.edited == 'true' }}
timeout: 45
cflags: -DRZ_ASSERT_STDOUT=1
allow_failure: false
- name: macos-meson-clang-tests
os: macos-13
build_system: meson
compiler: clang
run_tests: true
meson_options: -Dbuildtype=release --werror
enabled: ${{ needs.changes.outputs.edited == 'true' }}
timeout: 60
allow_failure: false
- name: linux-gcc-tests-asan
os: ubuntu-22.04
build_system: meson
compiler: gcc-12
cflags: "-DRZ_ASSERT_STDOUT=1 -ftrivial-auto-var-init=pattern -funsigned-char"
meson_options: -Dbuildtype=debugoptimized -Db_sanitize=address,undefined --werror
asan: true
asan_options: "detect_leaks=0,detect_odr_violation=0,allocator_may_return_null=1"
run_tests: true
enabled: ${{ needs.changes.outputs.edited == 'true' }}
timeout: 120
allow_failure: false
- name: linux-clang-tests-asan
os: ubuntu-22.04
build_system: meson
compiler: clang
cflags: -DRZ_ASSERT_STDOUT=1
meson_options: -Dbuildtype=debugoptimized -Db_lundef=false -Db_sanitize=address,undefined --werror
asan: true
asan_options: "detect_leaks=0,detect_odr_violation=0,allocator_may_return_null=1"
run_tests: true
enabled: ${{ needs.changes.outputs.edited == 'true' }}
timeout: 115
allow_failure: false
- name: linux-gcc-tests-codecov
os: ubuntu-22.04
build_system: meson
compiler: gcc
run_tests: true
meson_options: -Dbuildtype=debug -Db_coverage=true --werror
coverage: true
enabled: ${{ github.event_name != 'pull_request' && needs.changes.outputs.edited == 'true' }}
timeout: 60
allow_failure: false
- name: capstone-sys
os: ubuntu-22.04
build_system: meson
compiler: gcc
meson_options: -Dbuildtype=release -Duse_sys_capstone=enabled --werror
run_tests: false
enabled: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'capstone')) && needs.changes.outputs.edited == 'true' }}
timeout: 45
allow_failure: false
- name: capstone-v4
os: ubuntu-22.04
build_system: meson
compiler: gcc
meson_options: -Dbuildtype=release -Duse_capstone_version=v4 --werror
run_tests: false
enabled: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'capstone')) && needs.changes.outputs.edited == 'true' }}
timeout: 45
allow_failure: true
- name: capstone-v5
os: ubuntu-22.04
build_system: meson
compiler: gcc
meson_options: -Dbuildtype=release -Duse_capstone_version=v5 --werror
run_tests: false
enabled: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'capstone')) && needs.changes.outputs.edited == 'true' }}
timeout: 45
allow_failure: true
- name: no-gpl-code
os: ubuntu-22.04
build_system: meson
compiler: gcc
meson_options: -Dbuildtype=release -Duse_gpl=false --werror
run_tests: false
enabled: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'gpl')) && needs.changes.outputs.edited == 'true' }}
timeout: 45
allow_failure: false
steps:
- name: Show available memory on Linux
if: contains(matrix.os, 'macos') != true && matrix.enabled
run: free -h
- uses: actions/checkout@v4
if: matrix.enabled
with:
fetch-depth: 2
- name: Install python and other dependencies
if: (matrix.run_tests || matrix.build_system == 'meson') && contains(matrix.os, 'macos') != true && matrix.enabled
run: sudo apt-get --assume-yes install python3-wheel python3-setuptools libcapstone4 libcapstone-dev
- name: Install meson and ninja
if: matrix.build_system == 'meson' && matrix.enabled
run: pip3 install --user meson ninja PyYAML
- name: Checkout rzpipe
if: matrix.enabled
uses: actions/checkout@v4
with:
repository: rizinorg/rz-pipe
path: test/rz-pipe
- name: Install test dependencies
if: matrix.run_tests && matrix.enabled
run: pip3 install --user "file://$GITHUB_WORKSPACE/test/rz-pipe#egg=rzpipe&subdirectory=python" requests
- name: Install Linux test dependencies
if: matrix.run_tests && matrix.enabled && contains(matrix.os, 'macos') != true
run: |
sudo apt-get update
sudo apt-get --assume-yes install libc6 libc6-i386 libc6-dev debuginfod
- name: Install gdbserver dependency
if: matrix.run_tests && matrix.enabled && matrix.os == 'ubuntu-22.04'
run: sudo apt-get --assume-yes install gdbserver
- name: Install clang
if: matrix.compiler == 'clang' && matrix.os == 'ubuntu-22.04' && matrix.enabled
run: sudo apt-get --assume-yes install clang
- name: Install gcc-12
if: matrix.compiler == 'gcc-12' && matrix.os == 'ubuntu-22.04' && matrix.enabled
run: sudo apt-get --assume-yes install gcc-12
- name: Build with Meson
if: matrix.build_system == 'meson' && matrix.enabled
run: |
export PATH=$(python3 -m site --user-base)/bin:${HOME}/.local/bin:${PATH}
if [ "$ASAN" == "true" ]; then
# Work-around ASAN bug https://github.com/google/sanitizers/issues/1716
sudo sysctl vm.mmap_rnd_bits=28
export CFLAGS="-DASAN=1 ${CFLAGS}"
if [ "$CC" == "clang" ]; then
export LD_LIBRARY_PATH=$(dirname $(clang -print-file-name=libclang_rt.asan-x86_64.so)):${LD_LIBRARY_PATH}
fi
fi
meson setup --prefix=${HOME} ${{ matrix.meson_options }} build && ninja -C build
env:
ASAN: ${{ matrix.asan }}
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
- name: Install with meson
if: matrix.build_system == 'meson' && matrix.enabled
run: |
# Install the rizin
export PATH=${HOME}/bin:$(python3 -m site --user-base)/bin:${HOME}/.local/bin:${PATH}
export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}
ninja -C build install
- name: Disable user authentication for debugging (macOS)
if: contains(matrix.os, 'macos') && matrix.enabled
run: |
sudo security authorizationdb write system.privilege.taskport allow
- name: Run unit tests (meson)
continue-on-error: ${{ matrix.allow_failure }}
if: matrix.build_system == 'meson' && matrix.enabled
run: |
export PATH=${HOME}/bin:$(python3 -m site --user-base)/bin:${HOME}/.local/bin:${PATH}
export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}
if [ "$ASAN" == "true" ]; then
# Work-aroud ASAN bug https://github.com/google/sanitizers/issues/1716
sudo sysctl vm.mmap_rnd_bits=28
if [ "$CC" == "clang" ]; then
export ASAN_LD_PRELOAD=$(clang -print-file-name=libclang_rt.asan-x86_64.so)
export LD_LIBRARY_PATH=$(dirname $(clang -print-file-name=libclang_rt.asan-x86_64.so)):${LD_LIBRARY_PATH}
else
export ASAN_LD_PRELOAD=$(${CC} -print-file-name=libasan.so)
fi
fi
meson test -C build --suite unit
env:
ASAN: ${{ matrix.asan }}
ASAN_OPTIONS: ${{ matrix.asan_options }}
CC: ${{ matrix.compiler }}
- name: Checkout our Testsuite Binaries
if: matrix.enabled
uses: actions/checkout@v4
with:
repository: rizinorg/rizin-testbins
path: test/bins
- name: Checkout fuzz targets # TODO: this can be removed as soon as the fuzztargets repo is public
if: matrix.run_tests && matrix.enabled && (github.event_name != 'pull_request' || contains(github.event.pull_request.head.ref, 'fuzz'))
uses: actions/checkout@v4
with:
repository: rizinorg/rizin-fuzztargets
path: test/fuzz/targets
- name: Run integration tests and rz-test
if: matrix.run_tests && matrix.enabled
run: |
# Running the test suite
export PATH=${HOME}/bin:$(python3 -m site --user-base)/bin:${HOME}/.local/bin:${PATH}
export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}
if [ "$ASAN" == "true" ]; then
# Work-aroud ASAN bug https://github.com/google/sanitizers/issues/1716
sudo sysctl vm.mmap_rnd_bits=28
if [ "$CC" == "clang" ]; then
export ASAN_LD_PRELOAD=$(clang -print-file-name=libclang_rt.asan-x86_64.so)
export LD_LIBRARY_PATH=$(dirname $(clang -print-file-name=libclang_rt.asan-x86_64.so)):${LD_LIBRARY_PATH}
else
export ASAN_LD_PRELOAD=$(${CC} -print-file-name=libasan.so)
fi
fi
meson test -C build --suite integration
cd test
if [ "$RUNNER_OS" == "macOS" ]; then
rz-test -j `sysctl -n hw.activecpu` -L -o results.json
else
rz-test -L -o results.json
fi
env:
ASAN: ${{ matrix.asan }}
ASAN_OPTIONS: ${{ matrix.asan_options }}
CC: ${{ matrix.compiler }}
- name: Upload coverage info
if: matrix.coverage == '1' && matrix.enabled
working-directory: build
run: bash <(curl -s https://codecov.io/bash) -Q github-action -n -F
- name: Run fuzz tests
if: matrix.run_tests && matrix.enabled && (github.event_name != 'pull_request' || contains(github.event.pull_request.head.ref, 'fuzz'))
run: |
export PATH=${HOME}/bin:${HOME}/.local/bin:${PATH}
export LD_LIBRARY_PATH=${HOME}/lib/$(uname -m)-linux-gnu:${HOME}/lib:${HOME}/lib64:${LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig:${HOME}/lib/$(uname -m)-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}
if [ "$ASAN" == "true" ] && [ "$CC" == "clang" ]; then
# Work-aroud ASAN bug https://github.com/google/sanitizers/issues/1716
sudo sysctl vm.mmap_rnd_bits=28
export LD_LIBRARY_PATH=$(dirname $(clang -print-file-name=libclang_rt.asan-x86_64.so)):${LD_LIBRARY_PATH}
fi
cd test
rz-test -LF bins/fuzzed @fuzz
# some fuzzed bins are mem hungry and are killed by the runner.
# running them one threaded allows to be check them
rz-test -j1 -LF bins/fuzzed-memhungry @fuzz
env:
ASAN: ${{ matrix.asan }}
ASAN_OPTIONS: ${{ matrix.asan_options }}
CC: ${{ matrix.compiler }}
- name: Upload test results
if: always() && matrix.run_tests && matrix.enabled
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.name }}
path: test/results.json
build-centos7:
name: Build on CentOS 7
runs-on: ubuntu-22.04
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'centos') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable' || github.event_name == 'schedule'
container: centos:7
steps:
- name: Fix mirrors list
run: |
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- name: Install tools
run: yum install -y patch unzip git gcc make python3-pip
# Pin Meson to the last version stil supporting Python 3.6
- name: Install meson and ninja
run: pip3 install meson==0.61.5 ninja PyYAML requests
- name: Checkout rizin
run: |
git clone https://github.com/${{ github.repository }}
cd rizin
git fetch origin ${{ github.ref }}
git checkout -b local_branch FETCH_HEAD
- name: Checkout our Testsuite Binaries
run: git clone https://github.com/rizinorg/rizin-testbins test/bins
working-directory: rizin
- name: Build
run: meson setup --prefix=/usr build && ninja -C build
working-directory: rizin
- name: Install
run: ninja -C build install
working-directory: rizin
- name: Run unit tests
run: ninja -C build test
working-directory: rizin
- name: Run tests
run: |
rz-test -e db/archos -e db/cmd/cmd_pipe -L -o results.json
working-directory: rizin/test
build-debian:
name: Build on old Debian ${{ matrix.container }}
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'debian') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable' || github.event_name == 'schedule'
strategy:
matrix:
container:
- debian:wheezy
- debian:jessie
- debian:stretch
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
steps:
- name: Fix containers (Wheezy)
if: matrix.container == 'debian:wheezy'
run: |
echo "deb http://archive.debian.org/debian wheezy main" > /etc/apt/sources.list
echo "deb http://archive.debian.org/debian-security wheezy/updates main" >> /etc/apt/sources.list
echo "Acquire::Check-Valid-Until no;" > /etc/apt/apt.conf.d/99no-check-valid-until
- name: Fix containers (Jessie)
if: matrix.container == 'debian:jessie'
run: |
echo "deb http://archive.debian.org/debian jessie main" > /etc/apt/sources.list
echo "deb http://archive.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list
echo "Acquire::Check-Valid-Until no;" > /etc/apt/apt.conf.d/99no-check-valid-until
- name: Fix containers (Stretch)
if: matrix.container == 'debian:stretch'
run: |
echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list
echo "Acquire::Check-Valid-Until no;" > /etc/apt/apt.conf.d/99no-check-valid-until
- name: Install tools
run: apt-get update --yes --force-yes && apt-get install --yes --force-yes patch unzip git gcc make curl pkg-config libc6-i386 build-essential
- name: Install Python source build dependencies
run: apt-get install --yes --force-yes checkinstall libbz2-dev libc6-dev libgdbm-dev libncursesw5-dev libreadline-gplv2-dev libssl-dev libsqlite3-dev libffi-dev tk-dev
- name: Install Python from source
run: |
curl -o Python-${PYVERSION}.tgz https://www.python.org/ftp/python/${PYVERSION}/Python-${PYVERSION}.tgz
tar -zxvf Python-${PYVERSION}.tgz
cd Python-${PYVERSION}/
./configure
make install
env:
PYVERSION: 3.6.15
# Pin Meson to the last version stil supporting Python 3.6
- name: Install Meson and Ninja
run: |
mkdir ${HOME}/.cache
chmod +w ${HOME}/.cache
python3 -m pip install ${TRUSTED} --upgrade pip setuptools
python3 -m pip install ${TRUSTED} meson==0.61.5 ninja PyYAML
env:
TRUSTED: --trusted-host=pypi.org --trusted-host=files.pythonhosted.org
- name: Checkout rizin
run: |
git clone https://github.com/${{ github.repository }}
cd rizin
git fetch origin ${{ github.ref }}
git checkout -b local_branch FETCH_HEAD
- name: Checkout our Testsuite Binaries
run: git clone https://github.com/rizinorg/rizin-testbins test/bins
working-directory: rizin
# Old Debian git doesn't recognize this directive
- name: Workaround to disable git depth
run: find subprojects -name '*.wrap' | xargs sed -i '/^depth = 1$/d'
working-directory: rizin
- name: Build with Meson + Ninja
run: meson setup --prefix=/usr build && ninja -C build
working-directory: rizin
- name: Install with Ninja
run: ninja -C build install
working-directory: rizin
- name: Run unit tests
run: ninja -C build test
working-directory: rizin
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
- name: Install test dependencies
run: python3 -m pip install --user 'git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python' requests
- name: Run tests
# Debug tests fail on old Debian because of the runtime differences, ignore them
run: |
rz-test -e db/archos -e db/cmd/cmd_pipe -L -o results.json
working-directory: rizin/test
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
build-gcc11-asan:
name: Build on gcc 11 ASAN
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'gcc11') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable' || github.event_name == 'schedule'
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
- name: Install tools
run: sudo apt-get update && sudo apt-get install --yes patch unzip git gcc make curl pkg-config libc6-i386 build-essential
- name: Install python and other dependencies
run: sudo apt-get install --yes python3-wheel python3-setuptools python3-pip
- name: Install meson and ninja
run: sudo pip3 install meson ninja PyYAML
- name: Install test dependencies
run: |
sudo pip3 install 'git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python' requests
sudo apt-get install --yes tzdata debuginfod
- name: Checkout rizin
run: |
git clone https://github.com/${{ github.repository }}
cd rizin
git fetch origin ${{ github.ref }}
git checkout -b local_branch FETCH_HEAD
- name: Checkout our Testsuite Binaries
run: git clone https://github.com/rizinorg/rizin-testbins test/bins
working-directory: rizin
- name: Build with Meson + Ninja
run: meson setup --prefix=/usr -Dbuildtype=debugoptimized -Db_sanitize=address,undefined --werror build && ninja -C build
working-directory: rizin
env:
CFLAGS: -DASAN=1 -DRZ_ASSERT_STDOUT=1
- name: Install with Ninja
run: sudo ninja -C build install
working-directory: rizin
- name: Run unit tests
run: ASAN_LD_PRELOAD=$(gcc -print-file-name=libasan.so) meson test -C build --suite unit
working-directory: rizin
env:
ASAN: true
ASAN_OPTIONS: detect_leaks=0,detect_odr_violation=0,allocator_may_return_null=1
- name: Run integration tests and rz-test
run: |
export ASAN_LD_PRELOAD=$(gcc -print-file-name=libasan.so)
meson test -C build --suite integration
cd test
rz-test -L -o results.json
working-directory: rizin
env:
ASAN: true
ASAN_OPTIONS: detect_leaks=0,detect_odr_violation=0,allocator_may_return_null=1
- name: Run fuzz tests
run: |
rz-test -LF bins/fuzzed @fuzz
# some fuzzed bins are mem hungry and are killed by the runner.
# running them one threaded allows to be check them
rz-test -j1 -LF bins/fuzzed-memhungry @fuzz
working-directory: rizin/test
env:
ASAN: true
ASAN_OPTIONS: detect_leaks=0,detect_odr_violation=0,allocator_may_return_null=1
test-ubuntu-focal-debug:
name: Run debug tests on Ubuntu 20.04
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'debug') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable' || github.event_name == 'schedule'
runs-on: ubuntu-20.04
timeout-minutes: 45
steps:
- name: Install meson and ninja
run: sudo pip3 install meson ninja
- name: Install test dependency
run: sudo pip3 install 'git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python'
- name: Checkout rizin
run: |
git clone https://github.com/${{ github.repository }}
cd rizin
git fetch origin ${{ github.ref }}
git checkout -b local_branch FETCH_HEAD
- name: Checkout our Testsuite Binaries
run: git clone https://github.com/rizinorg/rizin-testbins test/bins
working-directory: rizin
- name: Build with Meson + Ninja
run: meson setup --prefix=/usr -Dbuildtype=release --werror build && ninja -C build
working-directory: rizin
- name: Install with Ninja
run: sudo ninja -C build install
working-directory: rizin
- name: Run debug tests
run: |
cd test
rz-test -L -e db/archos/linux-x64/debuginfod -e db/archos/linux-x64/dbg_dmh -o results.json db/archos/linux-x64
working-directory: rizin
build-static:
name: Build static
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'static') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable' || github.event_name == 'schedule'
runs-on: ubuntu-22.04
container:
image: alpine:3.19
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined
steps:
- name: Install dependencies
run: apk add --no-cache git gcc g++ linux-headers cmake curl wget unzip py3-wheel py3-setuptools py3-pip meson ninja xz py3-requests
- name: Checkout rizin
run: |
git clone https://github.com/${{ github.repository }}
cd rizin
git fetch origin ${{ github.ref }}
git checkout -b local_branch FETCH_HEAD
- name: Checkout our Testsuite Binaries
run: git clone https://github.com/rizinorg/rizin-testbins test/bins
working-directory: rizin
- name: Compile with meson
run: |
mkdir -p ${HOME}/rizin-static
meson setup --prefix=${HOME}/rizin-static --buildtype release --default-library static -Dinstall_sigdb=true -Dstatic_runtime=true -Dportable=true build
ninja -C build && ninja -C build install
tar -C ${HOME}/rizin-static --xz -cf rizin-static.tar.xz $(ls ${HOME}/rizin-static)
working-directory: rizin
- name: Run unit tests
run: |
export PATH=${HOME}/rizin-static/bin:${PATH}
ninja -C build test
working-directory: rizin
- name: Run tests
run: |
export PATH=${HOME}/rizin-static/bin:${PATH}
rizin -v
rz-test -v
cd test
rz-test -e db/archos -e db/cmd/cmd_pipe -L -o results.json
working-directory: rizin
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-static
path: rizin/test/results.json
- name: Upload static build
uses: actions/upload-artifact@v4
with:
name: rizin-static.tar.xz
path: rizin/rizin-static.tar.xz
create-tarball:
name: Create source tarball
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'extras') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable'
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- name: Install python and other dependencies
run: sudo apt-get --assume-yes install python3-wheel python3-setuptools python3-pip
- name: Install meson and ninja
run: pip3 install --user meson ninja PyYAML
- uses: actions/checkout@v4
- name: Extract rizin version
run: echo "version=$(python sys/version.py)" >> $GITHUB_OUTPUT
id: extract_version
- name: Create archive
run: |
export PATH=${HOME}/.local/bin:${PATH}
meson setup build
cd build
meson dist --include-subprojects --no-tests
ls -l meson-dist
mv meson-dist/rizin-${{ steps.extract_version.outputs.version }}.tar.xz meson-dist/rizin-src.tar.xz
- uses: actions/upload-artifact@v4
with:
name: rizin-src.tar.xz
path: build/meson-dist/rizin-src.tar.xz
test-tarball:
name: Test source tarball
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'extras') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable'
runs-on: ubuntu-22.04
needs: [ create-tarball ]
steps:
- name: Install python and other dependencies
run: sudo apt-get --assume-yes install python3-wheel python3-setuptools python3-pip
- name: Install meson and ninja
run: sudo pip3 install meson ninja PyYAML
- uses: actions/download-artifact@v4
with:
name: rizin-src.tar.xz
- name: Extract source tarball
run: |
mkdir rizin && pwd && ls -l
tar -C rizin --strip-components=1 -xvf rizin-src.tar.xz
- name: Install rizin
run: |
export PATH=${HOME}/bin:${HOME}/Library/Python/3.9/bin:${HOME}/Library/Python/3.10/bin:${HOME}/Library/Python/3.11/bin:${HOME}/.local/bin:${PATH}
meson setup --prefix=/usr --buildtype=release build && ninja -C build && sudo ninja -C build install
working-directory: rizin
- name: Check that installed rizin runs
run: rizin -qcq /bin/ls
- name: Check that libraries can be used with pkg-config
run: |
echo -e "#include <rz_util.h>\nint main(int argc, char **argv) { return rz_str_newf (\"%s\", argv[0]) != NULL? 0: 1; }" > test.c
clang -o test test.c $(pkg-config --libs --cflags rz_util)
./test
- name: Check CMake config files
run: |
cd .github/cmake_test
mkdir build && cd build
cmake ..
make
./rizin_cmake_test
working-directory: rizin
build-osx-pkg:
name: Build OSX package
runs-on: macos-13
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'osx') || contains(github.head_ref, 'mac') || ((contains(github.ref, 'release-') || github.ref == 'refs/heads/stable') && github.event_name == 'push') || github.event_name == 'schedule'
needs: [ build-and-test ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install meson and ninja
run: pip3 install meson ninja PyYAML
- name: Install ImageMagick
run: brew install imagemagick
- name: Create OSX package
run: |
./dist/osx/build_osx_package.sh
mv rizin-*.pkg rizin.pkg
- name: Upload .pkg file
uses: actions/upload-artifact@v4
with:
name: rizin.pkg
path: ./rizin.pkg
build-windows:
name: Build Windows zip/installer ${{ matrix.name }}
runs-on: windows-latest
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'windows') || (github.event_name == 'push' && (contains(github.ref, 'release-') || github.ref == 'refs/heads/stable'))
needs: [ build-and-test ]
strategy:
fail-fast: false
matrix:
name: [ vs2019_static, clang_cl, clang_cl_x86 ]
include:
- name: vs2019_static
compiler: cl
meson_options: --default-library=static -Db_vscrt=static_from_buildtype -Dportable=true
bits: 64
- name: clang_cl
compiler: clang-cl
meson_options: --default-library=shared -Dportable=true
bits: 64
- name: clang_cl_x86
compiler: clang-cl
meson_options: --default-library=shared -Dportable=true
bits: 32
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install meson ninja PyYAML
- name: Extract rizin version
shell: pwsh
run: echo "branch=$(python sys/version.py)" >> $Env:GITHUB_OUTPUT
id: extract_version
- name: Build and create zip/installer
shell: pwsh
run: .\dist\windows\build_windows_installer.ps1 ${{ matrix.name }} ${{ matrix.bits }} ${{ matrix.meson_options }}
- uses: actions/upload-artifact@v4
with:
name: rizin-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip
path: .\dist\windows\Output\rizin-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}.zip
- uses: actions/upload-artifact@v4
with:
name: rizin_installer-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}
path: .\dist\windows\Output\rizin.exe
build-android:
name: Build Android ${{ matrix.name }} package
runs-on: ubuntu-22.04
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'android') || ((contains(github.ref, 'release-') || github.ref == 'refs/heads/stable') && github.event_name == 'push') || github.event_name == 'schedule'
needs: [ build-and-test ]
strategy:
fail-fast: false
matrix:
name: [ x86_64, arm, aarch64 ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get --assume-yes install pax wget unzip python3-wheel python3-setuptools python3-pip && pip3 install --user meson ninja
- name: Compile with meson
run: |
export PATH=${HOME}/.local/bin:${PATH}
sed -i 's@\${ANDROID_NDK}@'"${ANDROID_NDK}"'@' .github/meson-android-${{ matrix.name }}.ini
meson setup --buildtype release --default-library static --prefix=/tmp/android-dir -Dportable=true -Dblob=true -Dstatic_runtime=true build --cross-file .github/meson-android-${{ matrix.name }}.ini
ninja -C build && ninja -C build install
- name: Create rizin-android-${{ matrix.name }}.tar.gz
run: |
cd /tmp
rm -rf android-dir/include android-dir/lib
tar --transform 's/android-dir/data\/data\/org.rizinorg.rizininstaller/g' -cvzf rizin-android-${{ matrix.name }}.tar.gz android-dir/
- uses: actions/upload-artifact@v4
with:
name: rizin-android-${{ matrix.name }}
path: /tmp/rizin-android-${{ matrix.name }}.tar.gz
build-cpp-linux:
name: Include Rizin headers from C++ program (Linux)
runs-on: ubuntu-22.04
if: contains(github.head_ref, 'dist') || contains(github.head_ref, 'cpp') || ((contains(github.ref, 'release-') || github.ref == 'refs/heads/stable') && github.event_name == 'push') || github.event_name == 'schedule'
needs: [ build-and-test ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get --assume-yes install pax wget unzip python3-wheel python3-setuptools python3-pip
- name: Install meson and ninja
run: sudo pip3 install meson ninja PyYAML
- name: Compile & Install Rizin
run: |
export PATH=${HOME}/bin:${HOME}/Library/Python/3.9/bin:${HOME}/Library/Python/3.10/bin:${HOME}/Library/Python/3.11/bin:${HOME}/.local/bin:${PATH}
meson setup --buildtype release --prefix=/usr build
ninja -C build && sudo ninja -C build install
- name: Compile C++ test
run: |
export PATH=${HOME}/bin:${HOME}/Library/Python/3.9/bin:${HOME}/Library/Python/3.10/bin:${HOME}/Library/Python/3.11/bin:${HOME}/.local/bin:${PATH}
meson setup --prefix=/usr build-cpp-test ./test/unit/cpp
meson compile -C build-cpp-test
- name: Run C++ test
run: |
export PATH=${HOME}/bin:${HOME}/Library/Python/3.9/bin:${HOME}/Library/Python/3.10/bin:${HOME}/Library/Python/3.11/bin:${HOME}/.local/bin:${PATH}
meson test -C build-cpp-test --print-errorlogs
test-extra-prefix:
name: Test EXTRA_PREFIX works well
runs-on: ubuntu-22.04
if: contains(github.head_ref, 'dist') || ((contains(github.ref, 'release-') || github.ref == 'refs/heads/stable') && github.event_name == 'push') || github.event_name == 'schedule'
needs: [ build-and-test ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get --assume-yes install pax wget unzip python3-wheel python3-setuptools python3-pip
- name: Install meson and ninja
run: sudo pip3 install meson ninja PyYAML
- name: Compile & Install Rizin
run: |
export PATH=${HOME}/bin:${HOME}/Library/Python/3.9/bin:${HOME}/Library/Python/3.10/bin:${HOME}/Library/Python/3.11/bin:${HOME}/.local/bin:${PATH}
meson --buildtype release --prefix=/usr -Dextra_prefix=/usr/local build
ninja -C build && sudo ninja -C build install
- name: Compile jsdec in EXTRA_PREFIX
run: |
if ${{ (contains(github.ref, 'release-') || github.ref == 'refs/heads/stable') }} ; then
git clone --depth 1 --branch master https://github.com/rizinorg/jsdec
cd jsdec && meson -Dstandalone=false --prefix=/usr/local build && meson compile -C build && sudo meson install -C build
else
git clone --depth 1 --branch dev https://github.com/rizinorg/jsdec
cd jsdec && meson -Dbuild_type=rizin --prefix=/usr/local build && meson compile -C build && sudo meson install -C build
fi
- name: Test jsdec plugin is loaded from EXTRA_PREFIX
run: |
rizin -qc "Lc~jsdec"
build-rzpipe:
name: Build rizin rzpipe
if: contains(github.head_ref, 'dist') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable' || github.event_name == 'schedule'
needs: [ test-tarball ]
runs-on: ubuntu-22.04
env:
RZPIPE_TESTS: "rz-pipe-py rz-pipe-go"
steps:
- uses: actions/download-artifact@v4
with:
name: rizin-src.tar.xz
- name: Extract source tarball
run: |
mkdir rizin && pwd && ls -l
tar -C rizin --strip-components=1 -xvf rizin-src.tar.xz
- name: Install dependencies
run: sudo apt-get --assume-yes install wget unzip python3-wheel python3-setuptools build-essential python3-pip && sudo pip3 install meson ninja
- name: Install rizin
run: |
export PATH=$PATH:/usr/local/bin
meson setup --prefix=/usr --buildtype=release build && ninja -C build && sudo ninja -C build install
working-directory: rizin
- name: Install rz-pipe-py
run: |
pip install -U rzpipe
- name: Install rz-pipe-go
run: |
go install github.com/rizinorg/rz-pipe/go/example@latest
build-bindgen:
name: Build rz-bindgen
if: contains(github.head_ref, 'dist') || contains(github.ref, 'release-') || github.ref == 'refs/heads/stable' || github.event_name == 'schedule'
needs: [ test-tarball ]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
name: rizin-src.tar.xz
- name: Extract source tarball
run: |
mkdir rizin && pwd && ls -l
tar -C rizin --strip-components=1 -xvf rizin-src.tar.xz
- name: Install dependencies
run: |
sudo apt update
sudo apt-get --assume-yes install cmake swig pkg-config clang libclang-dev llvm wget unzip python3-wheel python3-setuptools build-essential python3-pip && sudo pip3 install meson ninja
- name: Install rizin
run: |
export PATH=$PATH:/usr/local/bin
meson setup --prefix=/usr --buildtype=release build && ninja -C build && sudo ninja -C build install
working-directory: rizin
- name: Checkout rz-bindgen
uses: actions/checkout@v4
with:
repository: rizinorg/rz-bindgen
path: rz-bindgen
- name: Build rz-bindgen
run: |
meson setup --prefix=/usr -Dplugin=enabled build
meson compile -C build
sudo meson install -C build
working-directory: rz-bindgen
- name: Test python lang plugin
run: rizin -qc "Ll" | grep "Python SWIG"
- name: Test rizin.py
run: |
echo "import rizin" > testimport.py
python3 testimport.py
test-osx-pkg:
name: Test OSX pkg
strategy:
matrix:
system:
- macos-13
runs-on: ${{ matrix.system }}
needs: [ build-osx-pkg ]
steps:
- uses: actions/download-artifact@v4
with:
name: rizin.pkg
path: ./
- name: Install rizin.pkg
run: sudo installer -pkg ./rizin.pkg -target /
- name: Check that installed rizin runs
run: rizin -qcq /bin/ls
- name: Check that libraries can be used
run: |
echo -e "#include <rz_util.h>\nint main(int argc, char **argv) { return rz_str_newf (\"%s\", argv[0]) != NULL? 0: 1; }" > test.c
clang -o test test.c $(pkg-config --libs --cflags rz_util)
./test
test-windows-clang_cl:
name: Test Windows installer built with ${{ matrix.name }}
runs-on: windows-latest
needs: [ build-windows ]
strategy:
matrix:
name: [ clang_cl, clang_cl_x86 ]
include:
- name: clang_cl
bits: 64
- name: clang_cl_x86
bits: 32
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install pkg-config and cmake
shell: pwsh
run: |
choco install -y pkgconfiglite --download-checksum 2038c49d23b5ca19e2218ca89f06df18fe6d870b4c6b54c0498548ef88771f6f --download-checksum-type sha256
choco install -y cmake
- name: Extract rizin version
shell: pwsh
run: echo "branch=$(python sys/version.py)" >> $Env:GITHUB_OUTPUT
id: extract_version
- uses: actions/download-artifact@v4
with:
name: rizin_installer-${{ matrix.name }}-${{ steps.extract_version.outputs.branch }}
path: ./
- name: Install rizin.exe
shell: pwsh
run: Start-Process -Wait -FilePath .\rizin.exe -ArgumentList "/SP- /SILENT /CURRENTUSER" -PassThru
- name: Check that installed rizin runs
shell: pwsh
run: ~\AppData\Local\Programs\rizin\bin\rizin.exe -qcq .\rizin.exe
- name: Check that libraries can be used with pkg-config
shell: pwsh
run: |
.\dist\windows\vsdevenv.ps1 ${{ matrix.bits }}
$env:PATH = "$env:PATH;C:$env:HOMEPATH\AppData\Local\Programs\rizin\bin"
$env:PKG_CONFIG_PATH = "C:$env:HOMEPATH\AppData\Local\Programs\rizin\lib\pkgconfig"
$env:PKG_CONFIG_PATH
pkg-config --list-all
echo "#include <rz_util.h>`nint main(int argc, char **argv) { return rz_str_newf (`"%s`", argv[0]) != NULL? 0: 1; }" > test.c
cl -IC:$env:HOMEPATH\AppData\Local\Programs\rizin\include\librz -IC:$env:HOMEPATH\AppData\Local\Programs\rizin\include\librz\sdb /Fetest.exe test.c /link /libpath:C:$env:HOMEPATH\AppData\Local\Programs\rizin\lib rz_util.lib
.\test.exe
- name: Check CMake config files
shell: pwsh
run: |
.\dist\windows\vsdevenv.ps1 ${{ matrix.bits }}
$env:PATH = "$env:PATH;C:$env:HOMEPATH\AppData\Local\Programs\rizin\bin"
$env:PKG_CONFIG_PATH = "C:$env:HOMEPATH\AppData\Local\Programs\rizin\lib\pkgconfig"
$env:PKG_CONFIG_PATH
cd .github/cmake_test
mkdir build && cd build
cmake -G Ninja ..
ninja
.\rizin_cmake_test
create-release:
name: Create draft release and upload artifacts
runs-on: ubuntu-22.04
if: github.event_name == 'push' && (contains(github.ref, 'release-') || github.ref == 'refs/heads/stable')
needs:
[
build-and-test,
build-centos7,
build-debian,
build-static,
build-android,
build-cpp-linux,
test-osx-pkg,
test-windows-clang_cl,
build-rzpipe,
]
steps:
- uses: actions/checkout@v4
- name: Extract rizin version
run: echo "branch=$(python sys/version.py)" >> $GITHUB_OUTPUT
id: extract_version
- uses: actions/download-artifact@v4
- name: Rename artifacts for release
run: |
mv ./rizin-src.tar.xz/rizin-src.tar.xz rizin-src-${{ steps.extract_version.outputs.branch }}.tar.xz
mv ./rizin-static.tar.xz/rizin-static.tar.xz rizin-${{ steps.extract_version.outputs.branch }}-static-x86_64.tar.xz
mv ./rizin-android-x86_64/rizin-android-x86_64.tar.gz rizin-${{ steps.extract_version.outputs.branch }}-android-x86_64.tar.gz
mv ./rizin-android-arm/rizin-android-arm.tar.gz rizin-${{ steps.extract_version.outputs.branch }}-android-arm.tar.gz
mv ./rizin-android-aarch64/rizin-android-aarch64.tar.gz rizin-${{ steps.extract_version.outputs.branch }}-android-aarch64.tar.gz
mv ./rizin.pkg/rizin.pkg rizin-macos-${{ steps.extract_version.outputs.branch }}.pkg
mv ./rizin-vs2019_static-${{ steps.extract_version.outputs.branch }}.zip/rizin-vs2019_static-${{ steps.extract_version.outputs.branch }}.zip rizin-windows-static-${{ steps.extract_version.outputs.branch }}.zip
mv ./rizin-clang_cl-${{ steps.extract_version.outputs.branch }}.zip/rizin-clang_cl-${{ steps.extract_version.outputs.branch }}.zip rizin-windows-shared64-${{ steps.extract_version.outputs.branch }}.zip
mv ./rizin_installer-clang_cl-${{ steps.extract_version.outputs.branch }}/rizin.exe rizin_installer-${{ steps.extract_version.outputs.branch }}-x86_64.exe
mv ./rizin_installer-clang_cl_x86-${{ steps.extract_version.outputs.branch }}/rizin.exe rizin_installer-${{ steps.extract_version.outputs.branch }}-x86.exe
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1