Skip to content

Commit 98d24f5

Browse files
committed
Pipeline
1 parent eb45249 commit 98d24f5

33 files changed

+193
-130
lines changed

.github/workflows/charts_tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test Python SDK
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
publish:
11+
defaults:
12+
run:
13+
working-directory: ./chart_data_extractor
14+
name: Build and test Chart Data Extractor
15+
runs-on: ubuntu-20.04
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.8'
24+
25+
- name: Install and configure Poetry
26+
uses: snok/install-poetry@v1
27+
with:
28+
version: 1.5.1
29+
virtualenvs-create: true
30+
virtualenvs-in-project: true
31+
installer-parallel: true
32+
33+
- name: Install dependencies
34+
run: poetry install
35+
36+
- name: Test build
37+
run: poetry build
38+
39+
- name: Run tests
40+
run: poetry run pytest -n 4 --verbose -x

.github/workflows/pr.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
outputs:
1313
python: ${{ steps.filter.outputs.python }}
1414
js: ${{ steps.filter.outputs.js }}
15+
charts: ${{ steps.filter.outputs.charts }}
1516
steps:
1617
- name: Checkout repository
1718
uses: actions/checkout@v3
@@ -38,6 +39,8 @@ jobs:
3839
- 'python/**'
3940
js:
4041
- 'js/**'
42+
charts:
43+
- 'chart_data_extractor/**'
4144
4245
python-tests:
4346
needs: [ changes ]
@@ -52,3 +55,11 @@ jobs:
5255
if: needs.changes.outputs.js == 'true'
5356
uses: ./.github/workflows/js_tests.yml
5457
secrets: inherit
58+
59+
js-tests:
60+
needs: [ changes ]
61+
name: Tests JS package
62+
# If the PR does not have the label 'js-rc', the code is already tested in the prerelease workflow
63+
if: needs.changes.outputs.charts == 'true' && !contains( github.event.pull_request.labels.*.name, 'charts-rc')
64+
uses: ./.github/workflows/charts_tests.yml
65+
secrets: inherit

.github/workflows/release.yml

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,99 @@ jobs:
8383
python:
8484
- 'python/**'
8585
86+
charts-tests:
87+
name: Charts tests
88+
needs: [changes]
89+
if: needs.changes.outputs.charts == 'true'
90+
uses: ./.github/workflows/charts_tests.yml
91+
92+
charts-release:
93+
name: Charts release
94+
needs: [charts-tests]
95+
if: needs.changes.outputs.charts == 'true'
96+
defaults:
97+
run:
98+
working-directory: ./charts
99+
runs-on: ubuntu-latest
100+
steps:
101+
- name: Checkout Repo
102+
uses: actions/checkout@v3
103+
104+
- name: Create new versions
105+
run: pnpm run version
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
109+
- name: Release new versions
110+
uses: changesets/action@v1
111+
with:
112+
publish: pnpm run publish
113+
createGithubReleases: true
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
117+
118+
119+
build-docker-image:
120+
name: Build Docker Image
121+
runs-on: ubuntu-latest
122+
needs: [changes, charts-release]
123+
if: !cancelled() && needs.changes.outputs.template == 'true' || needs.changes.outputs.charts == 'true'
124+
steps:
125+
- name: Checkout repository
126+
uses: actions/checkout@v3
127+
with:
128+
fetch-depth: 0
129+
130+
- name: Set up Docker Buildx
131+
uses: docker/setup-buildx-action@v3
132+
133+
- name: Log in to DockerHub
134+
uses: docker/login-action@v3
135+
with:
136+
username: ${{ secrets.DOCKERHUB_USERNAME }}
137+
password: ${{ secrets.DOCKERHUB_TOKEN }}
138+
139+
- name: Build and push to DockerHub
140+
working-directory: ./template
141+
run: |
142+
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest || true
143+
docker buildx build \
144+
--file Dockerfile \
145+
--platform linux/amd64 \
146+
--push \
147+
--tag ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest .
148+
149+
build-template:
150+
name: Build Docker Image
151+
runs-on: ubuntu-latest
152+
needs: [build-docker-image]
153+
if: !cancelled() && needs.changes.outputs.template == 'true' || needs.changes.outputs.charts == 'true'
154+
steps:
155+
- name: Checkout repository
156+
uses: actions/checkout@v3
157+
with:
158+
fetch-depth: 0
159+
- name: Install E2B CLI
160+
run: npm install -g @e2b/cli
161+
162+
- name: Build e2b
163+
run: e2b template build
164+
working-directory: ./template
165+
env:
166+
E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }}
167+
86168
python-tests:
87169
name: Python Tests
88-
needs: [changes]
89-
if: needs.changes.outputs.python == 'true'
170+
needs: [changes, build-template]
171+
if: !cancelled() && needs.changes.outputs.python == 'true' || needs.changes.outputs.template == 'true'
90172
uses: ./.github/workflows/python_tests.yml
91173
secrets: inherit
92174

93175
js-tests:
94176
name: JS Tests
95177
needs: [changes]
96-
if: needs.changes.outputs.js == 'true'
178+
if: !cancelled() && needs.changes.outputs.js == 'true' || needs.changes.outputs.template == 'true'
97179
uses: ./.github/workflows/js_tests.yml
98180
secrets: inherit
99181

.github/workflows/template.yml

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

chart_data_extractor/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Extracting Data for Code Interpreter SDK
2+
3+
This package is a utility used to extract data in the Code Interpreter SDK from, e.g., DataFrames and matplotlib plots.

0 commit comments

Comments
 (0)