diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000000..36e687ca03 --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -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 }}' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09d0be0929..e86f4d90d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d9dd36d58a..fcd4931411 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -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' diff --git a/.github/workflows/orchestrator.yml b/.github/workflows/orchestrator.yml new file mode 100644 index 0000000000..fed3d8eb0a --- /dev/null +++ b/.github/workflows/orchestrator.yml @@ -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 }} diff --git a/package-lock.json b/package-lock.json index 4460e187d1..a41fd70fc7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "packages/*" ], "dependencies": { - "@google-gemini/gemini-cli": "^0.11.0-nightly.20251021.0e7b3951", "@testing-library/dom": "^10.4.1", "simple-git": "^3.28.0" }, @@ -1458,159 +1457,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@google-gemini/gemini-cli": { - "version": "0.11.0-nightly.20251021.0e7b3951", - "resolved": "https://npm.pkg.github.com/download/@google-gemini/gemini-cli/0.11.0-nightly.20251021.0e7b3951/4dd4a330cc3538ee3a6333f57c55a795634229fe", - "integrity": "sha512-qkQ7xfH7ih9kq17IV9lQcuvp6eJxiiBZUgpEm1I2fvRHjFRzzaszcEh6D8lVqoS10sGnuj2OnI4pBZW5a8UzEQ==", - "dependencies": { - "@google-gemini/gemini-cli-core": "0.11.0-nightly.20251021.0e7b3951" - }, - "bin": { - "gemini": "bundle/gemini.js" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@google-gemini/gemini-cli-core": { - "version": "0.11.0-nightly.20251021.0e7b3951", - "resolved": "https://npm.pkg.github.com/download/@google-gemini/gemini-cli-core/0.11.0-nightly.20251021.0e7b3951/612a101caade1e1df620ce84e3cf83fb66f46a12", - "integrity": "sha512-pu4KiOrjM5FVCH2LnqhirOWIHodg+giOl0nASROenzFaUD1G7/FYFT9T+OY8pmGtnrfI+dNrVolp3G5mI2Ij/w==", - "dependencies": { - "@google-cloud/logging": "^11.2.1", - "@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.21.0", - "@google-cloud/opentelemetry-cloud-trace-exporter": "^3.0.0", - "@google/genai": "1.16.0", - "@joshua.litt/get-ripgrep": "^0.0.2", - "@modelcontextprotocol/sdk": "^1.11.0", - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/exporter-logs-otlp-grpc": "^0.203.0", - "@opentelemetry/exporter-logs-otlp-http": "^0.203.0", - "@opentelemetry/exporter-metrics-otlp-grpc": "^0.203.0", - "@opentelemetry/exporter-metrics-otlp-http": "^0.203.0", - "@opentelemetry/exporter-trace-otlp-grpc": "^0.203.0", - "@opentelemetry/exporter-trace-otlp-http": "^0.203.0", - "@opentelemetry/instrumentation-http": "^0.203.0", - "@opentelemetry/resource-detector-gcp": "^0.40.0", - "@opentelemetry/sdk-node": "^0.203.0", - "@types/glob": "^8.1.0", - "@types/html-to-text": "^9.0.4", - "@xterm/headless": "5.5.0", - "ajv": "^8.17.1", - "ajv-formats": "^3.0.0", - "chardet": "^2.1.0", - "diff": "^7.0.0", - "dotenv": "^17.1.0", - "fast-levenshtein": "^2.0.6", - "fast-uri": "^3.0.6", - "fdir": "^6.4.6", - "fzf": "^0.5.2", - "glob": "^10.4.5", - "google-auth-library": "^9.11.0", - "html-to-text": "^9.0.5", - "https-proxy-agent": "^7.0.6", - "ignore": "^7.0.0", - "marked": "^15.0.12", - "mime": "4.0.7", - "mnemonist": "^0.40.3", - "open": "^10.1.2", - "picomatch": "^4.0.1", - "shell-quote": "^1.8.3", - "simple-git": "^3.28.0", - "strip-ansi": "^7.1.0", - "tree-sitter-bash": "^0.25.0", - "undici": "^7.10.0", - "web-tree-sitter": "^0.25.10", - "ws": "^8.18.0" - }, - "engines": { - "node": ">=20" - }, - "optionalDependencies": { - "@lydell/node-pty": "1.1.0", - "@lydell/node-pty-darwin-arm64": "1.1.0", - "@lydell/node-pty-darwin-x64": "1.1.0", - "@lydell/node-pty-linux-x64": "1.1.0", - "@lydell/node-pty-win32-arm64": "1.1.0", - "@lydell/node-pty-win32-x64": "1.1.0", - "node-pty": "^1.0.0" - } - }, - "node_modules/@google-gemini/gemini-cli-core/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@google-gemini/gemini-cli-core/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/@google-gemini/gemini-cli-core/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/@google-gemini/gemini-cli-core/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "license": "MIT" - }, - "node_modules/@google-gemini/gemini-cli-core/node_modules/mime": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.7.tgz", - "integrity": "sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==", - "funding": [ - "https://github.com/sponsors/broofa" - ], - "license": "MIT", - "bin": { - "mime": "bin/cli.js" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@google-gemini/gemini-cli-core/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/@google/gemini-cli": { "resolved": "packages/cli", "link": true diff --git a/package.json b/package.json index d121587ed3..96da12b4fc 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,6 @@ "yargs": "^17.7.2" }, "dependencies": { - "@google-gemini/gemini-cli": "^0.11.0-nightly.20251021.0e7b3951", "@testing-library/dom": "^10.4.1", "simple-git": "^3.28.0" },