forked from aws/agentcore-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (83 loc) · 2.7 KB
/
build-and-test.yml
File metadata and controls
91 lines (83 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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: [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:unit
- run: npm run test:integ
- name: Upload coverage artifact
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: coverage/
- 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'
coverage:
needs: build
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.unit.config.ts
file-coverage-mode: none
coverage-thresholds: '{ "lines": 50, "branches": 50, "functions": 50, "statements": 50 }'