Skip to content

Commit 347c4e8

Browse files
Fix wrapper CLI path resolution across CI jobs
Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
1 parent 33df51f commit 347c4e8

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
- name: Run Python wrapper smoke tests
131131
shell: bash
132132
env:
133-
GIT_TESTKIT_CLI: ${{ matrix.os == 'windows-latest' && '../../bin/git-testkit-cli.exe' || '../../bin/git-testkit-cli' }}
133+
GIT_TESTKIT_CLI: ${{ matrix.os == 'windows-latest' && './bin/git-testkit-cli.exe' || './bin/git-testkit-cli' }}
134134
run: |
135135
cd testkit/python
136136
python -m pip install -e ".[dev]"
@@ -139,7 +139,7 @@ jobs:
139139
- name: Run Java wrapper smoke tests
140140
shell: bash
141141
env:
142-
GIT_TESTKIT_CLI: ${{ matrix.os == 'windows-latest' && '../../bin/git-testkit-cli.exe' || '../../bin/git-testkit-cli' }}
142+
GIT_TESTKIT_CLI: ${{ matrix.os == 'windows-latest' && './bin/git-testkit-cli.exe' || './bin/git-testkit-cli' }}
143143
run: |
144144
cd testkit/java
145145
mvn -Dtest=CliBridgeTest,SampleRepoFlowSmoke,SampleSnapshotFlowSmoke test

testkit/java/src/main/java/io/gitfire/testkit/CliBridge.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.concurrent.Future;
1515
import java.util.regex.Matcher;
1616
import java.util.regex.Pattern;
17+
import java.nio.file.Paths;
1718

1819
public final class CliBridge {
1920
private static final Pattern ERROR_PATTERN =
@@ -185,7 +186,11 @@ private static List<String> shellCommand(String cliCommand) {
185186
private static List<String> defaultCliCommandArgs() {
186187
String configuredCli = System.getenv("GIT_TESTKIT_CLI");
187188
if (configuredCli != null && !configuredCli.isBlank()) {
188-
return shellCommand(configuredCli);
189+
Path cliPath = Paths.get(configuredCli);
190+
if (!cliPath.isAbsolute()) {
191+
cliPath = detectWorkspaceRoot().resolve(cliPath).normalize();
192+
}
193+
return shellCommand(cliPath.toString());
189194
}
190195
return List.of("go", "run", "./cmd/git-testkit-cli");
191196
}

testkit/python/git_testkit/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def _repo_root() -> Path:
1717
def _cli_cmd() -> list[str]:
1818
cli = os.environ.get("GIT_TESTKIT_CLI", "").strip()
1919
if cli:
20-
return [cli]
20+
cli_path = Path(cli)
21+
if not cli_path.is_absolute():
22+
cli_path = _repo_root() / cli_path
23+
return [str(cli_path)]
2124
return ["go", "run", "./cmd/git-testkit-cli"]
2225

2326

0 commit comments

Comments
 (0)