Skip to content

Commit 5592fd6

Browse files
authored
Added performance benchmarks for Code Interpreter CI/CD (#145)
* added performance tests * Update pull_request.yml to include performance-tests in cleanup-build-template dependencies * updated lock file * on PR quick iteration around * Refactor performance tests workflow and enhance performance plot generation - Renamed job from 'publish' to 'performance-tests' for clarity. - Added step to upload performance plot artifact after tests. - Updated boxplot function to use 'tick_labels' for better label handling. * change artifcat directory * relative file path * corrected work dir * iterations count, prod cd * fixed workflow syntax
1 parent f0011a5 commit 5592fd6

File tree

6 files changed

+893
-37
lines changed

6 files changed

+893
-37
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Performance tests
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
E2B_API_KEY:
7+
required: true
8+
inputs:
9+
E2B_DOMAIN:
10+
required: false
11+
type: string
12+
E2B_TESTS_TEMPLATE:
13+
required: false
14+
type: string
15+
E2B_TESTS_BENCHMARK_ITERATIONS_COUNT:
16+
required: false
17+
type: number
18+
default: 20
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
performance-tests:
25+
defaults:
26+
run:
27+
working-directory: ./python
28+
name: Performance tests
29+
runs-on: ubuntu-22.04
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v4
36+
with:
37+
python-version: '3.12'
38+
39+
- name: Install and configure Poetry
40+
uses: snok/install-poetry@v1
41+
with:
42+
version: 1.5.1
43+
virtualenvs-create: true
44+
virtualenvs-in-project: true
45+
installer-parallel: true
46+
47+
- name: Install dependencies
48+
run: poetry install
49+
50+
- name: Run performance tests
51+
run: poetry run python tests/performance.py
52+
env:
53+
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
54+
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
55+
E2B_TESTS_TEMPLATE: ${{ inputs.E2B_TESTS_TEMPLATE }}
56+
E2B_TESTS_BENCHMARK_ITERATIONS_COUNT: ${{ inputs.E2B_TESTS_BENCHMARK_ITERATIONS_COUNT }}
57+
- name: Upload performance plot artifact
58+
uses: actions/upload-artifact@v4
59+
if: always()
60+
with:
61+
name: performance-plot-${{ github.run_number }}
62+
path: ./python/performance_plot.png
63+
retention-days: 30

.github/workflows/pull_request.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ jobs:
3636
with:
3737
E2B_DOMAIN: ${{ vars.E2B_DOMAIN }}
3838
E2B_TESTS_TEMPLATE: ${{ needs.build-template.outputs.template_id }}
39+
performance-tests:
40+
uses: ./.github/workflows/performance_tests.yml
41+
needs: build-template
42+
secrets:
43+
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
44+
with:
45+
E2B_DOMAIN: ${{ vars.E2B_DOMAIN }}
46+
E2B_TESTS_TEMPLATE: ${{ needs.build-template.outputs.template_id }}
3947
cleanup-build-template:
4048
uses: ./.github/workflows/cleanup_build_template.yml
41-
needs: [build-template, js-sdk, python-sdk]
49+
needs: [build-template, js-sdk, python-sdk, performance-tests]
4250
if: always() && !contains(needs.build-template.result, 'failure') && !contains(needs.build-template.result, 'cancelled')
4351
secrets:
4452
E2B_TESTS_ACCESS_TOKEN: ${{ secrets.E2B_TESTS_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)