Skip to content

chore: bump main to 0.26.0, preview to 1.0.0-preview.25 (#1912) #724

chore: bump main to 0.26.0, preview to 1.0.0-preview.25 (#1912)

chore: bump main to 0.26.0, preview to 1.0.0-preview.25 (#1912) #724

name: E2E Tests (Full Suite)
on:
workflow_dispatch:
inputs:
aws_region:
description: 'AWS region for deployment'
default: 'us-east-1'
cdk_branch:
description: 'Branch of CDK constructs repo to build from'
default: 'main'
push:
branches: [main, 'feat/**']
env:
AGENTCORE_TELEMETRY_DISABLED: '1'
concurrency:
group: e2e-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
e2e:
runs-on: codebuild-agentcore-e2e-${{ github.run_id }}-${{ github.run_attempt }}
environment: e2e-testing
permissions:
id-token: write # OIDC - lets this job assume the E2E AWS role.
contents: read
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shard: ['1/5', '2/5', '3/5', '4/5', '5/5']
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
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: Fetch secrets from Secrets Manager
uses: aws/agentcore-devx-devtools/.github/actions/fetch-secrets@31aa3b031a86664e29861d68956e44b07cf21a74
with:
role-arn: ${{ secrets.WORKFLOW_SECRETS_READER_ROLE_ARN }}
shared: CDK_REPO_NAME
repo:
E2E_AWS_ROLE_ARN, E2E_ANTHROPIC_API_KEY, E2E_OPENAI_API_KEY, E2E_GEMINI_API_KEY, E2E_EFS_ACCESS_POINT_ARN,
E2E_S3_ACCESS_POINT_ARN, E2E_FILESYSTEM_SUBNET_ID, E2E_FILESYSTEM_SECURITY_GROUP_ID, E2E_CDP_API_KEY_ID,
E2E_CDP_API_KEY_SECRET, E2E_CDP_WALLET_SECRET
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ env.E2E_AWS_ROLE_ARN }}
aws-region: ${{ inputs.aws_region || 'us-east-1' }}
unset-current-credentials: true
- 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
- name: Build CLI
run: npm run build
- name: Resolve private CDK repository
id: cdk-repo
env:
CDK_REPO: ${{ env.CDK_REPO_NAME }}
run: |
owner="${CDK_REPO%%/*}"
repository="${CDK_REPO#*/}"
if [[ -z "$owner" || -z "$repository" || "$repository" == */* || "$owner/$repository" != "$CDK_REPO" ]]; then
echo "::error::CDK_REPO_NAME must use the owner/repository format"
exit 1
fi
echo "owner=$owner" >> "$GITHUB_OUTPUT"
echo "repository=$repository" >> "$GITHUB_OUTPUT"
- name: Generate repository-scoped GitHub App token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ steps.cdk-repo.outputs.owner }}
repositories: ${{ steps.cdk-repo.outputs.repository }}
permission-contents: read
skip-token-revoke: true
- name: Clone CDK repository
run: |
if [ -n "${{ inputs.cdk_branch }}" ] && [ "${{ inputs.cdk_branch }}" != "main" ]; then
CDK_BRANCH="${{ inputs.cdk_branch }}"
elif [ "${{ github.ref_name }}" != "main" ]; then
CDK_BRANCH="main"
REPO_URL="https://x-access-token:${CDK_REPO_TOKEN}@github.com/${CDK_REPO}.git"
# Check if a branch exists on the CDK repo with the same name
if git ls-remote --exit-code --heads "$REPO_URL" "${{ github.ref_name }}" > /dev/null 2>&1; then
CDK_BRANCH="${{ github.ref_name }}"
fi
else
CDK_BRANCH="main"
fi
echo "Using CDK branch: $CDK_BRANCH"
git clone --depth 1 --branch "$CDK_BRANCH" "https://x-access-token:${CDK_REPO_TOKEN}@github.com/${CDK_REPO}.git" /tmp/cdk-repo
git -C /tmp/cdk-repo remote remove origin
env:
CDK_REPO_TOKEN: ${{ steps.app-token.outputs.token }}
CDK_REPO: ${{ env.CDK_REPO_NAME }}
- name: Revoke GitHub App token
if: always() && steps.app-token.outputs.token != ''
env:
CDK_REPO_TOKEN: ${{ steps.app-token.outputs.token }}
GITHUB_API_URL: ${{ github.api_url }}
run: |
curl --fail-with-body --silent --show-error \
--request DELETE \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${CDK_REPO_TOKEN}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
"${GITHUB_API_URL}/installation/token"
- name: Build CDK package
run: |
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"
- name: Install CLI globally
run: npm install -g "$(npm pack | tail -1)"
- name: Run E2E tests (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 }}
E2E_EFS_ACCESS_POINT_ARN: ${{ env.E2E_EFS_ACCESS_POINT_ARN }}
E2E_S3_ACCESS_POINT_ARN: ${{ env.E2E_S3_ACCESS_POINT_ARN }}
E2E_FILESYSTEM_SUBNET_ID: ${{ env.E2E_FILESYSTEM_SUBNET_ID }}
E2E_FILESYSTEM_SECURITY_GROUP_ID: ${{ env.E2E_FILESYSTEM_SECURITY_GROUP_ID }}
CDK_TARBALL: ${{ env.CDK_TARBALL }}
CDP_API_KEY_ID: ${{ env.E2E_CDP_API_KEY_ID }}
CDP_API_KEY_SECRET: ${{ env.E2E_CDP_API_KEY_SECRET }}
CDP_WALLET_SECRET: ${{ env.E2E_CDP_WALLET_SECRET }}
run: npx vitest run --project e2e --shard=${{ matrix.shard }}
browser-tests:
# Pinned to GitHub-hosted ubuntu-latest, unlike the other jobs (#1715 moved
# everything to CodeBuild). Playwright's `install --with-deps` shells out to
# apt-get to install Chromium's OS libraries; the CodeBuild runner image has
# no apt-get and Playwright doesn't recognize the distro, so the step exits
# 127 ("apt-get: command not found"). ubuntu-latest is a Playwright-supported
# OS where --with-deps works. See #1715.
runs-on: ubuntu-latest
environment: e2e-testing
permissions:
id-token: write # OIDC - lets this job assume the E2E AWS role.
contents: read
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || 'main' }}
- uses: actions/setup-node@v7
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: Fetch secrets from Secrets Manager
uses: aws/agentcore-devx-devtools/.github/actions/fetch-secrets@31aa3b031a86664e29861d68956e44b07cf21a74
with:
role-arn: ${{ secrets.WORKFLOW_SECRETS_READER_ROLE_ARN }}
repo: E2E_AWS_ROLE_ARN
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ env.E2E_AWS_ROLE_ARN }}
aws-region: ${{ inputs.aws_region || 'us-east-1' }}
unset-current-credentials: true
- 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)"