|
4 | 4 | workflow_run: |
5 | 5 | workflows: ['Trigger E2E'] |
6 | 6 | types: ['completed'] |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + head_sha: |
| 10 | + description: 'SHA of the commit to test' |
| 11 | + required: true |
| 12 | + repo_name: |
| 13 | + description: 'Repository name (e.g., owner/repo)' |
| 14 | + required: true |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}' |
| 18 | + cancel-in-progress: |- |
| 19 | + ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/release/') }} |
7 | 20 |
|
8 | 21 | jobs: |
9 | | - chained_e2e: |
10 | | - name: 'Chained e2e' |
| 22 | + merge_queue_skipper: |
| 23 | + name: 'Merge Queue Skipper' |
| 24 | + runs-on: 'gemini-cli-ubuntu-16-core' |
| 25 | + outputs: |
| 26 | + skip: '${{ steps.merge-queue-e2e-skipper.outputs.skip-check }}' |
| 27 | + steps: |
| 28 | + - id: 'merge-queue-e2e-skipper' |
| 29 | + uses: 'cariad-tech/merge-queue-ci-skipper@1032489e59437862c90a08a2c92809c903883772' # ratchet:cariad-tech/merge-queue-ci-skipper@main |
| 30 | + with: |
| 31 | + secret: '${{ secrets.GITHUB_TOKEN }}' |
| 32 | + |
| 33 | + download_repo_name: |
| 34 | + runs-on: 'gemini-cli-ubuntu-16-core' |
| 35 | + outputs: |
| 36 | + repo_name: '${{ steps.output-repo-name.outputs.repo_name }}' |
| 37 | + steps: |
| 38 | + - name: 'Download artifact' |
| 39 | + if: "${{ github.event_name == 'workflow_run' }}" |
| 40 | + uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8 |
| 41 | + with: |
| 42 | + script: | |
| 43 | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ |
| 44 | + owner: context.repo.owner, |
| 45 | + repo: context.repo.repo, |
| 46 | + run_id: context.payload.workflow_run.id, |
| 47 | + }); |
| 48 | + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { |
| 49 | + return artifact.name == "repo_name" |
| 50 | + })[0]; |
| 51 | + let download = await github.rest.actions.downloadArtifact({ |
| 52 | + owner: context.repo.owner, |
| 53 | + repo: context.repo.repo, |
| 54 | + artifact_id: matchArtifact.id, |
| 55 | + archive_format: 'zip', |
| 56 | + }); |
| 57 | + const fs = require('fs'); |
| 58 | + const path = require('path'); |
| 59 | + const temp = '${{ runner.temp }}/artifacts'; |
| 60 | + if (!fs.existsSync(temp)){ |
| 61 | + fs.mkdirSync(temp); |
| 62 | + } |
| 63 | + fs.writeFileSync(path.join(temp, 'repo_name.zip'), Buffer.from(download.data)); |
| 64 | + - name: 'Unzip artifact' |
| 65 | + if: "${{ github.event_name == 'workflow_run' }}" |
| 66 | + run: 'unzip "${{ runner.temp }}/artifacts/repo_name.zip" -d "${{ runner.temp }}/artifacts"' |
| 67 | + - name: 'Output Repo Name' |
| 68 | + if: "${{ github.event_name == 'workflow_run' }}" |
| 69 | + id: 'output-repo-name' |
| 70 | + uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8 |
| 71 | + with: |
| 72 | + github-token: '${{ secrets.GITHUB_TOKEN }}' |
| 73 | + script: | |
| 74 | + const fs = require('fs'); |
| 75 | + const path = require('path'); |
| 76 | + const temp = '${{ runner.temp }}/artifacts'; |
| 77 | + const repo_name = Number(fs.readFileSync(path.join(temp, 'repo_name'))); |
| 78 | + core.setOutput('repo_name', repo_name);' |
| 79 | + core: true |
| 80 | + - name: 'Output Input Repo Name' |
| 81 | + if: "${{ github.event_name != 'workflow_run' }}" |
| 82 | + id: 'output-input-repo-name' |
| 83 | + run: | |
| 84 | + echo "repo_name=${{ github.event.inputs.repo_name }}" >> "$GITHUB_OUTPUT" |
| 85 | + shell: 'bash' |
| 86 | + |
| 87 | + e2e_linux: |
| 88 | + name: 'E2E Test (Linux) - ${{ matrix.sandbox }}' |
| 89 | + needs: 'download_repo_name' |
| 90 | + runs-on: 'gemini-cli-ubuntu-16-core' |
| 91 | + strategy: |
| 92 | + fail-fast: false |
| 93 | + matrix: |
| 94 | + sandbox: |
| 95 | + - 'sandbox:none' |
| 96 | + - 'sandbox:docker' |
| 97 | + node-version: |
| 98 | + - '20.x' |
| 99 | + |
| 100 | + steps: |
| 101 | + - name: 'Checkout' |
| 102 | + uses: 'actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955' # ratchet:actions/checkout@v5 |
| 103 | + with: |
| 104 | + ref: '${{ github.event.inputs.head_sha || github.event.workflow_run.head_sha }}' |
| 105 | + repository: '${{ needs.download_repo_name.outputs.repo_name }}' |
| 106 | + |
| 107 | + - name: 'Set up Node.js ${{ matrix.node-version }}' |
| 108 | + uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions-node@v4 |
| 109 | + with: |
| 110 | + node-version: '${{ matrix.node-version }}' |
| 111 | + |
| 112 | + - name: 'Install dependencies' |
| 113 | + run: 'npm ci' |
| 114 | + |
| 115 | + - name: 'Build project' |
| 116 | + run: 'npm run build' |
| 117 | + |
| 118 | + - name: 'Set up Docker' |
| 119 | + if: "matrix.sandbox == 'sandbox:docker'" |
| 120 | + uses: 'docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435' # ratchet:docker/setup-buildx-action@v3 |
| 121 | + |
| 122 | + - name: 'Run E2E tests' |
| 123 | + env: |
| 124 | + GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}' |
| 125 | + KEEP_OUTPUT: 'true' |
| 126 | + VERBOSE: 'true' |
| 127 | + shell: 'bash' |
| 128 | + run: | |
| 129 | + if [[ "${{ matrix.sandbox }}" == "sandbox:docker" ]]; then |
| 130 | + npm run test:integration:sandbox:docker |
| 131 | + else |
| 132 | + npm run test:integration:sandbox:none |
| 133 | + fi |
| 134 | +
|
| 135 | + e2e_mac: |
| 136 | + name: 'E2E Test (macOS)' |
| 137 | + needs: 'download_repo_name' |
| 138 | + runs-on: 'macos-latest' |
| 139 | + steps: |
| 140 | + - name: 'Checkout' |
| 141 | + uses: 'actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955' # ratchet:actions/checkout@v5 |
| 142 | + with: |
| 143 | + ref: '${{ github.event.inputs.head_sha || github.event.workflow_run.head_sha }}' |
| 144 | + repository: '${{ needs.download_repo_name.outputs.repo_name }}' |
| 145 | + |
| 146 | + - name: 'Set up Node.js 20.x' |
| 147 | + uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions-node@v4 |
| 148 | + with: |
| 149 | + node-version: '20.x' |
| 150 | + |
| 151 | + - name: 'Install dependencies' |
| 152 | + run: 'npm ci' |
| 153 | + |
| 154 | + - name: 'Build project' |
| 155 | + run: 'npm run build' |
| 156 | + |
| 157 | + - name: 'Fix rollup optional dependencies on macOS' |
| 158 | + if: "runner.os == 'macOS'" |
| 159 | + run: | |
| 160 | + npm cache clean --force |
| 161 | + - name: 'Run E2E tests (non-Windows)' |
| 162 | + if: "runner.os != 'Windows'" |
| 163 | + env: |
| 164 | + GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}' |
| 165 | + KEEP_OUTPUT: 'true' |
| 166 | + SANDBOX: 'sandbox:none' |
| 167 | + VERBOSE: 'true' |
| 168 | + run: 'npm run test:integration:sandbox:none' |
| 169 | + |
| 170 | + e2e_windows: |
| 171 | + name: 'Slow E2E - Win' |
| 172 | + needs: |
| 173 | + - 'merge_queue_skipper' |
| 174 | + - 'download_repo_name' |
| 175 | + if: | |
| 176 | + needs.merge_queue_skipper.outputs.skip == 'false' |
| 177 | + runs-on: 'gemini-cli-windows-16-core' |
| 178 | + continue-on-error: true |
| 179 | + |
| 180 | + steps: |
| 181 | + - name: 'Checkout' |
| 182 | + uses: 'actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955' # ratchet:actions/checkout@v5 |
| 183 | + with: |
| 184 | + ref: '${{ github.event.inputs.head_sha || github.event.workflow_run.head_sha }}' |
| 185 | + repository: '${{ needs.download_repo_name.outputs.repo_name }}' |
| 186 | + |
| 187 | + - name: 'Set up Node.js 20.x' |
| 188 | + uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions-node@v4 |
| 189 | + with: |
| 190 | + node-version: '20.x' |
| 191 | + cache: 'npm' |
| 192 | + |
| 193 | + - name: 'Configure Windows Defender exclusions' |
| 194 | + run: | |
| 195 | + Add-MpPreference -ExclusionPath $env:GITHUB_WORKSPACE -Force |
| 196 | + Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE\node_modules" -Force |
| 197 | + Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE\packages" -Force |
| 198 | + Add-MpPreference -ExclusionPath "$env:TEMP" -Force |
| 199 | + shell: 'pwsh' |
| 200 | + |
| 201 | + - name: 'Configure npm for Windows performance' |
| 202 | + run: | |
| 203 | + npm config set progress false |
| 204 | + npm config set audit false |
| 205 | + npm config set fund false |
| 206 | + npm config set loglevel error |
| 207 | + npm config set maxsockets 32 |
| 208 | + npm config set registry https://registry.npmjs.org/ |
| 209 | + shell: 'pwsh' |
| 210 | + |
| 211 | + - name: 'Install dependencies' |
| 212 | + run: 'npm ci' |
| 213 | + shell: 'pwsh' |
| 214 | + |
| 215 | + - name: 'Build project' |
| 216 | + run: 'npm run build' |
| 217 | + shell: 'pwsh' |
| 218 | + |
| 219 | + - name: 'Run E2E tests' |
| 220 | + env: |
| 221 | + GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}' |
| 222 | + KEEP_OUTPUT: 'true' |
| 223 | + SANDBOX: 'sandbox:none' |
| 224 | + VERBOSE: 'true' |
| 225 | + NODE_OPTIONS: '--max-old-space-size=32768 --max-semi-space-size=256' |
| 226 | + UV_THREADPOOL_SIZE: '32' |
| 227 | + NODE_ENV: 'test' |
| 228 | + shell: 'pwsh' |
| 229 | + run: 'npm run test:integration:sandbox:none' |
| 230 | + |
| 231 | + e2e: |
| 232 | + name: 'E2E' |
| 233 | + if: | |
| 234 | + always() && needs.merge_queue_skipper.outputs.skip == 'false' |
| 235 | + needs: |
| 236 | + - 'e2e_linux' |
| 237 | + - 'e2e_mac' |
| 238 | + - 'merge_queue_skipper' |
11 | 239 | runs-on: 'gemini-cli-ubuntu-16-core' |
12 | 240 | steps: |
13 | | - - id: 'chained-e2e' |
| 241 | + - name: 'Check E2E test results' |
14 | 242 | run: | |
15 | | - echo "Chained e2e workflow" |
| 243 | + if [[ ${{ needs.e2e_linux.result }} != 'success' || \ |
| 244 | + ${{ needs.e2e_mac.result }} != 'success' ]]; then |
| 245 | + echo "One or more E2E jobs failed." |
| 246 | + exit 1 |
| 247 | + fi |
| 248 | + echo "All required E2E jobs passed!" |
0 commit comments