feat(ci): Implement orchestrator workflow for unified build and test

This commit is contained in:
mkorwel
2025-10-21 19:21:45 -07:00
parent 8383974276
commit ff3398f297
6 changed files with 136 additions and 237 deletions
+52
View File
@@ -0,0 +1,52 @@
# .github/workflows/build-and-publish.yml
name: 'Build and Publish Bundle'
on:
workflow_call:
outputs:
tag:
description: "The tag of the published package"
value: ${{ jobs.publish-bundle.outputs.tag }}
jobs:
publish-bundle:
name: 'Publish Bundle'
runs-on: 'gemini-cli-ubuntu-16-core'
outputs:
tag: ${{ steps.get_tag.outputs.tag }}
permissions:
contents: 'read'
packages: 'write'
steps:
- name: 'Checkout'
uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5
with:
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
fetch-depth: 0
- name: 'Set up Node.js'
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions/setup-node@v4.4.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: 'Install dependencies'
run: 'npm ci'
- name: 'Configure npm for GitHub Packages'
run: |
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: 'Prepare for GitHub release'
run: 'node scripts/prepare-github-release.js'
- name: 'Bundle'
run: 'npm run bundle'
- name: 'Get tag'
id: get_tag
run: echo "tag=ci-${{ github.sha }}" >> $GITHUB_OUTPUT
- name: 'Publish to GitHub Packages'
run: 'npm publish --tag=${{ steps.get_tag.outputs.tag }}'
+39 -47
View File
@@ -1,22 +1,10 @@
name: 'Testing: CI'
on:
push:
branches:
- 'main'
- 'release/**'
pull_request:
branches:
- 'main'
- 'release/**'
merge_group:
workflow_dispatch:
workflow_call:
inputs:
branch_ref:
description: 'Branch to run on'
tag:
description: 'The tag of the published package'
required: true
default: 'main'
type: 'string'
type: string
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
@@ -48,7 +36,8 @@ jobs:
lint:
name: 'Lint'
runs-on: 'gemini-cli-ubuntu-16-core'
needs: 'merge_queue_skipper'
needs:
- 'merge_queue_skipper'
if: "${{needs.merge_queue_skipper.outputs.skip == 'false'}}"
steps:
- name: 'Checkout'
@@ -120,22 +109,21 @@ jobs:
node-version: '${{ matrix.node-version }}'
cache: 'npm'
- name: 'Build project'
run: 'npm run build'
- name: 'Configure npm for GitHub Packages'
run: |
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: 'Install dependencies for testing'
run: 'npm ci'
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
- name: 'Run tests and generate reports'
env:
NO_COLOR: true
run: 'npm run test:ci'
- name: 'Bundle'
run: 'npm run bundle'
- name: 'Smoke test bundle'
run: 'node ./bundle/gemini.js --version'
run: 'gemini --version'
- name: 'Wait for file system sync'
run: 'sleep 2'
@@ -188,22 +176,21 @@ jobs:
node-version: '${{ matrix.node-version }}'
cache: 'npm'
- name: 'Build project'
run: 'npm run build'
- name: 'Configure npm for GitHub Packages'
run: |
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: 'Install dependencies for testing'
run: 'npm ci'
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
- name: 'Run tests and generate reports'
env:
NO_COLOR: true
run: 'npm run test:ci -- --coverage.enabled=false'
- name: 'Bundle'
run: 'npm run bundle'
- name: 'Smoke test bundle'
run: 'node ./bundle/gemini.js --version'
run: 'gemini --version'
- name: 'Wait for file system sync'
run: 'sleep 2'
@@ -237,7 +224,8 @@ jobs:
codeql:
name: 'CodeQL'
runs-on: 'gemini-cli-ubuntu-16-core'
needs: 'merge_queue_skipper'
needs:
- 'merge_queue_skipper'
if: "${{needs.merge_queue_skipper.outputs.skip == 'false'}}"
permissions:
actions: 'read'
@@ -260,7 +248,8 @@ jobs:
# Check for changes in bundle size.
bundle_size:
name: 'Check Bundle Size'
needs: 'merge_queue_skipper'
needs:
- 'merge_queue_skipper'
if: "${{github.event_name == 'pull_request' && needs.merge_queue_skipper.outputs.skip == 'false'}}"
runs-on: 'gemini-cli-ubuntu-16-core'
permissions:
@@ -274,6 +263,14 @@ jobs:
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
fetch-depth: 1
- name: 'Configure npm for GitHub Packages'
run: |
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: 'Install bundle'
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
- uses: 'preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a'
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
@@ -285,7 +282,8 @@ jobs:
test_windows:
name: 'Slow Test - Win'
runs-on: 'gemini-cli-windows-16-core'
needs: 'merge_queue_skipper'
needs:
- 'merge_queue_skipper'
if: "${{needs.merge_queue_skipper.outputs.skip == 'false'}}"
continue-on-error: true
@@ -319,17 +317,15 @@ jobs:
npm config set registry https://registry.npmjs.org/
shell: 'pwsh'
- name: 'Install dependencies'
run: 'npm ci'
- name: 'Configure npm for GitHub Packages'
run: |
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
shell: 'pwsh'
- name: 'Build project'
run: 'npm run build'
- name: 'Install dependencies'
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
shell: 'pwsh'
env:
NODE_OPTIONS: '--max-old-space-size=32768 --max-semi-space-size=256'
UV_THREADPOOL_SIZE: '32'
NODE_ENV: 'production'
- name: 'Run tests and generate reports'
env:
@@ -341,12 +337,8 @@ jobs:
run: 'npm run test:ci -- --coverage.enabled=false'
shell: 'pwsh'
- name: 'Bundle'
run: 'npm run bundle'
shell: 'pwsh'
- name: 'Smoke test bundle'
run: 'node ./bundle/gemini.js --version'
run: 'gemini --version'
shell: 'pwsh'
ci:
+13 -35
View File
@@ -1,25 +1,10 @@
name: 'Testing: E2E'
on:
push:
branches:
- 'main'
# This will run for PRs from the base repository, providing secrets.
pull_request:
branches:
- 'main'
- 'release/**'
# This will run for PRs from forks when a label is added.
pull_request_target:
types: ['labeled']
merge_group:
workflow_dispatch:
workflow_call:
inputs:
branch_ref:
description: 'Branch to run on'
tag:
description: 'The tag of the published package'
required: true
default: 'main'
type: 'string'
type: string
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
@@ -40,7 +25,8 @@ jobs:
e2e_linux:
name: 'E2E Test (Linux) - ${{ matrix.sandbox }}'
needs: 'merge_queue_skipper'
needs:
- 'merge_queue_skipper'
if: |
needs.merge_queue_skipper.outputs.skip == 'false' &&
(github.event_name == 'push' ||
@@ -83,10 +69,7 @@ jobs:
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: 'Install dependencies'
run: 'npm ci'
- name: 'Build project'
run: 'npm run build'
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
- name: 'Set up Docker'
if: "matrix.sandbox == 'sandbox:docker'"
@@ -107,7 +90,8 @@ jobs:
e2e_mac:
name: 'E2E Test (macOS)'
needs: 'merge_queue_skipper'
needs:
- 'merge_queue_skipper'
if: |
needs.merge_queue_skipper.outputs.skip == 'false' &&
(github.event_name == 'push' ||
@@ -141,10 +125,7 @@ jobs:
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: 'Install dependencies'
run: 'npm ci'
- name: 'Build project'
run: 'npm run build'
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
- name: 'Fix rollup optional dependencies on macOS'
if: "runner.os == 'macOS'"
@@ -161,7 +142,8 @@ jobs:
e2e_windows:
name: 'Slow E2E - Win'
needs: 'merge_queue_skipper'
needs:
- 'merge_queue_skipper'
if: |
needs.merge_queue_skipper.outputs.skip == 'false' &&
(github.event_name == 'push' ||
@@ -217,11 +199,7 @@ jobs:
shell: 'pwsh'
- name: 'Install dependencies'
run: 'npm ci'
shell: 'pwsh'
- name: 'Build project'
run: 'npm run build'
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
shell: 'pwsh'
- name: 'Run E2E tests'
+32
View File
@@ -0,0 +1,32 @@
# .github/workflows/pr-checks.yml
name: 'PR Checks'
on:
pull_request:
branches:
- 'main'
- 'release/**'
merge_group:
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-and-publish:
name: 'Build and Publish CI Bundle'
uses: ./.github/workflows/build-and-publish.yml
ci:
name: 'CI Checks'
needs: build-and-publish
uses: ./.github/workflows/ci.yml
with:
tag: ${{ needs.build-and-publish.outputs.tag }}
e2e:
name: 'E2E Checks'
needs: build-and-publish
uses: ./.github/workflows/e2e.yml
with:
tag: ${{ needs.build-and-publish.outputs.tag }}