Make trigger_e2e manually fireable. (#14547)

This commit is contained in:
Tommaso Sciortino
2025-12-04 15:58:45 -08:00
committed by GitHub
parent 1c5213788c
commit f4f2bcbd98
2 changed files with 34 additions and 16 deletions

View File

@@ -42,9 +42,10 @@ jobs:
download_repo_name: download_repo_name:
runs-on: 'gemini-cli-ubuntu-16-core' runs-on: 'gemini-cli-ubuntu-16-core'
if: "github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run'" if: "${{github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run'}}"
outputs: outputs:
repo_name: '${{ steps.output-repo-name.outputs.repo_name }}' repo_name: '${{ steps.output-repo-name.outputs.repo_name }}'
head_sha: '${{ steps.output-repo-name.outputs.head_sha }}'
steps: steps:
- name: 'Mock Repo Artifact' - name: 'Mock Repo Artifact'
if: "${{ github.event_name == 'workflow_dispatch' }}" if: "${{ github.event_name == 'workflow_dispatch' }}"
@@ -66,7 +67,7 @@ jobs:
name: 'repo_name' name: 'repo_name'
run-id: '${{ env.RUN_ID }}' run-id: '${{ env.RUN_ID }}'
path: '${{ runner.temp }}/artifacts' path: '${{ runner.temp }}/artifacts'
- name: 'Output Repo Name' - name: 'Output Repo Name and SHA'
id: 'output-repo-name' id: 'output-repo-name'
uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8 uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8
with: with:
@@ -75,8 +76,16 @@ jobs:
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const temp = '${{ runner.temp }}/artifacts'; const temp = '${{ runner.temp }}/artifacts';
const repo_name = String(fs.readFileSync(path.join(temp, 'repo_name'))); const repoPath = path.join(temp, 'repo_name');
core.setOutput('repo_name', repo_name); if (fs.existsSync(repoPath)) {
const repo_name = String(fs.readFileSync(repoPath)).trim();
core.setOutput('repo_name', repo_name);
}
const shaPath = path.join(temp, 'head_sha');
if (fs.existsSync(shaPath)) {
const head_sha = String(fs.readFileSync(shaPath)).trim();
core.setOutput('head_sha', head_sha);
}
parse_run_context: parse_run_context:
name: 'Parse run context' name: 'Parse run context'
@@ -91,7 +100,7 @@ jobs:
name: 'Set dynamic repository and SHA' name: 'Set dynamic repository and SHA'
env: env:
REPO: '${{ needs.download_repo_name.outputs.repo_name || github.repository }}' REPO: '${{ needs.download_repo_name.outputs.repo_name || github.repository }}'
SHA: '${{ github.event.inputs.head_sha || github.event.workflow_run.head_sha || github.sha }}' SHA: '${{ needs.download_repo_name.outputs.head_sha || github.event.inputs.head_sha || github.event.workflow_run.head_sha || github.sha }}'
shell: 'bash' shell: 'bash'
run: | run: |
echo "REPO=$REPO" >> "$GITHUB_OUTPUT" echo "REPO=$REPO" >> "$GITHUB_OUTPUT"
@@ -100,7 +109,7 @@ jobs:
set_pending_status: set_pending_status:
runs-on: 'gemini-cli-ubuntu-16-core' runs-on: 'gemini-cli-ubuntu-16-core'
permissions: 'write-all' permissions: 'write-all'
if: "github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run'" if: "${{github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run'}}"
needs: needs:
- 'parse_run_context' - 'parse_run_context'
steps: steps:
@@ -113,6 +122,7 @@ jobs:
sha: '${{ needs.parse_run_context.outputs.sha }}' sha: '${{ needs.parse_run_context.outputs.sha }}'
token: '${{ secrets.GEMINI_CLI_ROBOT_GITHUB_PAT }}' token: '${{ secrets.GEMINI_CLI_ROBOT_GITHUB_PAT }}'
status: 'pending' status: 'pending'
context: 'E2E (Chained)'
e2e_linux: e2e_linux:
name: 'E2E Test (Linux) - ${{ matrix.sandbox }}' name: 'E2E Test (Linux) - ${{ matrix.sandbox }}'
@@ -150,7 +160,7 @@ jobs:
run: 'npm run build' run: 'npm run build'
- name: 'Set up Docker' - name: 'Set up Docker'
if: "matrix.sandbox == 'sandbox:docker'" if: "${{matrix.sandbox == 'sandbox:docker'}}"
uses: 'docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435' # ratchet:docker/setup-buildx-action@v3 uses: 'docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435' # ratchet:docker/setup-buildx-action@v3
- name: 'Run E2E tests' - name: 'Run E2E tests'
@@ -193,11 +203,11 @@ jobs:
run: 'npm run build' run: 'npm run build'
- name: 'Fix rollup optional dependencies on macOS' - name: 'Fix rollup optional dependencies on macOS'
if: "runner.os == 'macOS'" if: "${{runner.os == 'macOS'}}"
run: | run: |
npm cache clean --force npm cache clean --force
- name: 'Run E2E tests (non-Windows)' - name: 'Run E2E tests (non-Windows)'
if: "runner.os != 'Windows'" if: "${{runner.os != 'Windows'}}"
env: env:
GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}' GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}'
KEEP_OUTPUT: 'true' KEEP_OUTPUT: 'true'
@@ -288,7 +298,7 @@ jobs:
set_workflow_status: set_workflow_status:
runs-on: 'gemini-cli-ubuntu-16-core' runs-on: 'gemini-cli-ubuntu-16-core'
permissions: 'write-all' permissions: 'write-all'
if: "github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run'" if: "${{github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run'}}"
needs: needs:
- 'parse_run_context' - 'parse_run_context'
- 'e2e' - 'e2e'
@@ -302,3 +312,4 @@ jobs:
sha: '${{ needs.parse_run_context.outputs.sha }}' sha: '${{ needs.parse_run_context.outputs.sha }}'
token: '${{ secrets.GITHUB_TOKEN }}' token: '${{ secrets.GITHUB_TOKEN }}'
status: '${{ job.status }}' status: '${{ job.status }}'
context: 'E2E (Chained)'

View File

@@ -3,11 +3,15 @@ name: 'Trigger E2E'
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
branch_ref: repo_name:
description: 'Branch to run on' description: 'Repository name (e.g., owner/repo)'
required: true required: false
default: 'main'
type: 'string' type: 'string'
head_sha:
description: 'SHA of the commit to test'
required: false
type: 'string'
# pull_request:
jobs: jobs:
save_repo_name: save_repo_name:
@@ -15,11 +19,14 @@ jobs:
steps: steps:
- name: 'Save Repo name' - name: 'Save Repo name'
env: env:
# Replace with github.event.pull_request.head.repo.full_name when switched to listen on pull request events. This repo name does not contain the org which is needed for checkout. # add "|| github.event.pull_request.head.repo.full_name"
REPO_NAME: '${{ github.event.repository.name }}' REPO_NAME: '${{ github.event.inputs.repo_name || github.event.repository.name }}'
# add "|| github.event.pull_request.head.sha"
HEAD_SHA: '${{ github.event.inputs.head_sha }}'
run: | run: |
mkdir -p ./pr mkdir -p ./pr
echo '${{ env.REPO_NAME }}' > ./pr/repo_name echo '${{ env.REPO_NAME }}' > ./pr/repo_name
echo '${{ env.HEAD_SHA }}' > ./pr/head_sha
- uses: 'actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02' # ratchet:actions/upload-artifact@v4 - uses: 'actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02' # ratchet:actions/upload-artifact@v4
with: with:
name: 'repo_name' name: 'repo_name'