Skip to content

Commit ef6597a

Browse files
committed
updated ci
1 parent 748968a commit ef6597a

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

.github/workflows/build_test_template.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Template
33
on:
44
workflow_call:
55
secrets:
6-
E2B_TESTS_ACCESS_TOKEN:
6+
E2B_API_KEY:
77
required: true
88
inputs:
99
E2B_DOMAIN:
@@ -34,20 +34,27 @@ jobs:
3434
echo "Version: $VERSION"
3535
sed -i "s/e2b_charts/e2b_charts==${VERSION}/g" requirements.txt
3636
37-
- name: Install E2B CLI
38-
run: npm install -g @e2b/cli
37+
- uses: actions/setup-python@v6
38+
with:
39+
python-version: '3.13'
40+
41+
- name: Install development dependencies
42+
working-directory: ./template
43+
run: pip install -r requirements-dev.txt
3944

4045
- name: Build E2B template
4146
id: build-template
47+
working-directory: ./template
4248
run: |
43-
rm -f e2b.toml
44-
e2b template build --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "Dockerfile"
45-
TEMPLATE_ID=$(grep "template_id" e2b.toml | cut -d '"' -f 2)
49+
BUILD_OUTPUT=$(python build_ci.py 2>&1)
50+
echo "$BUILD_OUTPUT"
51+
TEMPLATE_ID=$(echo "$BUILD_OUTPUT" | grep "Template created with ID:" | sed 's/.*Template created with ID: \([^,]*\).*/\1/')
52+
BUILD_ID=$(echo "$BUILD_OUTPUT" | grep -A 1 "Build ID:" | tail -n 1 | xargs)
4653
echo "Captured Template ID: $TEMPLATE_ID"
54+
echo "Captured Build ID: $BUILD_ID"
4755
echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT
48-
working-directory: ./template
4956
env:
50-
E2B_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }}
57+
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
5158
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
5259

5360
- name: Output template ID

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
build-template:
1818
uses: ./.github/workflows/build_test_template.yml
1919
secrets:
20-
E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }}
20+
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
2121
with:
2222
E2B_DOMAIN: ${{ vars.E2B_DOMAIN }}
2323
js-sdk:

template/build_ci.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from dotenv import load_dotenv
2+
from e2b import Template, default_build_logger
3+
from template import make_template
4+
from uuid import uuid4
5+
6+
load_dotenv()
7+
8+
Template.build(
9+
make_template(set_user_workdir=True),
10+
alias="code-interpreter-ci-" + str(uuid4()),
11+
cpu_count=2,
12+
memory_mb=2048,
13+
on_build_logs=default_build_logger(),
14+
)

0 commit comments

Comments
 (0)