-
Notifications
You must be signed in to change notification settings - Fork 15
663 lines (588 loc) · 24.3 KB
/
Copy pathci.yml
File metadata and controls
663 lines (588 loc) · 24.3 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
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
# Copyright (c) 2024-2026 Elias Bachaalany
# SPDX-License-Identifier: LicenseRef-Human-Origin-Source-1.0
#
# This file is licensed under the Human-Origin Source License v1.0.
# See LICENSE.
name: ci
on:
push:
branches: ["**"]
tags: ["v*", "V*"]
pull_request:
branches: ["**"]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.12"
JAVA_VERSION: "21"
GHIDRA_RELEASE_URL: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_12.0.4_build/ghidra_12.0.4_PUBLIC_20260303.zip"
jobs:
# The generated protobuf stubs are checked in, and ordinary builds no longer compile
# protoc (LIBGHIDRA_REGENERATE_PROTO defaults OFF), so nothing in a normal build would
# notice a .proto edited without regenerating. check_proto_freshness.py verifies the
# stubs EXIST and carry the pinned gencode version — it does not regenerate, so stale
# stubs pass it. This job is the missing half: regenerate, and fail on any diff.
proto-freshness:
name: Generated stubs are up to date
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install pinned protoc
run: |
set -euo pipefail
# Must match the gencode version the committed stubs declare; a different
# protoc silently rewrites every file and turns this job into noise.
version="29.3"
curl -L --retry 5 --fail -o /tmp/protoc.zip \
"https://github.com/protocolbuffers/protobuf/releases/download/v${version}/protoc-${version}-linux-x86_64.zip"
unzip -q /tmp/protoc.zip -d /tmp/protoc
echo "/tmp/protoc/bin" >> "$GITHUB_PATH"
curl -L --retry 5 --fail -o /tmp/protobuf-src.tar.gz \
"https://github.com/protocolbuffers/protobuf/releases/download/v${version}/protobuf-${version}.tar.gz"
mkdir -p /tmp/protobuf-src && tar -xzf /tmp/protobuf-src.tar.gz -C /tmp/protobuf-src --strip-components=1
- name: Regenerate all stubs
run: |
python proto/tools/regen.py \
--protoc /tmp/protoc/bin/protoc \
--wkt-include /tmp/protobuf-src/src \
--languages cpp java python rust
- name: Fail if the committed stubs are stale
run: |
set -euo pipefail
if ! git diff --quiet; then
echo "::error::Generated protobuf stubs are stale. Run proto/tools/regen.py and commit the result."
git --no-pager diff --stat
# A --stat-only failure is undiagnosable when the box that generated
# the stubs cannot reproduce it: same toolchain, same protoc, same
# inputs, different bytes. Print enough of the real patch, plus the
# exact versions in play, to tell a formatting difference from a
# content one without another round trip through CI.
echo "--- versions ---"
rustc --version; cargo --version; protoc --version
(rustfmt --version || echo "rustfmt: not installed") 2>&1
echo "--- patch (first 200 lines) ---"
git --no-pager diff --unified=1 | head -200
exit 1
fi
echo "generated stubs match the .proto sources"
build-sdk:
name: Build SDK (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-latest
artifact_name: cpp-sdk-linux
cmake_extra: ""
- name: macOS
os: macos-latest
artifact_name: cpp-sdk-macos
cmake_extra: "-DCMAKE_OSX_ARCHITECTURES=arm64"
- name: Windows
os: windows-latest
artifact_name: cpp-sdk-windows
cmake_extra: ""
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Configure C++ SDK
run: >
cmake -S cpp -B build/cpp
-DCMAKE_BUILD_TYPE=Release
-DLIBGHIDRA_WITH_LOCAL=OFF
-DLIBGHIDRA_BUILD_EXAMPLES=ON
${{ matrix.cmake_extra }}
- name: Build C++ SDK
run: cmake --build build/cpp --config Release
- name: Install C++ SDK
run: >
cmake --install build/cpp
--config Release
--prefix "${{ github.workspace }}/artifacts/cpp-install"
- name: Smoke test Python package
run: |
python -m pip install --upgrade pip
python -m pip install -e python
python -c "import libghidra; print(libghidra.__file__)"
- name: Build and test Rust SDK
run: |
cargo build --manifest-path rust/Cargo.toml --examples
cargo test --manifest-path rust/Cargo.toml
- name: Upload C++ SDK artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ github.workspace }}/artifacts/cpp-install
package-python:
name: Package Python SDK
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build Python distributions
run: |
python -m pip install --upgrade pip build
python -m build python
- name: Smoke test built wheel
run: |
WHEEL_URI="$(python - <<'PY'
from pathlib import Path
print(next(Path("python/dist").glob("*.whl")).resolve().as_uri())
PY
)"
python -m pip install "libghidra[local] @ ${WHEEL_URI}"
python -c "import libghidra; print(libghidra.__file__)"
- name: Upload Python artifact
uses: actions/upload-artifact@v4
with:
name: python-sdk
path: python/dist/*
package-rust:
name: Package Rust SDK
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Package crate
run: cargo package --manifest-path rust/Cargo.toml --allow-dirty --no-verify
- name: Upload Rust artifact
uses: actions/upload-artifact@v4
with:
name: rust-sdk
path: rust/target/package/*.crate
build-extension-linux:
name: Build Extension (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Download Ghidra distribution
shell: bash
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/ghidra"
curl -L --retry 5 --output "$RUNNER_TEMP/ghidra/ghidra.zip" "$GHIDRA_RELEASE_URL"
unzip -q "$RUNNER_TEMP/ghidra/ghidra.zip" -d "$RUNNER_TEMP/ghidra/dist"
GHIDRA_INSTALL_DIR="$(find "$RUNNER_TEMP/ghidra/dist" -maxdepth 1 -type d -name 'ghidra_*_PUBLIC*' | head -n 1)"
if [ -z "$GHIDRA_INSTALL_DIR" ]; then
echo "Failed to locate extracted Ghidra distribution root." >&2
exit 1
fi
echo "GHIDRA_INSTALL_DIR=$GHIDRA_INSTALL_DIR" >> "$GITHUB_ENV"
echo "GHIDRAAPI_REAL_BINARY_PATH=$GHIDRA_INSTALL_DIR/GPL/GnuDisassembler/data/little.elf" >> "$GITHUB_ENV"
- name: Test and build extension
run: >
gradle -p ghidra-extension
test buildExtension installExtension
-PGHIDRA_INSTALL_DIR="${{ env.GHIDRA_INSTALL_DIR }}"
- name: Verify installed extension layout
shell: bash
run: |
test -f "${GHIDRA_INSTALL_DIR}/Ghidra/Extensions/LibGhidraHost/extension.properties"
test -d "${GHIDRA_INSTALL_DIR}/Ghidra/Extensions/LibGhidraHost/lib"
ls -la ghidra-extension/dist
- name: Upload extension artifact
uses: actions/upload-artifact@v4
with:
name: ghidra-extension-linux
path: ghidra-extension/dist/*.zip
build-wheel-native:
name: Build Native Wheel (${{ matrix.id }})
# Run on tag push (the usual release path) and on manual workflow_dispatch
# so maintainers can cut an ad-hoc wheel build from any branch for testing
# (e.g. verifying that loader-related CMake changes produce wheels without
# undefined symbols) without creating a public tag.
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- id: linux-x86_64
os: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
cmake_extra: ""
wheel_tool: auditwheel
- id: linux-aarch64
os: ubuntu-24.04-arm
container: quay.io/pypa/manylinux_2_28_aarch64
cmake_extra: ""
wheel_tool: auditwheel
- id: macos-arm64
os: macos-latest
container: ""
cmake_extra: "-DCMAKE_OSX_ARCHITECTURES=arm64"
wheel_tool: delocate
# macos-x86_64 omitted: macos-13 Intel runner pool is frequently
# saturated and leaves the matrix stuck in "queued" for hours,
# blocking publish-draft-release. Re-enable if Intel Mac coverage
# becomes important — the wheel itself builds fine when a runner
# is available.
- id: windows-x86_64
os: windows-latest
container: ""
cmake_extra: ""
wheel_tool: delvewheel
# windows-arm64 intentionally omitted: actions/setup-python@v5 does
# not yet ship an arm64 Python for windows-11-arm, so the native
# extension link fails with unresolved __imp__Py_IncRef. Re-enable
# once setup-python supports architecture: arm64 on that runner.
steps:
- name: Checkout libghidra
uses: actions/checkout@v4
- name: Checkout Ghidra source
uses: actions/checkout@v4
with:
repository: NationalSecurityAgency/ghidra
# Pinned to a master commit that contains all decompiler sources referenced
# by cpp/cmake/GhidraSources.cmake (notably bitfield.cc, which is on master
# but not on the Ghidra_12.0.4_build release branch).
ref: b211a07b51e5098648d8f571130cf93448470d6a
path: _ghidra-src
- name: Use manylinux Python 3.12 and install libbfd
if: startsWith(matrix.id, 'linux-')
shell: bash
run: |
# Ghidra's loadimage_bfd.cc / bfd_arch.cc / analyzesigs.cc / codedata.cc
# are only compiled on Linux and include bfd.h from binutils-devel,
# which is not preinstalled in the manylinux_2_28 image.
yum install -y binutils-devel
echo "/opt/python/cp312-cp312/bin" >> "$GITHUB_PATH"
- name: Setup Python (macOS/Windows)
if: ${{ !startsWith(matrix.id, 'linux-') }}
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Apply libghidra patches to Ghidra source
shell: bash
run: |
# These patches make Ghidra's native decompiler source behave with
# libghidra's local/offline backend. They cover BFD target selection
# for explicit Sleigh language ids and local spec-load tolerance for
# callotherfixup entries that reference unavailable userops.
set -euo pipefail
for p in "${GITHUB_WORKSPACE}"/cpp/patches/*.patch; do
echo "applying $(basename "$p")"
(cd "${GITHUB_WORKSPACE}/_ghidra-src" && patch -p1 < "$p")
done
- name: Overlay compiled Sleigh .sla grammars from Ghidra distribution
shell: bash
run: |
# The git source tree only has .slaspec (Sleigh grammar source) and
# XML metadata under Ghidra/Processors/<proc>/data/languages/. The
# compiled .sla grammars ship only with the release distribution ZIP.
# Download the ZIP, extract, and overlay the .sla files into the
# source tree so embed_specs.py picks them up. Written in Python so
# the path handling is identical on Linux, macOS, and Windows — the
# previous bash version mangled mixed-separator paths on Windows
# Git Bash and the .sla files landed outside the scanned directory,
# leaving win_amd64 wheels without any compiled grammars.
python << 'PYEOF'
import os, pathlib, shutil, sys, urllib.request, zipfile
runner_temp = pathlib.Path(os.environ.get('RUNNER_TEMP') or '/tmp')
work_dir = runner_temp / 'ghidra-dist'
zip_path = runner_temp / 'ghidra-dist.zip'
work_dir.mkdir(parents=True, exist_ok=True)
url = os.environ['GHIDRA_RELEASE_URL']
print(f'downloading {url}', flush=True)
urllib.request.urlretrieve(url, zip_path)
print(f'extracting to {work_dir}', flush=True)
with zipfile.ZipFile(zip_path) as z:
z.extractall(work_dir)
dist_roots = [p for p in work_dir.iterdir()
if p.is_dir() and p.name.startswith('ghidra_') and 'PUBLIC' in p.name]
if not dist_roots:
sys.exit('Failed to find ghidra_*_PUBLIC* directory in extracted ZIP')
dist_root = dist_roots[0]
src_root = pathlib.Path(os.environ['GITHUB_WORKSPACE']) / '_ghidra-src'
count = 0
for sla in (dist_root / 'Ghidra' / 'Processors').rglob('*.sla'):
rel = sla.relative_to(dist_root)
dest = src_root / rel
dest.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(sla, dest)
count += 1
print(f'Overlaid {count} .sla files into {src_root}', flush=True)
PYEOF
- name: Configure C++ SDK with local backend
shell: bash
run: >
cmake -S cpp -B build/cpp
-DCMAKE_BUILD_TYPE=Release
-DLIBGHIDRA_WITH_LOCAL=ON
-DLIBGHIDRA_BUILD_PYTHON=ON
-DGHIDRA_SOURCE_DIR="${GITHUB_WORKSPACE}/_ghidra-src"
${{ matrix.cmake_extra }}
- name: Build C++ SDK
run: cmake --build build/cpp --config Release
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Stage libghidra prebuilt SDK for Rust build
shell: bash
run: |
# Layout matches what rust/build.rs expects when LIBGHIDRA_PREBUILT_DIR
# is set: <root>/include and <root>/lib. We copy the headers from the
# source tree (cpp/include is checked-in, no codegen) and harvest the
# static archives from the CMake build tree.
set -euo pipefail
BUNDLE="${GITHUB_WORKSPACE}/sdk-bundle"
mkdir -p "$BUNDLE/include" "$BUNDLE/lib"
cp -R cpp/include/* "$BUNDLE/include/"
# The static archives are named differently per platform/generator.
# On multi-config (Visual Studio) builds they live under Release/.
find build/cpp -type f \( \
-name 'liblibghidra_*.a' -o \
-name 'libghidra_*.lib' -o \
-name 'liblibghidra_*.lib' -o \
-name 'libprotobuf.lib' -o \
-name 'absl_*.lib' -o \
-name 'utf8_*.lib' -o \
-name 'libprotobuf.a' -o \
-name 'libabsl_*.a' -o \
-name 'libutf8_*.a' \
\) -print -exec cp {} "$BUNDLE/lib/" \;
# On Linux, also bundle libbfd.a + transitive deps from binutils-devel
# so users on newer distros (Debian 13, Ubuntu 24.04, Fedora 40+)
# don't hit ABI mismatches with a system libbfd that has different
# internal struct layouts. Without this, read_bytes returns garbage
# because libghidra_local.a was compiled against bfd ~2.30 headers
# while the user's libbfd.so might be 2.44+.
# Mirrors what auditwheel does for the Python wheel.
if [[ "${{ matrix.id }}" == linux-* ]]; then
for pat in libbfd.a libiberty.a libsframe.a libzstd.a; do
for d in /usr/lib64 /usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/x86_64-linux-gnu; do
if [ -f "$d/$pat" ]; then
echo "bundling $d/$pat"
cp "$d/$pat" "$BUNDLE/lib/"
break
fi
done
done
fi
ls -la "$BUNDLE/lib/" || true
echo "LIBGHIDRA_PREBUILT_DIR=$BUNDLE" >> "$GITHUB_ENV"
- name: Build Rust crate against prebuilt SDK
shell: bash
run: |
set -euo pipefail
cd rust
cargo check --features local
cargo build --release --features local
- name: Package Rust prebuilt archive
shell: bash
run: |
set -euo pipefail
# Map the matrix id to the canonical Rust target triple so that
# cargo-binstall can fetch the matching archive.
case "${{ matrix.id }}" in
linux-x86_64) TRIPLE=x86_64-unknown-linux-gnu ;;
linux-aarch64) TRIPLE=aarch64-unknown-linux-gnu ;;
macos-arm64) TRIPLE=aarch64-apple-darwin ;;
windows-x86_64) TRIPLE=x86_64-pc-windows-msvc ;;
*) echo "Unknown matrix id: ${{ matrix.id }}" >&2; exit 1 ;;
esac
VERSION="$(grep -m1 '^version' rust/Cargo.toml | cut -d'"' -f2)"
STAGE="libghidra-local-${VERSION}-${TRIPLE}"
mkdir -p "stage/${STAGE}"
cp -R "${LIBGHIDRA_PREBUILT_DIR}/include" "stage/${STAGE}/"
cp -R "${LIBGHIDRA_PREBUILT_DIR}/lib" "stage/${STAGE}/"
cat > "stage/${STAGE}/metadata.json" <<JSON
{
"version": "${VERSION}",
"triple": "${TRIPLE}",
"matrix_id": "${{ matrix.id }}"
}
JSON
mkdir -p rust-archives
if [ "${{ matrix.id }}" = "windows-x86_64" ]; then
(cd stage && 7z a -tzip -mx=9 "${GITHUB_WORKSPACE}/rust-archives/${STAGE}.zip" "${STAGE}")
else
tar -czf "rust-archives/${STAGE}.tar.gz" -C stage "${STAGE}"
fi
ls -la rust-archives
- name: Upload Rust prebuilt archive
uses: actions/upload-artifact@v4
with:
name: rust-prebuilt-${{ matrix.id }}
path: rust-archives/*
- name: Build wheel
shell: bash
run: |
python -m pip install --upgrade pip build wheel
python -m build --wheel python
- name: Retag wheel with cp312-abi3 + platform
shell: bash
run: |
# setuptools tags the wheel as py3-none-any because it is unaware of
# the CMake-built nanobind module in package_data. Rewrite the tags
# so downstream repair tools recognise the wheel as platform-specific
# (otherwise delocate/delvewheel keep "any" and three of the four
# wheels end up with identical filenames on the release page).
case "${{ matrix.id }}" in
linux-x86_64) PLAT=linux_x86_64 ;;
linux-aarch64) PLAT=linux_aarch64 ;;
macos-arm64) PLAT=macosx_11_0_arm64 ;;
windows-x86_64) PLAT=win_amd64 ;;
*) echo "Unknown matrix id: ${{ matrix.id }}" >&2; exit 1 ;;
esac
python -m wheel tags \
--python-tag cp312 \
--abi-tag abi3 \
--platform-tag "$PLAT" \
--remove \
python/dist/libghidra-*.whl
- name: Repair wheel (auditwheel)
if: matrix.wheel_tool == 'auditwheel'
shell: bash
run: |
python -m pip install auditwheel patchelf
mkdir -p python/dist-repaired
for whl in python/dist/*.whl; do
auditwheel repair "$whl" -w python/dist-repaired/
done
- name: Repair wheel (delocate)
if: matrix.wheel_tool == 'delocate'
shell: bash
run: |
python -m pip install delocate
mkdir -p python/dist-repaired
for whl in python/dist/*.whl; do
delocate-wheel -w python/dist-repaired/ "$whl"
done
- name: Repair wheel (delvewheel)
if: matrix.wheel_tool == 'delvewheel'
shell: bash
run: |
python -m pip install delvewheel
mkdir -p python/dist-repaired
for whl in python/dist/*.whl; do
delvewheel repair "$whl" -w python/dist-repaired/
done
- name: Smoke test repaired wheel
shell: bash
run: |
WHEEL_URI="$(python - <<'PY'
from pathlib import Path
print(next(Path("python/dist-repaired").glob("*.whl")).resolve().as_uri())
PY
)"
python -m pip install "libghidra[local] @ ${WHEEL_URI}"
python -c "import libghidra; from libghidra.local import LocalClient; print('import ok')"
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: python-wheel-${{ matrix.id }}
path: python/dist-repaired/*.whl
publish-draft-release:
name: Publish Draft Release
if: startsWith(github.ref, 'refs/tags/')
needs:
- build-sdk
- package-python
- package-rust
- build-extension-linux
- build-wheel-native
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download C++ SDK artifacts
uses: actions/download-artifact@v4
with:
pattern: cpp-sdk-*
path: cpp-artifacts
merge-multiple: false
- name: Download Python artifact
uses: actions/download-artifact@v4
with:
name: python-sdk
path: python-artifacts
- name: Download Rust artifact
uses: actions/download-artifact@v4
with:
name: rust-sdk
path: rust-artifacts
- name: Download extension artifact
uses: actions/download-artifact@v4
with:
name: ghidra-extension-linux
path: extension-artifacts
- name: Download native wheel artifacts
uses: actions/download-artifact@v4
with:
pattern: python-wheel-*
path: native-wheels
merge-multiple: true
- name: Download Rust prebuilt archives
uses: actions/download-artifact@v4
with:
pattern: rust-prebuilt-*
path: rust-prebuilt
merge-multiple: true
- name: Prepare release assets
shell: bash
run: |
set -euo pipefail
mkdir -p release
for dir in cpp-artifacts/cpp-sdk-*; do
platform="${dir##*cpp-sdk-}"
(
cd "$dir"
zip -r9 "$GITHUB_WORKSPACE/release/libghidra-cpp-${platform}-${GITHUB_REF_NAME}.zip" .
)
done
EXTENSION_ZIP="$(find extension-artifacts -maxdepth 1 -type f -name '*.zip' | head -n 1)"
cp "$EXTENSION_ZIP" "release/libghidra-extension-${GITHUB_REF_NAME}.zip"
zip -j9 "release/libghidra-python-${GITHUB_REF_NAME}.zip" python-artifacts/*
zip -j9 "release/libghidra-rust-${GITHUB_REF_NAME}.zip" rust-artifacts/*.crate
# Rust prebuilt archives (cargo-binstall picks these up directly;
# the filenames already encode the triple and version per the
# binstall pkg-url template in rust/Cargo.toml).
if compgen -G "rust-prebuilt/*" > /dev/null; then
cp rust-prebuilt/* release/
fi
ls -la release
- name: Create draft GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: libghidra ${{ github.ref_name }}
draft: true
prerelease: ${{ contains(github.ref_name, 'alpha') }}
generate_release_notes: true
files: |
release/*
native-wheels/*.whl