Skip to content

fix(telemetry): use per-invocation usage in agent span attributes #3089

fix(telemetry): use per-invocation usage in agent span attributes

fix(telemetry): use per-invocation usage in agent span attributes #3089

name: Secure Integration test
on:
pull_request_target:
branches: [main]
merge_group: # Run tests in merge queue
types: [checks_requested]
jobs:
authorization-check:
name: Check access
permissions: read-all
runs-on: ubuntu-latest
outputs:
approval-env: ${{ steps.auth.outputs.approval-env }}
steps:
- name: Check Authorization
id: auth
uses: strands-agents/devtools/authorization-check@main
with:
skip-check: ${{ github.event_name == 'merge_group' }}
username: ${{ github.event.pull_request.user.login || 'invalid' }}
allowed-roles: 'maintain,triage,write,admin'
check-access-and-checkout:
runs-on: ubuntu-latest
needs: authorization-check
environment: ${{ needs.authorization-check.outputs.approval-env }}
permissions:
id-token: write
pull-requests: read
contents: read
steps:
- name: Configure Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.STRANDS_INTEG_TEST_ROLE }}
aws-region: us-east-1
mask-aws-account-id: true
- name: Checkout head commit
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }} # Pull the commit from the forked repo
persist-credentials: false # Don't persist credentials for subsequent actions
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
# Pin virtualenv until hatch is fixed.
# See https://github.com/pypa/hatch/issues/2193
run: |
pip install --no-cache-dir hatch 'virtualenv<21'
- name: Run integration tests
env:
AWS_REGION: us-east-1
AWS_REGION_NAME: us-east-1 # Needed for LiteLLM
STRANDS_TEST_API_KEYS_SECRET_NAME: ${{ secrets.STRANDS_TEST_API_KEYS_SECRET_NAME }}
id: tests
run: |
hatch test tests_integ
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: ./build/test-results.xml
upload-metrics:
runs-on: ubuntu-latest
needs: check-access-and-checkout
if: always()
permissions:
id-token: write
contents: read
steps:
- name: Configure Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.STRANDS_INTEG_TEST_ROLE }}
aws-region: us-east-1
mask-aws-account-id: true
- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
sparse-checkout: |
.github/scripts
persist-credentials: false
- name: Download test results
uses: actions/download-artifact@v8
with:
name: test-results
- name: Publish test metrics to CloudWatch
run: |
pip install --no-cache-dir boto3
python .github/scripts/upload-integ-test-metrics.py test-results.xml ${{ github.event.repository.name }}