Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/js-id-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@e2b/id': minor
---

Initial release: prefixed, human-legible IDs for E2B resources (`prj_…`, `wrk_…`, `sec_…`, …) in the TypeID encoding the Go services use, as a dependency-free package that runs in Node, Bun, Deno, Workers and browsers.
1 change: 1 addition & 0 deletions .github/scripts/build_release_itinerary.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const labels = {
'@e2b/cli': 'CLI (@e2b/cli)',
'@e2b/dockerfile-utils': 'Dockerfile Utils JS (@e2b/dockerfile-utils)',
'@e2b/dockerfile-utils-python': 'Dockerfile Utils Python (e2b-dockerfile-utils)',
'@e2b/id': 'ID JS (@e2b/id)',
}

const statusFile = process.argv[2]
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/id_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Test ID Packages

# `@e2b/id` is a pure codec with no network and no API key, so unlike the SDK
# suites this one needs no secrets and no staging leg.
on:
workflow_call:

permissions:
contents: read

jobs:
test:
name: ID - Build and test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Parse .tool-versions
uses: wistia/parse-tool-versions@v2.1.1
with:
filename: '.tool-versions'
uppercase: 'true'
prefix: 'tool_version_'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: '${{ env.TOOL_VERSION_PNPM }}'

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
cache: pnpm

- name: Configure pnpm
run: |
pnpm config set auto-install-peers true
pnpm config set exclude-links-from-lockfile true

- name: Install dependencies
run: pnpm install --frozen-lockfile

# The interop suite drives python3 to prove the format really is
# "b32encode, lowercase, strip padding, rotate", so an interpreter has to
# be on PATH even though the package itself has no Python component.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '${{ env.TOOL_VERSION_PYTHON }}'

- name: Test build (JS)
working-directory: packages/js-id
run: pnpm build

