mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-12 23:21:27 -07:00
test: add support for testing native binaries
- Update TestRig to support GEMINI_BINARY environment variable - Add E2E smoke test job for native Linux binary - Minimal addition that runs in parallel with existing tests
This commit is contained in:
21
.github/workflows/e2e.yml
vendored
21
.github/workflows/e2e.yml
vendored
@@ -71,3 +71,24 @@ jobs:
|
||||
env:
|
||||
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
run: npm run test:e2e
|
||||
|
||||
e2e-test-native-binary:
|
||||
name: E2E Native Binary Smoke Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: 'npm'
|
||||
- uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
|
||||
with:
|
||||
bun-version: '1.2.20'
|
||||
- run: npm ci
|
||||
- run: npm run bundle
|
||||
- run: npm run build:binaries
|
||||
- name: Smoke test native binary
|
||||
env:
|
||||
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
GEMINI_BINARY: ${{ github.workspace }}/bundle/binaries/gemini-cli-linux-x64
|
||||
run: npm run test:integration:sandbox:none -- list_directory
|
||||
|
||||
@@ -103,7 +103,14 @@ export function validateModelOutput(
|
||||
|
||||
export class TestRig {
|
||||
constructor() {
|
||||
this.bundlePath = join(__dirname, '..', 'bundle/gemini.js');
|
||||
// Support testing native binaries via GEMINI_BINARY env variable
|
||||
if (env.GEMINI_BINARY) {
|
||||
this.binaryPath = env.GEMINI_BINARY;
|
||||
this.isNativeBinary = true;
|
||||
} else {
|
||||
this.bundlePath = join(__dirname, '..', 'bundle/gemini.js');
|
||||
this.isNativeBinary = false;
|
||||
}
|
||||
this.testDir = null;
|
||||
}
|
||||
|
||||
@@ -162,7 +169,9 @@ export class TestRig {
|
||||
}
|
||||
|
||||
run(promptOrOptions, ...args) {
|
||||
let command = `node ${this.bundlePath} --yolo`;
|
||||
let command = this.isNativeBinary
|
||||
? `${this.binaryPath} --yolo`
|
||||
: `node ${this.bundlePath} --yolo`;
|
||||
const execOptions = {
|
||||
cwd: this.testDir,
|
||||
encoding: 'utf-8',
|
||||
@@ -185,9 +194,9 @@ export class TestRig {
|
||||
command += ` ${args.join(' ')}`;
|
||||
|
||||
const commandArgs = parse(command);
|
||||
const node = commandArgs.shift();
|
||||
const executable = commandArgs.shift();
|
||||
|
||||
const child = spawn(node, commandArgs, {
|
||||
const child = spawn(executable, commandArgs, {
|
||||
cwd: this.testDir,
|
||||
stdio: 'pipe',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user