Skip to content

Commit 3a29103

Browse files
authored
Merge branch 'main' into chore/add-default-limit-to-cli-list
2 parents 406b52b + 51582e8 commit 3a29103

File tree

123 files changed

+24928
-1931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+24928
-1931
lines changed

.changeset/tangy-kiwis-repeat.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/cli_tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ name: Test CLI
22

33
on:
44
workflow_call:
5+
inputs:
6+
E2B_DOMAIN:
7+
required: false
8+
type: string
9+
default: ''
510
secrets:
611
E2B_API_KEY:
712
required: true
8-
pull_request:
9-
branches:
10-
- main
1113

1214
permissions:
1315
contents: read
@@ -67,3 +69,4 @@ jobs:
6769
working-directory: ./packages/cli
6870
env:
6971
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
72+
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}

.github/workflows/generated_files.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Generated files
33
on:
44
pull_request:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
check-generated:
811
name: Generated files

.github/workflows/js_sdk_tests.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ name: Test JS SDK
22

33
on:
44
workflow_call:
5+
inputs:
6+
E2B_DOMAIN:
7+
required: false
8+
type: string
9+
default: ''
510
secrets:
611
E2B_API_KEY:
712
required: true
8-
pull_request:
9-
branches:
10-
- main
1113

1214
permissions:
1315
contents: read
@@ -83,6 +85,7 @@ jobs:
8385
run: pnpm test
8486
env:
8587
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
88+
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
8689

8790
- name: Install Bun
8891
uses: oven-sh/setup-bun@v2
@@ -91,6 +94,7 @@ jobs:
9194
run: pnpm test:bun
9295
env:
9396
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
97+
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
9498

9599
- name: Install Deno
96100
uses: denoland/setup-deno@v1
@@ -101,3 +105,4 @@ jobs:
101105
run: pnpm test:deno
102106
env:
103107
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
108+
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Lint
2+
permissions:
3+
contents: read
24

