-
Notifications
You must be signed in to change notification settings - Fork 37
765 lines (596 loc) · 25.7 KB
/
build.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
#
# Copyright (c) 2019-present, Trail of Bits, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
#
name: Build
on:
# Run this workflow once every 6 hours against the master branch
#schedule:
# - cron: "0 */6 * * *"
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
workflow_dispatch:
jobs:
cleanup_stale_workflows:
runs-on: ubuntu-22.04
steps:
- name: Clone the anvill repository
uses: actions/checkout@v3
- name: Install Python dependencies
run: |
pip install requests
- name: Cancel old workflow runs
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
python3 .github/scripts/abort_previous_workflows.py
build_linux:
needs: cleanup_stale_workflows
strategy:
fail-fast: false
matrix:
image:
- { name: "ubuntu", tag: "22.04" }
llvm: ["17"]
cxxcommon_version: ["v0.6.0"]
runs-on:
labels: gha-ubuntu-32
container:
image: docker.pkg.github.com/lifting-bits/cxx-common/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup the build paths
shell: bash
id: build_paths
run: |
rel_build_path="build"
rel_source_path="src"
rel_install_path="install"
rel_downloads_path="downloads"
rel_ccache_path="ccache"
rel_workspace_path="workspace"
mkdir -p ${rel_build_path} \
${rel_install_path} \
${rel_downloads_path} \
${rel_ccache_path} \
${rel_workspace_path}
echo "SOURCE=$(pwd)/${rel_source_path}" >> ${GITHUB_OUTPUT}
echo "REL_SOURCE=${rel_source_path}" >> ${GITHUB_OUTPUT}
echo "BUILD=$(pwd)/${rel_build_path}" >> ${GITHUB_OUTPUT}
echo "REL_BUILD=${rel_build_path}" >> ${GITHUB_OUTPUT}
echo "INSTALL=$(pwd)/${rel_install_path}" >> ${GITHUB_OUTPUT}
echo "DOWNLOADS=$(pwd)/${rel_downloads_path}" >> ${GITHUB_OUTPUT}
echo "CCACHE=$(pwd)/${rel_ccache_path}" >> ${GITHUB_OUTPUT}
echo "WORKSPACE=$(pwd)/${rel_workspace_path}" >> ${GITHUB_OUTPUT}
- name: Update the cache (downloads)
uses: actions/cache@v3
with:
path: ${{ steps.build_paths.outputs.DOWNLOADS }}
key: |
gitmodules_${{ matrix.image.name }}_${{ matrix.image.tag }}_${{ matrix.llvm }}_${{ matrix.cxxcommon_version }}_${{ github.sha }}
restore-keys: |
gitmodules_${{ matrix.image.name }}_${{ matrix.image.tag }}_${{ matrix.llvm }}_${{ matrix.cxxcommon_version }}
- name: Update the cache (ccache)
uses: actions/cache@v3
with:
path: ${{ steps.build_paths.outputs.CCACHE }}
key: |
gitmodules_${{ matrix.image.name }}_${{ matrix.image.tag }}_${{ matrix.llvm }}_${{ matrix.cxxcommon_version }}_${{ github.sha }}
restore-keys: |
gitmodules_${{ matrix.image.name }}_${{ matrix.image.tag }}_${{ matrix.llvm }}_${{ matrix.cxxcommon_version }}
# TODO(alessandro): Remove this step once the dependencies have been embedded in the container image
- name: Install system dependencies
shell: bash
run: |
apt-get update
apt-get install -y pixz \
xz-utils \
make \
ninja-build \
ccache \
rpm \
openssh-client
- name: Clone the anvill repository
uses: actions/checkout@v2
with:
path: ${{ steps.build_paths.outputs.REL_SOURCE }}/anvill
fetch-depth: 0
submodules: true
- name: Setup Git User for Applying Patches
# See this thread for more details https://github.community/t/github-actions-bot-email-address/17204/5
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Install stable rust
uses: dtolnay/rust-toolchain@stable
- name: "Install Just"
shell: bash
run: |
cargo install just
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Clone Ghidra Spec Generation
uses: actions/checkout@v3
with:
path: ${{ steps.build_paths.outputs.REL_SOURCE }}/irene3
repository: "trailofbits/irene3"
fetch-depth: 0
submodules: true
ssh-key: "${{ secrets.IRENE3_DEPLOY }}"
- name: Add cargo bin to path
shell: bash
run: |
echo ~/.cargo/bin >>$GITHUB_PATH
- name: "Setup Ghidra"
working-directory: ${{ steps.build_paths.outputs.REL_SOURCE }}/irene3
run: |
just install-ghidra
echo "GHIDRA_INSTALL_DIR=$(pwd)/deps/ghidra" >> $GITHUB_ENV
- name: Install Ghidra Spec Generation
shell: bash
working-directory: ${{ steps.build_paths.outputs.REL_SOURCE }}/irene3
run: |
just install-irene3-ghidra
- name: Download the cxx-common ${{ matrix.cxxcommon_version}} package
shell: bash
id: cxxcommon_installer
working-directory: ${{ steps.build_paths.outputs.DOWNLOADS }}
run: |
folder_name="vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm-${{ matrix.llvm }}_amd64"
archive_name="${folder_name}.tar.xz"
url="https://github.com/lifting-bits/cxx-common/releases/download/${{ matrix.cxxcommon_version}}/${archive_name}"
local_path="${{ steps.build_paths.outputs.DOWNLOADS }}/${archive_name}"
if [[ ! -f "${local_path}" ]] ; then
echo "Downloading: ${url}"
curl "${url}" -L -o "${local_path}"
ls -t ${{ steps.build_paths.outputs.DOWNLOADS }}/vcpkg_* | tail -n +2 | while read archive_file ; do
rm "${archive_file}"
done
fi
tar xf "${local_path}" \
-C "${{ steps.build_paths.outputs.INSTALL }}"
destination_path="${{ steps.build_paths.outputs.INSTALL }}/vcpkg"
mv "${{ steps.build_paths.outputs.INSTALL }}/${folder_name}" \
"${destination_path}"
echo "${destination_path}/installed/x64-linux-rel/tools/llvm-${{matrix.llvm}}" >> $GITHUB_PATH
echo "PATH=${destination_path}" >> ${GITHUB_OUTPUT}
- name: Select the build job count
shell: bash
id: build_job_count
run: |
echo "VALUE=$(($(nproc) + 1))" >> ${GITHUB_OUTPUT}
- name: Configure remill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
mkdir remill_build && cd remill_build
cmake \
-DCMAKE_VERBOSE_MAKEFILE=true \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="x64-linux-rel" \
-G Ninja \
${{ steps.build_paths.outputs.SOURCE }}/anvill/remill
- name: Build remill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
cmake --build remill_build \
-j ${{ steps.build_job_count.outputs.VALUE }}
- name: Install remill
id: remill_installer
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
export DESTDIR=${{ steps.build_paths.outputs.INSTALL }}/remill
cmake --build remill_build \
--target install
echo "PATH=${DESTDIR}" >> ${GITHUB_OUTPUT}
- name: Build, configure and install remill (Presets)
working-directory: ${{ steps.build_paths.outputs.SOURCE }}/anvill/remill
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
CMAKE_TOOLCHAIN_FILE: ${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake
INSTALL_DIR: ${{ steps.build_paths.outputs.WORKSPACE }}
run: |
scripts/build-preset.sh debug
- name: Configure anvill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
mkdir anvill_build && cd anvill_build
cmake \
-DCMAKE_VERBOSE_MAKEFILE=true \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="x64-linux-rel" \
-Dremill_DIR:PATH=${{ steps.remill_installer.outputs.PATH }}/usr/local/lib/cmake/remill \
-Dsleigh_DIR:PATH=${{ steps.remill_installer.outputs.PATH }}/usr/local/lib/cmake/sleigh \
-DANVILL_ENABLE_TESTS=true \
-DANVILL_ENABLE_INSTALL=true \
-G Ninja \
${{ steps.build_paths.outputs.SOURCE }}/anvill
- name: Build anvill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
cmake --build anvill_build \
-j ${{ steps.build_job_count.outputs.VALUE }}
- name: Install anvill
id: anvill_installer
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
export DESTDIR=${{ steps.build_paths.outputs.INSTALL }}/anvill
cmake --build anvill_build \
--target install
echo "PATH=${DESTDIR}" >> ${GITHUB_OUTPUT}
- name: Build, configure and install anvill (Presets)
working-directory: ${{ steps.build_paths.outputs.SOURCE }}/anvill
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
CMAKE_TOOLCHAIN_FILE: ${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake
INSTALL_DIR: ${{ steps.build_paths.outputs.WORKSPACE }}
run: |
scripts/build-preset.sh debug
- name: Run the tests
env:
CTEST_OUTPUT_ON_FAILURE: 1
shell: bash
working-directory: ${{ steps.build_paths.outputs.BUILD }}/anvill_build
run: |
ctest -V
- name: Create the packages
shell: bash
working-directory: ${{ steps.build_paths.outputs.BUILD }}
run: |
anvill_tag=$(cd "${{ steps.build_paths.outputs.SOURCE }}/anvill" && git describe --tags --always --abbrev=0)
anvill_commit=$(cd "${{ steps.build_paths.outputs.SOURCE }}/anvill" && git rev-parse HEAD | cut -c1-7)
anvill_version="${anvill_tag:1}.${anvill_commit}"
echo "Version: ${anvill_version}"
cpack -D ANVILL_DATA_PATH="${{ steps.anvill_installer.outputs.PATH }}" \
-R ${anvill_version} \
--config "${{ steps.build_paths.outputs.SOURCE }}/anvill/packaging/main.cmake"
- name: Locate the packages
id: package_names
shell: bash
working-directory: ${{ steps.build_paths.outputs.BUILD }}
run: |
echo "DEB_PACKAGE_PATH=${{ steps.build_paths.outputs.REL_BUILD }}/$(ls *.deb)" >> ${GITHUB_OUTPUT}
echo "RPM_PACKAGE_PATH=${{ steps.build_paths.outputs.REL_BUILD }}/$(ls *.rpm)" >> ${GITHUB_OUTPUT}
echo "TGZ_PACKAGE_PATH=${{ steps.build_paths.outputs.REL_BUILD }}/$(ls *.tar.gz)" >> ${GITHUB_OUTPUT}
- name: Install the DEB package
run: |
dpkg -i ${{ steps.package_names.outputs.DEB_PACKAGE_PATH }}
- name: Run Integration Tests (AnghaBench 50)
shell: bash
working-directory: ${{ steps.build_paths.outputs.REL_SOURCE }}/anvill
run: |
python3 -m pip install -r libraries/lifting-tools-ci/requirements.txt
scripts/test-angha-50.sh \
--ghidra-install-dir $GHIDRA_INSTALL_DIR \
--decompile-cmd "anvill-decompile-spec" \
--jobs 8
- name: Tar and Compress logs
if: failure()
run: |
shopt -s globstar
tar -cf test-errs.tar.xz ${{ steps.build_paths.outputs.REL_SOURCE }}/anvill/angha-test-50/**/std*
shell: bash
- name: Upload stderr/stdout logs on error
if: failure()
uses: actions/upload-artifact@v3
with:
name: AnghaBench 50 logs
path: test-errs.tar.xz
- name: Store the DEB package
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm${{ matrix.llvm }}_deb_package
path: ${{ steps.package_names.outputs.DEB_PACKAGE_PATH }}
- name: Store the RPM package
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm${{ matrix.llvm }}_rpm_package
path: ${{ steps.package_names.outputs.RPM_PACKAGE_PATH }}
- name: Store the TGZ package
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm${{ matrix.llvm }}_tgz_package
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
# Note that we have a limit of 5 concurrent workers, org-wide.
# It is best to try and keep the amount of macOS jobs as low
# as possible.
build_macos:
needs: cleanup_stale_workflows
strategy:
fail-fast: false
matrix:
os: ["macos-13"]
llvm: ["17"]
cxxcommon_version: ["v0.6.0"]
runs-on: macos-13
steps:
- name: Setup the build paths
shell: bash
id: build_paths
run: |
rel_build_path="build"
rel_source_path="src"
rel_install_path="install"
rel_downloads_path="downloads"
rel_ccache_path="ccache"
rel_workspace_path="workspace"
mkdir -p ${rel_build_path} \
${rel_install_path} \
${rel_downloads_path} \
${rel_ccache_path} \
${rel_workspace_path}
echo "SOURCE=$(pwd)/${rel_source_path}" >> ${GITHUB_OUTPUT}
echo "REL_SOURCE=${rel_source_path}" >> ${GITHUB_OUTPUT}
echo "BUILD=$(pwd)/${rel_build_path}" >> ${GITHUB_OUTPUT}
echo "REL_BUILD=${rel_build_path}" >> ${GITHUB_OUTPUT}
echo "INSTALL=$(pwd)/${rel_install_path}" >> ${GITHUB_OUTPUT}
echo "DOWNLOADS=$(pwd)/${rel_downloads_path}" >> ${GITHUB_OUTPUT}
echo "CCACHE=$(pwd)/${rel_ccache_path}" >> ${GITHUB_OUTPUT}
echo "WORKSPACE=$(pwd)/${rel_workspace_path}" >> ${GITHUB_OUTPUT}
- name: Update the cache (downloads)
uses: actions/cache@v3
with:
path: ${{ steps.build_paths.outputs.DOWNLOADS }}
key: |
gitmodules_${{ matrix.os }}_${{ matrix.llvm }}_${{ matrix.cxxcommon_version }}_${{ github.sha }}
restore-keys: |
gitmodules_${{ matrix.os }}_${{ matrix.llvm }}_${{ matrix.cxxcommon_version }}
- name: Update the cache (ccache)
uses: actions/cache@v3
with:
path: ${{ steps.build_paths.outputs.CCACHE }}
key: |
gitmodules_${{ matrix.os }}_${{ matrix.llvm }}_${{ github.sha }}
restore-keys: |
gitmodules_${{ matrix.os }}_${{ matrix.llvm }}
- name: Install system dependencies
shell: bash
run: |
brew install ccache \
ninja
- name: Clone the anvill repository
uses: actions/checkout@v3
with:
path: ${{ steps.build_paths.outputs.REL_SOURCE }}/anvill
fetch-depth: 0
submodules: true
- name: Setup Git User for Applying Patches
# See this thread for more details https://github.community/t/github-actions-bot-email-address/17204/5
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Download the cxx-common ${{ matrix.cxxcommon_version}} package
shell: bash
id: cxxcommon_installer
working-directory: ${{ steps.build_paths.outputs.DOWNLOADS }}
run: |
folder_name="vcpkg_${{ matrix.os }}_llvm-${{ matrix.llvm }}_xcode-15.0_amd64"
archive_name="${folder_name}.tar.xz"
url="https://github.com/lifting-bits/cxx-common/releases/download/${{ matrix.cxxcommon_version}}/${archive_name}"
local_path="${{ steps.build_paths.outputs.DOWNLOADS }}/${archive_name}"
if [[ ! -f "${local_path}" ]] ; then
echo "Downloading: ${url}"
curl "${url}" -L -o "${local_path}"
ls -t ${{ steps.build_paths.outputs.DOWNLOADS }}/vcpkg_* | tail -n +2 | while read archive_file ; do
rm "${archive_file}"
done
fi
tar xf "${local_path}" \
-C "${{ steps.build_paths.outputs.INSTALL }}"
destination_path="${{ steps.build_paths.outputs.INSTALL }}/vcpkg"
mv "${{ steps.build_paths.outputs.INSTALL }}/${folder_name}" \
"${destination_path}"
echo "${destination_path}/installed/x64-osx-rel/bin" >> $GITHUB_PATH
echo "PATH=${destination_path}" >> ${GITHUB_OUTPUT}
- name: Select the build job count
shell: bash
id: build_job_count
run: |
echo "VALUE=$(($(sysctl -n hw.logicalcpu) + 1))" >> ${GITHUB_OUTPUT}
- name: Configure remill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
mkdir remill_build && cd remill_build
cmake \
-DCMAKE_VERBOSE_MAKEFILE=true \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="x64-osx-rel" \
-G Ninja \
${{ steps.build_paths.outputs.SOURCE }}/anvill/remill
- name: Build remill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
cmake --build remill_build \
-j ${{ steps.build_job_count.outputs.VALUE }}
- name: Install remill
id: remill_installer
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
export DESTDIR=${{ steps.build_paths.outputs.INSTALL }}/remill
cmake --build remill_build \
--target install
echo "PATH=${DESTDIR}" >> ${GITHUB_OUTPUT}
- name: Build, configure and install remill (Presets)
working-directory: ${{ steps.build_paths.outputs.SOURCE }}/anvill/remill
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
CMAKE_TOOLCHAIN_FILE: ${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake
INSTALL_DIR: ${{ steps.build_paths.outputs.WORKSPACE }}
run: |
scripts/build-preset.sh debug
- name: Configure anvill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
mkdir anvill_build && cd anvill_build
cmake \
-DCMAKE_VERBOSE_MAKEFILE=true \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="x64-osx-rel" \
-Dremill_DIR:PATH=${{ steps.remill_installer.outputs.PATH }}/usr/local/lib/cmake/remill \
-Dsleigh_DIR:PATH=${{ steps.remill_installer.outputs.PATH }}/usr/local/lib/cmake/sleigh \
-DANVILL_ENABLE_TESTS=true \
-DANVILL_ENABLE_INSTALL=true \
-G Ninja \
${{ steps.build_paths.outputs.SOURCE }}/anvill
- name: Build anvill
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
cmake --build anvill_build \
-j ${{ steps.build_job_count.outputs.VALUE }}
- name: Install anvill
id: anvill_installer
working-directory: ${{ steps.build_paths.outputs.BUILD }}
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
run: |
export DESTDIR=${{ steps.build_paths.outputs.INSTALL }}/anvill
cmake --build anvill_build \
--target install
echo "PATH=${DESTDIR}" >> ${GITHUB_OUTPUT}
- name: Build, configure and install anvill (Presets)
working-directory: ${{ steps.build_paths.outputs.SOURCE }}/anvill
env:
CCACHE_DIR: ${{ steps.build_paths.outputs.CCACHE }}
CMAKE_TOOLCHAIN_FILE: ${{ steps.cxxcommon_installer.outputs.PATH }}/scripts/buildsystems/vcpkg.cmake
INSTALL_DIR: ${{ steps.build_paths.outputs.WORKSPACE }}
run: |
scripts/build-preset.sh debug
- name: Run the tests not requiring Binary Ninja
shell: bash
working-directory: ${{ steps.build_paths.outputs.BUILD }}/anvill_build
run: |
ctest -V
- name: Create the packages
shell: bash
working-directory: ${{ steps.build_paths.outputs.BUILD }}
run: |
anvill_tag=$(cd "${{ steps.build_paths.outputs.SOURCE }}/anvill" && git describe --tags --always --abbrev=0)
anvill_commit=$(cd "${{ steps.build_paths.outputs.SOURCE }}/anvill" && git rev-parse HEAD | cut -c1-7)
anvill_version="${anvill_tag:1}.${anvill_commit}"
echo "Version: ${anvill_version}"
cpack -D ANVILL_DATA_PATH="${{ steps.anvill_installer.outputs.PATH }}" \
-R ${anvill_version} \
--config "${{ steps.build_paths.outputs.SOURCE }}/anvill/packaging/main.cmake"
- name: Locate the packages
id: package_names
shell: bash
working-directory: ${{ steps.build_paths.outputs.BUILD }}
run: |
echo "TGZ_PACKAGE_PATH=${{ steps.build_paths.outputs.REL_BUILD }}/$(ls *.tar.gz)" >> ${GITHUB_OUTPUT}
- name: Store the TGZ package
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}_llvm${{ matrix.llvm }}_tgz_package
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
passes_ci:
needs: build_linux
runs-on: ubuntu-22.04
if: always()
steps:
- name: Successful linux build
if: ${{ contains(needs.*.result, 'success') }}
run: exit 0
- name: Failing linux build
if: ${{ !(contains(needs.*.result, 'success')) }}
run: exit 1
release_packages:
# Do not run the release procedure if any of the builds has failed
needs: [build_linux, build_macos]
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- name: Clone the anvill repository
uses: actions/checkout@v3
with:
path: anvill
fetch-depth: 0
- name: Generate the changelog
shell: bash
working-directory: anvill
run: |
./scripts/generate_changelog.sh changelog.md
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Draft the new release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Version ${{ github.ref }}
body_path: anvill/changelog.md
draft: true
prerelease: true
- name: Group the packages by platform
run: |
zip -r9 anvill_ubuntu-22.04_packages.zip \
ubuntu-22.04*
zip -r9 anvill_macos-12_packages.zip \
macos-12*
- name: Upload the Ubuntu 22.04 packages
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: anvill_ubuntu-22.04_packages.zip
asset_name: anvill_ubuntu-22.04_packages.zip
asset_content_type: application/gzip
- name: Upload the macOS 11 packages
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: anvill_macos-12_packages.zip
asset_name: anvill_macos-12_packages.zip
asset_content_type: application/gzip
Docker_Linux:
needs: cleanup_stale_workflows
runs-on: ubuntu-latest
strategy:
matrix:
llvm: ["17"]
ubuntu: ["22.04"]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build LLVM ${{ matrix.llvm }} on ${{ matrix.ubuntu }}
run: |
docker build . -t docker.pkg.github.com/lifting-bits/anvill/anvill-llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest -f Dockerfile --target=dist --build-arg UBUNTU_VERSION=${{ matrix.ubuntu }} --build-arg ARCH=amd64 --build-arg LLVM_VERSION=${{ matrix.llvm }}