E2E Tests (Full Suite) #410
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Tests (Full Suite) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| aws_region: | |
| description: 'AWS region for deployment' | |
| default: 'us-east-1' | |
| schedule: | |
| - cron: '0 14 * * 1' # Every Monday at 9 AM EST (14:00 UTC) | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: e2e-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: false | |
| permissions: | |
| id-token: write # OIDC — lets GitHub assume an AWS IAM role via short-lived token (no stored keys) | |
| contents: read | |
| jobs: | |
| e2e: | |
| runs-on: ubuntu-latest | |
| environment: e2e-testing | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cdk-source: [npm, main] | |
| shard: ['1/6', '2/6', '3/6', '4/6', '5/6', '6/6'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || 'main' }} | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "ci@amazon.com" | |
| git config --global user.name "CI" | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: ${{ secrets.E2E_AWS_ROLE_ARN }} | |
| aws-region: ${{ inputs.aws_region || 'us-east-1' }} | |
| - name: Get AWS Account ID | |
| id: aws | |
| run: echo "account_id=$(aws sts get-caller-identity --query Account --output text)" >> "$GITHUB_OUTPUT" | |
| - name: Get API keys from Secrets Manager | |
| uses: aws-actions/aws-secretsmanager-get-secrets@v2 | |
| with: | |
| secret-ids: | | |
| E2E,${{ secrets.E2E_SECRET_ARN }} | |
| parse-json-secrets: true | |
| - run: npm ci | |
| - run: npm run build | |
| - name: Generate GitHub App Token | |
| if: matrix.cdk-source == 'main' | |
| id: app-token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| owner: aws | |
| - name: Build CDK package from main | |
| if: matrix.cdk-source == 'main' | |
| run: | | |
| git clone --depth 1 "https://x-access-token:${CDK_REPO_TOKEN}@github.com/${CDK_REPO}.git" /tmp/cdk-repo | |
| cd /tmp/cdk-repo | |
| npm ci | |
| npm run build | |
| TARBALL=$(npm pack --pack-destination "$RUNNER_TEMP" | tail -1) | |
| echo "CDK_TARBALL=$RUNNER_TEMP/$TARBALL" >> "$GITHUB_ENV" | |
| env: | |
| CDK_REPO_TOKEN: ${{ steps.app-token.outputs.token }} | |
| CDK_REPO: ${{ secrets.CDK_REPO_NAME }} | |
| - name: Install CLI globally | |
| run: npm install -g "$(npm pack | tail -1)" | |
| - name: Run E2E tests (${{ matrix.cdk-source }}, shard ${{ matrix.shard }}) | |
| env: | |
| AWS_ACCOUNT_ID: ${{ steps.aws.outputs.account_id }} | |
| AWS_REGION: ${{ inputs.aws_region || 'us-east-1' }} | |
| ANTHROPIC_API_KEY: ${{ env.E2E_ANTHROPIC_API_KEY }} | |
| OPENAI_API_KEY: ${{ env.E2E_OPENAI_API_KEY }} | |
| GEMINI_API_KEY: ${{ env.E2E_GEMINI_API_KEY }} | |
| CDK_TARBALL: ${{ env.CDK_TARBALL }} | |
| run: npx vitest run --project e2e --shard=${{ matrix.shard }} | |
| browser-tests: | |
| runs-on: ubuntu-latest | |
| environment: e2e-testing | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || 'main' }} | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "ci@amazon.com" | |
| git config --global user.name "CI" | |
| - uses: astral-sh/setup-uv@v7 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: ${{ secrets.E2E_AWS_ROLE_ARN }} | |
| aws-region: ${{ inputs.aws_region || 'us-east-1' }} | |
| - name: Get AWS Account ID | |
| id: aws | |
| run: echo "account_id=$(aws sts get-caller-identity --query Account --output text)" >> "$GITHUB_OUTPUT" | |
| - run: npm ci | |
| - run: npm run build | |
| - name: Install CLI globally | |
| run: npm install -g "$(npm pack | tail -1)" | |
| - name: Install Playwright browsers | |
| run: npx playwright install chromium --with-deps | |
| - name: Run browser tests | |
| env: | |
| AWS_ACCOUNT_ID: ${{ steps.aws.outputs.account_id }} | |
| AWS_REGION: ${{ inputs.aws_region || 'us-east-1' }} | |
| PLAYWRIGHT_TRACE: 'off' | |
| run: npm run test:browser | |
| - name: Print browser test debug info | |
| if: failure() | |
| run: | | |
| echo "=== Dev server PTY output ===" | |
| cat browser-tests/test-results/agentcore-dev-pty.log 2>/dev/null || echo "(no pty log)" | |
| echo "" | |
| echo "=== Error contexts ===" | |
| find browser-tests/test-results -name 'error-context.md' -exec echo "--- {} ---" \; -exec cat {} \; 2>/dev/null || echo "(no error contexts)" |