Release misc (#3418)

This commit is contained in:
matt korwel 2025-07-06 20:16:42 -07:00 committed by GitHub
parent 39d4095a4c
commit 20825e4114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 52 additions and 25 deletions

View File

@ -168,6 +168,6 @@ jobs:
gh issue create \ gh issue create \
--title "Release Failed for ${{ steps.version.outputs.RELEASE_TAG || 'N/A' }} on $(date +'%Y-%m-%d')" \ --title "Release Failed for ${{ steps.version.outputs.RELEASE_TAG || 'N/A' }} on $(date +'%Y-%m-%d')" \
--body "The release workflow failed. See the full run for details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ --body "The release workflow failed. See the full run for details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--label "type: bug,release-failure" --label "kind/bug,release-failure"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

10
.vscode/launch.json vendored
View File

@ -21,10 +21,14 @@
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"name": "Launch E2E", "name": "Launch E2E",
"runtimeExecutable": "npm", "program": "${workspaceFolder}/integration-tests/run-tests.js",
"runtimeArgs": ["run", "test:e2e", "read_many_files"], "args": ["--verbose", "--keep-output", "list_directory"],
"skipFiles": ["<node_internals>/**"], "skipFiles": ["<node_internals>/**"],
"cwd": "${workspaceFolder}" "cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"env": {
"GEMINI_SANDBOX": "false"
}
}, },
{ {
"name": "Attach", "name": "Attach",

View File

@ -15,11 +15,10 @@ test('should be able to list a directory', async (t) => {
rig.mkdir('subdir'); rig.mkdir('subdir');
rig.sync(); rig.sync();
const prompt = `Can you list the files in the current directory`; const prompt = `Can you list the files in the current directory. Display them in the style of 'ls'`;
const result = await rig.run(prompt); const result = rig.run(prompt);
const lines = result.split('\n').filter((line) => line.trim() !== ''); const lines = result.split('\n').filter((line) => line.trim() !== '');
assert.equal(lines.length, 2); assert.ok(lines.some((line) => line.includes('file1.txt')));
assert.ok(lines.includes('file1.txt')); assert.ok(lines.some((line) => line.includes('subdir')));
assert.ok(lines.includes('subdir'));
}); });

View File

@ -72,35 +72,59 @@ async function main() {
`------------- Running test file: ${testFileName} ------------------------------`, `------------- Running test file: ${testFileName} ------------------------------`,
); );
const child = spawn('node', ['--test', testFile], { const nodeArgs = ['--test'];
if (verbose) {
nodeArgs.push('--test-reporter=spec');
}
nodeArgs.push(testFile);
const child = spawn('node', nodeArgs, {
stdio: 'pipe', stdio: 'pipe',
env: { env: {
...process.env, ...process.env,
GEMINI_CLI_INTEGRATION_TEST: 'true', GEMINI_CLI_INTEGRATION_TEST: 'true',
INTEGRATION_TEST_FILE_DIR: testFileDir, INTEGRATION_TEST_FILE_DIR: testFileDir,
KEEP_OUTPUT: keepOutput.toString(), KEEP_OUTPUT: keepOutput.toString(),
VERBOSE: verbose.toString(),
TEST_FILE_NAME: testFileName, TEST_FILE_NAME: testFileName,
}, },
}); });
if (verbose) { let outputStream;
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
}
if (keepOutput) { if (keepOutput) {
const outputFile = join(testFileDir, 'output.log'); const outputFile = join(testFileDir, 'output.log');
const outputStream = createWriteStream(outputFile); outputStream = createWriteStream(outputFile);
child.stdout.pipe(outputStream);
child.stderr.pipe(outputStream);
console.log(`Output for ${testFileName} written to: ${outputFile}`); console.log(`Output for ${testFileName} written to: ${outputFile}`);
} else if (!verbose) {
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
} }
child.stdout.on('data', (data) => {
if (verbose) {
process.stdout.write(data);
}
if (outputStream) {
outputStream.write(data);
}
});
child.stderr.on('data', (data) => {
if (verbose) {
process.stderr.write(data);
}
if (outputStream) {
outputStream.write(data);
}
});
const exitCode = await new Promise((resolve) => { const exitCode = await new Promise((resolve) => {
child.on('close', resolve); child.on('close', (code) => {
if (outputStream) {
outputStream.end(() => {
resolve(code);
});
} else {
resolve(code);
}
});
}); });
if (exitCode !== 0) { if (exitCode !== 0) {

View File

@ -72,7 +72,7 @@ export class TestRig {
const output = execSync(command, execOptions); const output = execSync(command, execOptions);
if (env.KEEP_OUTPUT === 'true') { if (env.KEEP_OUTPUT === 'true' || env.VERBOSE === 'true') {
const testId = `${env.TEST_FILE_NAME.replace( const testId = `${env.TEST_FILE_NAME.replace(
'.test.js', '.test.js',
'', '',
@ -87,7 +87,7 @@ export class TestRig {
readFile(fileName) { readFile(fileName) {
const content = readFileSync(join(this.testDir, fileName), 'utf-8'); const content = readFileSync(join(this.testDir, fileName), 'utf-8');
if (env.KEEP_OUTPUT === 'true') { if (env.KEEP_OUTPUT === 'true' || env.VERBOSE === 'true') {
const testId = `${env.TEST_FILE_NAME.replace( const testId = `${env.TEST_FILE_NAME.replace(
'.test.js', '.test.js',
'', '',

View File

@ -30,7 +30,7 @@
"test:integration:sandbox:none": "GEMINI_SANDBOX=false node integration-tests/run-tests.js", "test:integration:sandbox:none": "GEMINI_SANDBOX=false node integration-tests/run-tests.js",
"test:integration:sandbox:docker": "GEMINI_SANDBOX=docker node integration-tests/run-tests.js", "test:integration:sandbox:docker": "GEMINI_SANDBOX=docker node integration-tests/run-tests.js",
"test:integration:sandbox:podman": "GEMINI_SANDBOX=podman node integration-tests/run-tests.js", "test:integration:sandbox:podman": "GEMINI_SANDBOX=podman node integration-tests/run-tests.js",
"test:scripts": "vitest --config ./scripts/tests/vitest.config.ts", "test:scripts": "vitest run --config ./scripts/tests/vitest.config.ts",
"start": "node scripts/start.js", "start": "node scripts/start.js",
"debug": "cross-env DEBUG=1 node --inspect-brk scripts/start.js", "debug": "cross-env DEBUG=1 node --inspect-brk scripts/start.js",
"lint:fix": "eslint . --fix && eslint integration-tests --fix", "lint:fix": "eslint . --fix && eslint integration-tests --fix",