Repository navigation
153 lines (149 loc) · 5.33 KB
/
Copy pathrefactor-e2e.yml
File metadata and controls
153 lines (149 loc) · 5.33 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: e2e-test(refactor)
on:
workflow_call:
inputs:
artifactRef:
description: git reference (commit, branch, or tag) to build the CLI from
required: false
type: string
default: ''
testRef:
description: git reference (commit, branch, or tag) to run E2E tests from, defaults to artifactRef
required: false
type: string
default: ''
tags:
description: Vitest tag expression, for example runtime || canary
required: false
type: string
default: ''
linuxOnly:
description: Run E2E tests only on Linux
required: false
type: boolean
default: false
secrets:
WORKFLOW_SECRETS_READER_ROLE_ARN:
required: true
workflow_dispatch:
inputs:
artifactRef:
description: git reference (commit, branch, or tag) to build the CLI from
type: string
default: refactor
testRef:
description: git reference (commit, branch, or tag) to run E2E tests from, defaults to artifactRef
type: string
default: ''
tags:
description: Vitest tag expression, for example runtime || canary
type: string
default: ''
linuxOnly:
description: Run E2E tests only on Linux
type: boolean
default: false
concurrency:
group:
e2e-test-${{ inputs.artifactRef || 'refactor' }}-${{ inputs.testRef || inputs.artifactRef || 'refactor' }}-${{
inputs.tags || 'all' }}-${{ inputs.linuxOnly && 'linux-only' || 'all-os' }}
cancel-in-progress: false
env:
AGENTCORE_TELEMETRY_DISABLED: '1'
jobs:
authorize:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
is-authorized: ${{ github.workflow == 'canary(refactor)' || steps.check.outputs.is_authorized == 'true' }}
steps:
- name: Fetch secrets from Secrets Manager
uses: aws/agentcore-devx-devtools/.github/actions/fetch-secrets@75989f65f7f193deaf83c237c36572d1a8f800b2
with:
role-arn: ${{ secrets.WORKFLOW_SECRETS_READER_ROLE_ARN }}
repo: AUTHORIZED_USERS
- name: Check authorization
id: authz
uses: aws/agentcore-devx-devtools/.github/actions/check-authorized-user@31aa3b031a86664e29861d68956e44b07cf21a74
with:
subject: ${{ github.actor }}
authorized-users: ${{ env.AUTHORIZED_USERS }}
- name: Determine authorization
id: check
env:
IS_AUTHORIZED: ${{ steps.authz.outputs.is-authorized }}
ACTOR: ${{ github.actor }}
run: |
if [[ "$IS_AUTHORIZED" == "true" ]]; then
echo "Actor ${ACTOR} is authorized"
echo "is_authorized=true" >> "$GITHUB_OUTPUT"
else
echo "Actor ${ACTOR} is not in AUTHORIZED_USERS, skipping"
echo "is_authorized=false" >> "$GITHUB_OUTPUT"
fi
e2e:
name: test (${{ matrix.name }})
needs: authorize
if: needs.authorize.outputs.is-authorized == 'true'
runs-on: >-
${{ fromJSON(
matrix.name == 'Linux' &&
format('["codebuild-agentcore-e2e-{0}-{1}","e2e-linux"]', github.run_id, github.run_attempt)
|| matrix.name == 'Windows' &&
format('["codebuild-agentcore-e2e-{0}-{1}","image:windows-1.0","e2e-windows"]', github.run_id,
github.run_attempt)
|| matrix.name == 'macOS' && '["macos-latest"]'
) }}
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
name: ${{ fromJSON(inputs.linuxOnly && '["Linux"]' || '["Linux","Windows","macOS"]') }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.testRef || inputs.artifactRef || 'refactor' }}
persist-credentials: false
- uses: actions/checkout@v7
with:
ref: ${{ inputs.artifactRef || 'refactor' }}
path: artifact
persist-credentials: false
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: '24'
- uses: astral-sh/setup-uv@v6
- run: bun install --frozen-lockfile
- run: bun install --frozen-lockfile
working-directory: artifact
- name: Fetch E2E role from Secrets Manager
uses: aws/agentcore-devx-devtools/.github/actions/fetch-secrets@75989f65f7f193deaf83c237c36572d1a8f800b2
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: ${{ vars.E2E_REGION || 'us-east-1' }}
unset-current-credentials: true
- name: Build CLI
working-directory: artifact
run: bun run build
- name: Run all E2E tests
if: inputs.tags == ''
env:
AGENTCORE_CLI_PATH: node ${{ github.workspace }}/artifact/dist/index.js
AWS_REGION: ${{ vars.E2E_REGION || 'us-east-1' }}
run: bun run test:e2e
- name: Run tagged E2E tests
if: inputs.tags != ''
env:
AGENTCORE_CLI_PATH: node ${{ github.workspace }}/artifact/dist/index.js
AWS_REGION: ${{ vars.E2E_REGION || 'us-east-1' }}
run: bun run test:e2e -- --tagsFilter="${{ inputs.tags }}"