Skip to content

Commit be71bfd

Browse files
committed
fixes nightly tests and ghidra caching
also moves ghidra into a separate action as it turned out to be more complex (with caching, so I stopped copy-pasting them).
1 parent 9661d61 commit be71bfd

File tree

6 files changed

+47
-53
lines changed

6 files changed

+47
-53
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Installs Ghidra"
2+
description: "Installs ghidra libraries and data into the /usr prefix"
3+
inputs:
4+
path:
5+
description: "A path to the bap repository root"
6+
default: ${{ github.workspace }}
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Cache Ghidra
12+
id: cache-ghidra
13+
uses: actions/cache@v4
14+
with:
15+
path: ghidra
16+
key: ${{ runner.os }}-ghidra-${{ hashFiles(format('{0}/tools/install-ghidra.sh', inputs.path)) }}
17+
18+
- name: Build Ghidra
19+
if: steps.cache-ghidra.outputs.cache-hit != 'true'
20+
run: sudo sh ${{inputs.path}}/tools/install-ghidra.sh ghidra
21+
shell: bash
22+
23+
- name: Install Ghidra
24+
run: sudo cp -r ghidra/* /usr/
25+
shell: bash

.github/workflows/full.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# tests all packages, including bap-extra
2-
# it requires ghidra, so it works only on ubuntu-latest
32
name: full
43
run-name: Testing everything in ${{ github.ref }}
54

@@ -17,22 +16,14 @@ jobs:
1716
- name: Checkout code
1817
uses: actions/checkout@v3
1918

19+
- name: Install Ghidra
20+
uses: ./.github/actions/install-ghidra
21+
2022
- name: Install Dejagnu
2123
run: |
2224
sudo apt-get update -y
2325
sudo apt-get install dejagnu -y
2426
25-
- name: Cache Ghidra
26-
id: cache-ghidra
27-
uses: actions/cache@v4
28-
with:
29-
path: /usr/share/ghidra
30-
key: ${{ runner.os }}-ghidra
31-
32-
- name: Build and Install Ghidra
33-
if: steps.cache-ghidras.outputs.cache-hit != 'true'
34-
run: sudo sh ./tools/install-ghidra.sh
35-
3627
- name: Install OCaml
3728
uses: ocaml/setup-ocaml@v3
3829
with:

.github/workflows/nightly.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ jobs:
2323
OPAMRETRES: 8
2424

2525
steps:
26+
- name: Checkout the Tests
27+
uses: actions/checkout@v4
28+
with:
29+
repository: BinaryAnalysisPlatform/bap
30+
path: bap
31+
32+
- name: Install Ghidra
33+
uses: ./bap/.github/actions/install-ghidra
34+
with:
35+
path: ./bap
36+
2637
- name: Install Extra System Dependencies
2738
run: |
2839
sudo apt-get update -y
2940
sudo apt-get install dejagnu -y
3041
31-
- name: Cache Ghidra
32-
id: cache-ghidra
33-
uses: actions/cache@v4
34-
with:
35-
path: /usr/share/ghidra
36-
key: ${{ runner.os }}-ghidra
37-
38-
- name: Build and Install Ghidra
39-
if: steps.cache-ghidras.outputs.cache-hit != 'true'
40-
run: sudo sh ./tools/install-ghidra.sh
41-
4242
- name: Use OCaml ${{ matrix.ocaml-compiler }}
4343
uses: ocaml/setup-ocaml@v3
4444
with:
@@ -51,13 +51,7 @@ jobs:
5151
bap: git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing
5252
5353
- name: Build and Install BAP
54-
run: opam install bap-extra bap-radare2
55-
56-
- name: Checkout the Tests
57-
uses: actions/checkout@v4
58-
with:
59-
repository: BinaryAnalysisPlatform/bap
60-
path: bap
54+
run: opam install bap.master bap-extra.master bap-radare2.master
6155

6256
- name: Run Functional Tests
6357
run: opam exec -- make -C bap check

.github/workflows/opam.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,14 @@ jobs:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
2323

24+
- name: Install Ghidra
25+
uses: .github/actions/install-ghidra
26+
2427
- name: Install Dejagnu
2528
run: |
2629
sudo apt-get update -y
2730
sudo apt-get install dejagnu -y
2831
29-
- name: Cache Ghidra
30-
id: cache-ghidra
31-
uses: actions/cache@v4
32-
with:
33-
path: /usr/share/ghidra
34-
key: ${{ runner.os }}-ghidra
35-
36-
- name: Build and Install Ghidra
37-
if: steps.cache-ghidras.outputs.cache-hit != 'true'
38-
run: sudo sh ./tools/install-ghidra.sh
39-
4032
- name: Install OCaml ${{ matrix.ocaml-compiler }}
4133
uses: ocaml/setup-ocaml@v3
4234
with:

.github/workflows/release.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,15 @@ jobs:
1818
- name: Checkout code
1919
uses: actions/checkout@v4
2020

21+
- name: Install Ghidra
22+
uses: .github/actions/install-ghidra
23+
2124
- name: Install OCaml
2225
uses: ocaml/setup-ocaml@v3
2326
with:
2427
ocaml-compiler: ocaml-variants.4.14.2+flambda
2528
dune-cache: true
2629

27-
- name: Cache Ghidra
28-
id: cache-ghidra
29-
uses: actions/cache@v4
30-
with:
31-
path: /usr/share/ghidra
32-
key: ${{ runner.os }}-ghidra
33-
34-
- name: Build and Install Ghidra
35-
if: steps.cache-ghidras.outputs.cache-hit != 'true'
36-
run: sudo sh ./tools/install-ghidra.sh
37-
3830
- name: Add the testing Repository
3931
run: opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing
4032

tools/install-ghidra.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -x \
2020
&& cd ${BUILDDIR} \
2121
&& curl -sS -L -o ${GHIDRA_TARBALL} ${GHIDRA_SRC_URL} \
2222
&& echo "${GHIDRA_SHA256} ${GHIDRA_TARBALL}" | sha256sum --check \
23-
&& tar xzvf ${GHIDRA_TARBALL} \
23+
&& tar xzf ${GHIDRA_TARBALL} \
2424
&& rm ${LIBGHIDRA_PATH}/*bfd*.* ${LIBGHIDRA_PATH}/codedata.* \
2525
&& make -j -C ${LIBGHIDRA_PATH} OPT_CXXFLAGS="${LIBGHIDRA_FLAGS}" libdecomp.a libsla.a \
2626
&& make -j -C ${LIBGHIDRA_PATH} sleigh_opt \

0 commit comments

Comments
 (0)