35
on:
46
pull_request:
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Package Artifacts
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
build:
13+
name: Build Packages
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Parse .tool-versions
21+
uses: wistia/parse-tool-versions@v2.1.1
22+
with:
23+
filename: '.tool-versions'
24+
uppercase: 'true'
25+
prefix: 'tool_version_'
26+
27+
- uses: pnpm/action-setup@v4
28+
with:
29+
version: '${{ env.TOOL_VERSION_PNPM }}'
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v6
33+
with:
34+
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
35+
cache: pnpm
36+
37+
- name: Configure pnpm
38+
run: |
39+
pnpm config set auto-install-peers true
40+
pnpm config set exclude-links-from-lockfile true
41+
42+
- name: Sanitize branch name
43+
env:
44+
BRANCH: ${{ github.head_ref }}
45+
run: |
46+
echo "BRANCH_ID=$(echo "$BRANCH" | sed 's/[^0-9A-Za-z-]/-/g')" >> "$GITHUB_ENV"
47+
48+
- name: Install dependencies
49+
run: pnpm install --frozen-lockfile
50+
51+
- name: Build JS SDK
52+
working-directory: packages/js-sdk
53+
run: pnpm run build
54+
55+
- name: Pack JS SDK
56+
working-directory: packages/js-sdk
57+
run: |
58+
npm version prerelease --preid=${{ env.BRANCH_ID }} --no-git-tag-version
59+
npm pack
60+
61+
- name: Upload JS SDK artifact
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: e2b-js-sdk
65+
path: packages/js-sdk/*.tgz
66+
67+
- name: Build CLI
68+
working-directory: packages/cli
69+
run: pnpm run build
70+
71+
- name: Pack CLI
72+
working-directory: packages/cli
73+
run: |
74+
npm version prerelease --preid=${{ env.BRANCH_ID }} --no-git-tag-version
75+
npm pack
76+
77+
- name: Upload CLI artifact
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: e2b-cli
81+
path: packages/cli/*.tgz
82+
83+
- name: Set up Python
84+
uses: actions/setup-python@v4
85+
with:
86+
python-version: '${{ env.TOOL_VERSION_PYTHON }}'
87+
88+
- name: Install and configure Poetry
89+
uses: snok/install-poetry@v1
90+
with:
91+
version: '${{ env.TOOL_VERSION_POETRY }}'
92+
virtualenvs-create: true
93+
virtualenvs-in-project: true
94+
installer-parallel: true
95+
96+
- name: Build Python SDK
97+
working-directory: packages/python-sdk
98+
run: |
99+
BASE_VERSION=$(poetry version -s)
100+
poetry version "${BASE_VERSION}+${BRANCH_ID}"
101+
poetry build
102+
103+
- name: Upload Python SDK artifact
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: e2b-python-sdk
107+
path: packages/python-sdk/dist/*
108+
109+
- name: Comment on PR
110+
env:
111+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
PR_NUMBER: ${{ github.event.pull_request.number }}
113+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
114+
run: |
115+
JS_VERSION=$(node -p "require('./packages/js-sdk/package.json').version")
116+
CLI_VERSION=$(node -p "require('./packages/cli/package.json').version")
117+
JS_TGZ=$(ls packages/js-sdk/*.tgz | xargs -n1 basename)
118+
CLI_TGZ=$(ls packages/cli/*.tgz | xargs -n1 basename)
119+
PY_VERSION=$(grep '^version' packages/python-sdk/pyproject.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
120+
PY_WHL=$(ls packages/python-sdk/dist/*.whl | xargs -n1 basename)
121+
122+
BODY="<!-- e2b-pkg-artifacts -->"$'\n'
123+
BODY+="### Package Artifacts"$'\n\n'
124+
BODY+="Built from ${GITHUB_SHA::7}. Download artifacts from [this workflow run](${RUN_URL})."$'\n\n'
125+
BODY+="**JS SDK** (\`e2b@${JS_VERSION}\`):"$'\n'
126+
BODY+='```sh'$'\n'
127+
BODY+="npm install ./${JS_TGZ}"$'\n'
128+
BODY+='```'$'\n\n'
129+
BODY+="**CLI** (\`@e2b/cli@${CLI_VERSION}\`):"$'\n'
130+
BODY+='```sh'$'\n'
131+
BODY+="npm install ./${CLI_TGZ}"$'\n'
132+
BODY+='```'$'\n\n'
133+
BODY+="**Python SDK** (\`e2b==${PY_VERSION}\`):"$'\n'
134+
BODY+='```sh'$'\n'
135+
BODY+="pip install ./${PY_WHL}"$'\n'
136+
BODY+='```'$'\n'
137+
138+
COMMENT_ID=$(gh api "repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" \
139+
--paginate \
140+
--jq '.[] | select(.body | contains("<!-- e2b-pkg-artifacts -->")) | .id' \
141+
| tail -1)
142+
143+
if [ -n "$COMMENT_ID" ]; then
144+
gh api "repos/${{ github.repository }}/issues/comments/${COMMENT_ID}" \
145+
-X PATCH -f body="$BODY"
146+
else
147+
gh pr comment "$PR_NUMBER" --body "$BODY"
148+
fi
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Publish Candidates
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
js-sdk:
7+
required: false
8+
type: boolean
9+
default: false
10+
python-sdk:
11+
required: false
12+
type: boolean
13+
default: false
14+
cli:
15+
required: false
16+
type: boolean
17+
default: false
18+
tag:
19+
required: true
20+
type: string
21+
preid:
22+
required: true
23+
type: string
24+
25+
permissions:
26+
contents: read
27+
id-token: write
28+
29+
jobs:
30+
publish:
31+
name: Publish Release Candidates
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout Repo
35+
uses: actions/checkout@v4
36+
37+
- name: Parse .tool-versions
38+
uses: wistia/parse-tool-versions@v2.1.1
39+
with:
40+
filename: '.tool-versions'
41+
uppercase: 'true'
42+
prefix: 'tool_version_'
43+
44+
- uses: pnpm/action-setup@v4
45+
if: ${{ inputs.js-sdk || inputs.cli }}
46+
with:
47+
version: '${{ env.TOOL_VERSION_PNPM }}'
48+
49+
- name: Setup Node.js
50+
uses: actions/setup-node@v6
51+
if: ${{ inputs.js-sdk || inputs.cli }}
52+
with:
53+
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
54+
registry-url: https://registry.npmjs.org
55+
cache: pnpm
56+
57+
- name: Configure pnpm
58+
if: ${{ inputs.js-sdk || inputs.cli }}
59+
run: |
60+
pnpm config set auto-install-peers true
61+
pnpm config set exclude-links-from-lockfile true
62+
63+
- name: Update npm
64+
if: ${{ inputs.js-sdk || inputs.cli }}
65+
run: |
66+
npm install -g npm@^11.6
67+
npm --version
68+
69+
- name: Set up Python
70+
uses: actions/setup-python@v4
71+
if: ${{ inputs.python-sdk }}
72+
with:
73+
python-version: '${{ env.TOOL_VERSION_PYTHON }}'
74+
75+
- name: Install and configure Poetry
76+
uses: snok/install-poetry@v1
77+
if: ${{ inputs.python-sdk }}
78+
with:
79+
version: '${{ env.TOOL_VERSION_POETRY }}'
80+
virtualenvs-create: true
81+
virtualenvs-in-project: true
82+
installer-parallel: true
83+
84+
- name: Publish Python RC
85+
if: ${{ inputs.python-sdk }}
86+
working-directory: packages/python-sdk
87+
run: |
88+
BASE_VERSION=$(poetry version -s)
89+
poetry version "${BASE_VERSION}rc${{ github.run_number }}"
90+
poetry build
91+
poetry config pypi-token.pypi ${PYPI_TOKEN} && poetry publish --skip-existing
92+
env:
93+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
94+
95+
- name: Install JS dependencies
96+
if: ${{ inputs.js-sdk || inputs.cli }}
97+
run: pnpm install --frozen-lockfile
98+
99+
- name: Publish JS RC
100+
if: ${{ inputs.js-sdk }}
101+
working-directory: packages/js-sdk
102+
env:
103+
RC_PREID: ${{ inputs.preid }}
104+
RC_TAG: ${{ inputs.tag }}
105+
run: |
106+
npm version prerelease --preid="${RC_PREID}.${{ github.run_number }}" --no-git-tag-version
107+
npm publish --tag "$RC_TAG" --provenance
108+
109+
- name: Reinstall dependencies
110+
if: ${{ inputs.js-sdk || inputs.cli }}
111+
run: pnpm install --frozen-lockfile
112+
113+
- name: Publish CLI RC
114+
if: ${{ inputs.cli }}
115+
working-directory: packages/cli
116+
env:
117+
RC_PREID: ${{ inputs.preid }}
118+
RC_TAG: ${{ inputs.tag }}
119+
run: |
120+
npm version prerelease --preid="${RC_PREID}.${{ github.run_number }}" --no-git-tag-version
121+
npm publish --tag "$RC_TAG" --provenance

.github/workflows/python_sdk_tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ name: Test Python SDK
22

33
on:
44
workflow_call:
5+
inputs:
6+
E2B_DOMAIN:
7+
required: false
8+
type: string
9+
default: ''
510
secrets:
611
E2B_API_KEY:
712
required: true
8-
pull_request:
9-
branches:
10-
- main
1113

1214
permissions:
1315
contents: read
@@ -58,3 +60,4 @@ jobs:
5860
run: poetry run pytest --verbose --numprocesses=4
5961
env:
6062
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
63+
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}

0 commit comments

Comments
 (0)