diff --git a/.github/actions/setup-gemini/action.yml b/.github/actions/setup-gemini/action.yml new file mode 100644 index 0000000000..81b0aaab55 --- /dev/null +++ b/.github/actions/setup-gemini/action.yml @@ -0,0 +1,45 @@ +name: 'Setup Gemini CLI' +description: 'Sets up the environment and either builds from source or uses a pre-built bundle.' + +inputs: + mode: + description: 'Setup mode: "source" (build from scratch) or "bundle" (use pre-built artifact)' + required: true + default: 'source' + bundle-artifact: + description: 'The name of the bundle artifact to download if mode is "bundle"' + required: false + +runs: + using: 'composite' + steps: + - name: 'Set up Node.js' + uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: 'Install dependencies' + run: 'npm ci' + shell: 'bash' + + - name: 'Build from source' + if: "${{ inputs.mode == 'source' }}" + run: 'npm run build' + shell: 'bash' + + - name: 'Download Bundle Artifact' + if: "${{ inputs.mode == 'bundle' }}" + uses: 'actions/download-artifact@fa0b912c4d7dad43192612d645081918b6b3fb81' # v4 + with: + name: '${{ inputs.bundle-artifact }}' + path: 'bundle' + + - name: 'Post-bundle setup' + if: "${{ inputs.mode == 'bundle' }}" + run: | + # Ensure the bundle is ready for use + # In a real install, we might symlink bin/gemini to bundle/gemini.js + # For now, we just list it to verify it exists + ls -R bundle + shell: 'bash' diff --git a/.github/workflows/ci-bundling-trial.yml b/.github/workflows/ci-bundling-trial.yml new file mode 100644 index 0000000000..d0a99a5d35 --- /dev/null +++ b/.github/workflows/ci-bundling-trial.yml @@ -0,0 +1,49 @@ +name: 'Bundling Trial CI' + +on: + push: + branches: + - 'feat/ci-bundling-revamp' + +jobs: + build_bundle: + name: 'Build Bundle' + runs-on: 'gemini-cli-ubuntu-16-core' + steps: + - name: 'Checkout' + uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' + + - name: 'Set up Node' + uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: 'Install & Build' + run: | + npm ci + npm run bundle + + - name: 'Upload Bundle' + uses: 'actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02' # v4 + with: + name: 'gemini-bundle' + path: 'bundle/' + + test_with_bundle: + name: 'Test (Linux) - Bundled Trial' + needs: 'build_bundle' + runs-on: 'gemini-cli-ubuntu-16-core' + steps: + - name: 'Checkout' + uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' + + - name: 'Setup with Bundle' + uses: './.github/actions/setup-gemini' + with: + mode: 'bundle' + bundle-artifact: 'gemini-bundle' + + - name: 'Run CLI Tests' + run: 'npm run test:ci --workspace "@google/gemini-cli"' + shell: 'bash'