- name: Run tests (JS)
working-directory: packages/js-id
run: pnpm test
21 changes: 21 additions & 0 deletions .github/workflows/pkg_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ jobs:
name: e2b-dockerfile-utils-js
path: packages/dockerfile-utils-js/*.tgz

- name: Pack ID JS
if: ${{ !cancelled() }}
working-directory: packages/js-id
run: |
pnpm run build
pnpm version prerelease --preid=${{ env.BRANCH_ID }} --no-git-tag-version
pnpm pack

- name: Upload ID JS artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: e2b-id-js
path: packages/js-id/*.tgz

# Independent of the CLI steps above: a CLI failure should still leave
# reviewers a usable SDK tarball, as it did before the CLI moved ahead of it.
- name: Pack JS SDK
Expand Down Expand Up @@ -226,6 +241,8 @@ jobs:
CODE_INTERPRETER_JS_TGZ=$(artifact_basename packages/code-interpreter-js/*.tgz)
DESKTOP_JS_VERSION=$(node -p "require('./packages/desktop-js/package.json').version")
DESKTOP_JS_TGZ=$(artifact_basename packages/desktop-js/*.tgz)
ID_JS_VERSION=$(node -p "require('./packages/js-id/package.json').version")
ID_JS_TGZ=$(artifact_basename packages/js-id/*.tgz)
PY_VERSION=$(grep '^version' packages/python-sdk/pyproject.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
PY_WHL=$(artifact_basename packages/python-sdk/dist/*.whl)
DOCKERFILE_UTILS_PY_WHL=$(artifact_basename packages/dockerfile-utils-python/dist/*.whl)
Expand Down Expand Up @@ -253,6 +270,10 @@ jobs:
BODY+='```sh'$'\n'
BODY+="npm install ./${DESKTOP_JS_TGZ}"$'\n'
BODY+='```'$'\n\n'
BODY+="**ID JS** (\`@e2b/id@${ID_JS_VERSION}\`):"$'\n'
BODY+='```sh'$'\n'
BODY+="npm install ./${ID_JS_TGZ}"$'\n'
BODY+='```'$'\n\n'
BODY+="**Python SDK** (\`e2b==${PY_VERSION}\`, with \`e2b-dockerfile-utils==${DOCKERFILE_UTILS_PY_VERSION}\`):"$'\n'
BODY+='```sh'$'\n'
BODY+="pip install ./${DOCKERFILE_UTILS_PY_WHL} ./${PY_WHL}"$'\n'
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
desktop_python: ${{ steps.desktop_python.outputs.release }}
dockerfile_utils_js: ${{ steps.dockerfile_utils_js.outputs.release }}
dockerfile_utils_python: ${{ steps.dockerfile_utils_python.outputs.release }}
id_js: ${{ steps.id_js.outputs.release }}
itinerary: ${{ steps.itinerary.outputs.itinerary }}
steps:
- name: Check the ref
Expand Down Expand Up @@ -148,6 +149,13 @@ jobs:
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/dockerfile-utils-python" "$RUNNER_TEMP/release-plan.json")
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"

- name: Check ID JS Release
id: id_js
if: steps.version.outputs.release == 'true'
run: |
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/id" "$RUNNER_TEMP/release-plan.json")
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"

- name: Build release itinerary
id: itinerary
if: steps.version.outputs.release == 'true'
Expand Down Expand Up @@ -223,6 +231,12 @@ jobs:
if: needs.preflight.outputs.dockerfile_utils_python == 'true'
uses: ./.github/workflows/dockerfile_utils_python_tests.yml

id-tests:
name: ID Package Tests
needs: [preflight]
if: needs.preflight.outputs.id_js == 'true'
uses: ./.github/workflows/id_tests.yml

publish:
name: Publish
needs:
Expand All @@ -236,6 +250,7 @@ jobs:
- desktop-python-tests
- dockerfile-utils-js-tests
- dockerfile-utils-python-tests
- id-tests
if: (!cancelled()) && !contains(needs.*.result, 'failure') && needs.preflight.outputs.release == 'true'
uses: ./.github/workflows/publish_packages.yml
with:
Expand Down Expand Up @@ -275,6 +290,7 @@ jobs:
- desktop-python-tests
- dockerfile-utils-js-tests
- dockerfile-utils-python-tests
- id-tests
- publish
if: failure()
name: Release Failed - Slack Notification
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/sdk_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
desktop_python: ${{ steps.filter.outputs.desktop_python }}
dockerfile_utils_js: ${{ steps.filter.outputs.dockerfile_utils_js }}
dockerfile_utils_python: ${{ steps.filter.outputs.dockerfile_utils_python }}
id: ${{ steps.filter.outputs.id }}
steps:
- name: Filter changed paths
# On workflow_dispatch there is no PR diff and paths-filter would fall
Expand Down Expand Up @@ -111,6 +112,10 @@ jobs:
- *shared
- '.github/workflows/dockerfile_utils_python_tests.yml'
- 'packages/dockerfile-utils-python/**/!(*.md)'
id:
- *shared
- '.github/workflows/id_tests.yml'
- 'packages/js-id/**/!(*.md)'

js-tests:
name: JS SDK Tests
Expand All @@ -136,6 +141,14 @@ jobs:
secrets:
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}

id-tests:
name: ID Package Tests
needs: changes
if: ${{ needs.changes.outputs.id == 'true' || github.event_name == 'workflow_dispatch' }}
# No secrets and no staging leg: the ID packages are pure codecs that never
# reach the backend, so there is nothing environment-specific to re-check.
uses: ./.github/workflows/id_tests.yml

code-interpreter-js-tests:
name: Code Interpreter JS SDK Tests
needs: changes
Expand Down Expand Up @@ -195,6 +208,7 @@ jobs:
- desktop-python-tests
- dockerfile-utils-js-tests
- dockerfile-utils-python-tests
- id-tests
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 11 additions & 0 deletions packages/js-id/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# dependencies
/node_modules

# build output
dist

# TypeScript cache
*.tsbuildinfo

# Output of 'npm pack'
*.tgz
Loading
Loading