-
Notifications
You must be signed in to change notification settings - Fork 8
170 lines (136 loc) · 5.37 KB
/
Copy pathagentex-tutorials-test.yml
File metadata and controls
170 lines (136 loc) · 5.37 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Test AgentEx Tutorials
on:
workflow_dispatch:
workflow_call:
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
changed-tutorials: ${{ steps.check.outputs.changed-tutorials }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 2
- name: Check for changes in tutorials directory
id: check
run: |
# For testing: hardcode 10_agentic/00_base/000_hello_acp tutorial
echo "changed-tutorials=[\"10_agentic/00_base/000_hello_acp\"]" >> $GITHUB_OUTPUT
build-and-push-tutorial-agents:
needs: detect-changes
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.changed-tutorials != '[]'
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: "0.44.0"
RYE_INSTALL_OPTION: "--yes"
- name: Build and install agentex SDK (same as release)
run: |
rye build --clean
# Get the wheel filename
WHEEL_FILE=$(ls dist/*.whl | head -n 1)
echo "Built wheel: $WHEEL_FILE"
# Install the wheel to make the CLI available
pip install "$WHEEL_FILE"
# Verify CLI is available
agentex --version
# Store wheel path for later use if needed
echo "AGENTEX_WHEEL=$WHEEL_FILE" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build tutorial agent images
run: |
# Get list of changed tutorials from detect-changes job output
CHANGED_TUTORIALS='${{ needs.detect-changes.outputs.changed-tutorials }}'
echo "Changed tutorials: $CHANGED_TUTORIALS"
# Parse the JSON array and build each tutorial
echo "$CHANGED_TUTORIALS" | jq -r '.[]' | while read -r tutorial; do
echo "🔨 Building tutorial: $tutorial"
TUTORIAL_PATH="examples/tutorials/$tutorial"
if [ -f "$TUTORIAL_PATH/manifest.yaml" ]; then
echo "📦 Building with agentex CLI..."
# Extract the last folder name from the tutorial path
TAG_NAME=$(basename "$tutorial")
# Build and push with agentex agents build command
agentex agents build \
--manifest "$TUTORIAL_PATH/manifest.yaml" \
--registry "docker.io" \
--repository-name "${{ vars.DOCKERHUB_USERNAME }}/agentex-tutorials" \
--tag "${TAG_NAME}-stable-release" \
--push
echo "✅ Successfully built and pushed: ${{ vars.DOCKERHUB_USERNAME }}/agentex-tutorials:${TAG_NAME}-stable-release"
else
echo "⚠️ No manifest.yaml found in $TUTORIAL_PATH, skipping..."
fi
done
run-agentex-tests:
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.changed-tutorials != "run"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: "0.44.0"
RYE_INSTALL_OPTION: "--yes"
- name: Build and install agentex SDK (same as release)
run: |
rye build --clean
# Get the wheel filename
WHEEL_FILE=$(ls dist/*.whl | head -n 1)
echo "Built wheel: $WHEEL_FILE"
# Install the wheel to make the CLI available
pip install "$WHEEL_FILE"
# Verify CLI is available
agentex --version
# Store wheel path for later use if needed
echo "AGENTEX_WHEEL=$WHEEL_FILE" >> $GITHUB_ENV
# Login to Amazon ECR
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Pull AgentEx Server image
env:
SCALE_PROD_ACCOUNT_ID: "307185671274"
AWS_REGION: "us-west-2"
AGENTEX_SERVER_IMAGE_NAME: "agentex"
run: |
# Pull the latest-stable AgentEx server image from ECR
SERVER_IMAGE="${{ env.SCALE_PROD_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AGENTEX_SERVER_IMAGE_NAME }}:latest-stable"
echo "📥 Pulling AgentEx server image: $SERVER_IMAGE"
docker pull "$SERVER_IMAGE"
# Tag it for local use
docker tag "$SERVER_IMAGE" "agentex-server:test"
echo "✅ AgentEx server image ready: agentex-server:test"
- name: Run AgentEx tutorial tests
run: |
## run a script