Skip to content

fix: pin a2a-sdk below 1.0 to prevent breaking changes #2562

fix: pin a2a-sdk below 1.0 to prevent breaking changes

fix: pin a2a-sdk below 1.0 to prevent breaking changes #2562

name: Build and Test
on:
push:
branches: ['main']
pull_request:
branches: ['main']
permissions:
contents: read
# Cancel in-progress runs for PRs; never cancel runs on main (merges should not abort each other)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
node-version:
${{ github.event_name == 'pull_request' && fromJSON('["20.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Configure git for tests
run: |
git config --global user.email "bedrock-agentcore-npm+ci@amazon.com"
git config --global user.name "CI"
- name: Install uv
uses: astral-sh/setup-uv@v7
- run: npm ci
- run: npm run build --if-present
- run: npm run test:integ
- name: Pack tarball
if: matrix.node-version == '20.x'
run: npm pack
- name: Install from tarball
if: matrix.node-version == '20.x'
run: npm install -g aws-agentcore-*.tgz
- name: Verify packaged CLI runs
if: matrix.node-version == '20.x'
run: |
agentcore --version
agentcore create --name sanitytest --language Python --framework Strands --model-provider Bedrock --memory none --json
test -f sanitytest/agentcore/agentcore.json
- name: Upload tarball artifact
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v7
with:
name: tarball
path: '*.tgz'
unit-test:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
node-version:
${{ github.event_name == 'pull_request' && fromJSON('["20.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
shard: [1/3, 2/3, 3/3]
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Configure git for tests
run: |
git config --global user.email "bedrock-agentcore-npm+ci@amazon.com"
git config --global user.name "CI"
- name: Install uv
uses: astral-sh/setup-uv@v7
- run: npm ci
- run: npm run build --if-present
- name: Run unit tests (shard ${{ matrix.shard }})
run: npx vitest run --project unit --shard=${{ matrix.shard }} --reporter=blob --reporter=verbose --coverage
- name: Upload blob report
if: always()
uses: actions/upload-artifact@v7
with:
name: blob-${{ matrix.node-version }}-${{ strategy.job-index }}
path: .vitest-reports
retention-days: 1
if-no-files-found: error
include-hidden-files: true
merge-reports:
needs: unit-test
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20.x
cache: 'npm'
- run: npm ci
- name: Download blob reports (Node 20)
uses: actions/download-artifact@v8
with:
pattern: blob-20.x-*
merge-multiple: true
path: .vitest-reports/
- name: Merge reports
run: npx vitest --mergeReports=.vitest-reports/ --project unit --coverage
- name: Upload coverage artifact
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: coverage/
coverage:
needs: merge-reports
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- name: Download coverage artifact
uses: actions/download-artifact@v8
with:
name: coverage-report
path: coverage/
- name: Coverage Report
uses: davelosert/vitest-coverage-report-action@v2
with:
json-summary-path: coverage/coverage-summary.json
json-final-path: coverage/coverage-final.json
vite-config-path: vitest.config.ts
file-coverage-mode: none
coverage-thresholds: '{ "lines": 50, "branches": 50, "functions": 50, "statements": 50 }'