mirror of
https://github.com/encounter/ghidra-cli.git
synced 2026-07-10 03:18:56 -07:00
fix: stop bridge before caching and validate .rep directory content
The ghidra-setup job left the bridge running after import+analyze, so the Ghidra JVM hadn't flushed the project database to the .rep directory when the post-job cache save ran. This resulted in caches containing only the ~1KB .gpr file without any analysis data. - Stop bridge after import+analyze in ghidra-setup (both workflows) - Bump cache keys v2→v3 to invalidate broken empty caches - Validate .rep has actual files, not just an empty directory Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
d5f9a96df9
commit
d9ee02902d
@@ -52,7 +52,7 @@ jobs:
|
||||
~/.cache/ghidra-cli/projects
|
||||
~/Library/Caches/ghidra-cli/projects
|
||||
~/AppData/Local/ghidra-cli/projects
|
||||
key: ghidra-projects-${{ matrix.os }}-v2-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
key: ghidra-projects-${{ matrix.os }}-v3-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
@@ -78,6 +78,7 @@ jobs:
|
||||
run: |
|
||||
cargo run -- import tests/fixtures/sample_binary --project ci-test --program sample_binary || true
|
||||
cargo run -- analyze --project ci-test --program sample_binary || true
|
||||
cargo run -- stop --project ci-test || true
|
||||
shell: bash
|
||||
timeout-minutes: 20
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
~/.cache/ghidra-cli/projects
|
||||
~/Library/Caches/ghidra-cli/projects
|
||||
~/AppData/Local/ghidra-cli/projects
|
||||
key: ghidra-projects-${{ matrix.os }}-v2-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
key: ghidra-projects-${{ matrix.os }}-v3-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
@@ -116,6 +116,7 @@ jobs:
|
||||
run: |
|
||||
cargo run -- import tests/fixtures/sample_binary --project ci-test --program sample_binary || true
|
||||
cargo run -- analyze --project ci-test --program sample_binary || true
|
||||
cargo run -- stop --project ci-test || true
|
||||
shell: bash
|
||||
timeout-minutes: 20
|
||||
|
||||
@@ -164,7 +165,7 @@ jobs:
|
||||
~/.cache/ghidra-cli/projects
|
||||
~/Library/Caches/ghidra-cli/projects
|
||||
~/AppData/Local/ghidra-cli/projects
|
||||
key: ghidra-projects-${{ matrix.os }}-v2-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
key: ghidra-projects-${{ matrix.os }}-v3-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
@@ -237,7 +238,7 @@ jobs:
|
||||
~/.cache/ghidra-cli/projects
|
||||
~/Library/Caches/ghidra-cli/projects
|
||||
~/AppData/Local/ghidra-cli/projects
|
||||
key: ghidra-projects-${{ matrix.os }}-v2-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
key: ghidra-projects-${{ matrix.os }}-v3-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
@@ -310,7 +311,7 @@ jobs:
|
||||
~/.cache/ghidra-cli/projects
|
||||
~/Library/Caches/ghidra-cli/projects
|
||||
~/AppData/Local/ghidra-cli/projects
|
||||
key: ghidra-projects-${{ matrix.os }}-v2-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
key: ghidra-projects-${{ matrix.os }}-v3-${{ hashFiles('tests/fixtures/sample_binary.rs') }}
|
||||
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
|
||||
+11
-3
@@ -57,13 +57,21 @@ pub fn ensure_test_project(project: &str, program: &str) {
|
||||
let gpr_file = projects_dir.join(format!("{}.gpr", project));
|
||||
let rep_dir = projects_dir.join(format!("{}.rep", project));
|
||||
|
||||
if gpr_file.exists() && rep_dir.exists() && rep_dir.is_dir() {
|
||||
// Check that .rep has actual content (not just an empty directory).
|
||||
// If the bridge wasn't stopped before caching, .rep may exist but be empty
|
||||
// because Ghidra hadn't flushed the project database to disk.
|
||||
let rep_has_content = rep_dir.is_dir()
|
||||
&& std::fs::read_dir(&rep_dir)
|
||||
.map(|mut entries| entries.next().is_some())
|
||||
.unwrap_or(false);
|
||||
|
||||
if gpr_file.exists() && rep_has_content {
|
||||
eprintln!("=== Using cached test project: {:?} ===", gpr_file);
|
||||
return;
|
||||
}
|
||||
|
||||
if gpr_file.exists() {
|
||||
eprintln!("=== Project .gpr exists but .rep missing, re-importing ===");
|
||||
if gpr_file.exists() && !rep_has_content {
|
||||
eprintln!("=== Project .gpr exists but .rep missing or empty, re-importing ===");
|
||||
}
|
||||
|
||||
eprintln!("=== Setting up test project (import + analyze) ===");
|
||||
|
||||
Reference in New Issue
Block a user