Repository navigation
117 lines (104 loc) · 3.71 KB
/
Copy pathcode_interpreter_js_tests.yml
File metadata and controls
117 lines (104 loc) · 3.71 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
name: Test Code Interpreter JS SDK
on:
workflow_call:
inputs:
E2B_DOMAIN:
required: false
type: string
default: ''
run_recovery_tests:
required: false
type: boolean
default: true
node-only:
description: 'Run only the Node leg (skip Bun, Deno and Cloudflare)'
required: false
type: boolean
default: false
secrets:
E2B_API_KEY:
required: true
permissions:
contents: read
jobs:
test:
defaults:
run:
working-directory: ./packages/code-interpreter-js
shell: bash
name: Code Interpreter JS SDK - ${{ matrix.runtime }}
strategy:
fail-fast: false
# Each runtime keeps one live-test worker. This matrix has four legs, so
# it naturally stays below the shared six-job cap.
max-parallel: 6
# With node-only (set by staging callers) the matrix collapses to the
# Node leg: the other legs re-run the suite the Node leg already covers
# and add sandbox load without extra backend signal, so the other
# runtimes are exercised against production only.
matrix:
runtime: >-
${{ inputs.node-only
&& fromJSON('["node"]')
|| fromJSON('["node", "bun", "deno", "cloudflare"]') }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Parse .tool-versions
uses: wistia/parse-tool-versions@32f568a4ffd4bfa7720ebf93f171597d1ebc979a # v2.1.1
with:
filename: '.tool-versions'
uppercase: 'true'
prefix: 'tool_version_'
- name: Install pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
with:
version: '${{ env.TOOL_VERSION_PNPM }}'
- name: Setup Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
registry-url: 'https://registry.npmjs.org'
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- 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
- name: Build base JS SDK
run: pnpm --dir ../js-sdk build
- name: Test build
run: pnpm build
- name: Install Bun
if: matrix.runtime == 'bun'
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: '${{ env.TOOL_VERSION_BUN }}'
- name: Install Deno
if: matrix.runtime == 'deno'
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5
with:
deno-version: 'v${{ env.TOOL_VERSION_DENO }}'
# The interrupt suite exercises sandbox recovery paths that staging
# cannot serve, so callers can opt out of it.
- name: Run test suite under ${{ matrix.runtime }}
run: |
case "${{ matrix.runtime }}" in
node) script=test ;;
cloudflare) script=test:cf ;;
*) script=test:${{ matrix.runtime }} ;;
esac
if [[ "${{ inputs.run_recovery_tests }}" == "true" ]]; then
pnpm "$script"
else
pnpm "$script" --exclude tests/interrupt.test.ts
fi
env:
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
# Keep one live-sandbox worker per runtime; matrix parallelism is
# bounded separately above.
E2B_TEST_MAX_WORKERS: 1