Skip to content

Adding a meta column to datasets to link prompts to them #3830

Adding a meta column to datasets to link prompts to them

Adding a meta column to datasets to link prompts to them #3830

Workflow file for this run

name: e2e tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
jawnClient:
name: Jawn Client
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Make sure types were generated
working-directory: valhalla/jawn
run: |
npm install
bash tsoa_run.sh
python3 genTypes.py
if git status | grep -e "jawnTypes" -e "swagger"; then
echo "Please run the type generation script to update the types."
git diff
exit 1
fi
costs:
name: Cost Calculation Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run node tests
working-directory: costs
run: |
npm install
npm run test
- name: Ensure copy was ran
working-directory: costs
run: |
# Make sure the content of /src is copied to ../worker/src/packages/cost and ../web/packages/cost before pushing
# we can do this by calculating size of the content of /src and then copying it to the respective folders
# Compute the size of the content of /src
DIR1=../worker/src/packages/cost
DIR2=./src
# Generate hash lists
find $DIR1 -type f -print0 | sort -z | xargs -0 sha256sum | awk '{print $1}' > /tmp/dir1_hashes_only.txt
find $DIR2 -type f -print0 | sort -z | xargs -0 sha256sum | awk '{print $1}' > /tmp/dir2_hashes_only.txt
# Compare the hash lists
if cmp -s /tmp/dir1_hashes_only.txt /tmp/dir2_hashes_only.txt; then
echo "Directories have the same contents."
else
echo "Directories have different contents."
echo "Please run the copy script to update the contents of the directories."
exit 1
fi
db-type-checks:
name: DB type checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: supabase/setup-cli@v1
with:
version: 1.148.6
- run: supabase db start
- run: supabase db lint
- name: Generate types and check for changes
run: |
bash genSupabaseTypes.sh
# if git status | grep "database.types.ts"; then
# git --no-pager diff -- ./**/database.types.ts
# git diff
# echo "Detected uncommitted changes after build in web/supabase/database.types.ts. See status below:"
# git diff
# exit 1
# fi
- name: Generate .dockerignore and check for changes
run: |
bash genDockerIgnore.sh
if git status | grep ".dockerignore"; then
git diff --ignore-space-at-eol ./**/.dockerignore
echo "MUST GENERATE TYPES FOR .dockerignore. See status below:"
git diff
exit 1
fi
helicone-node-tests:
name: Helicone Node Package tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run node tests
working-directory: helicone-node
run: |
npm install
npm test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint worker
run: |
cd worker
yarn install
yarn lint
worker-test:
name: Worker Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Jest
run: |
cd worker
yarn install
yarn test
tests:
name: Python E2E tests
runs-on: ubuntu-latest
services:
clickhouse:
image: yandex/clickhouse-server
ports:
- 8123:8123
steps:
- uses: actions/checkout@v3
- uses: supabase/[email protected]
with:
version: latest
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache npm packages
uses: actions/cache@v3
with:
path: |
./worker/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('./worker/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install node dependencies
run: |
mkdir -p ~/test-logs
cd worker
npm install
- name: Start proxy worker
run: |
cd worker
npx wrangler dev --port 8787 --var WORKER_TYPE:OPENAI_PROXY PROMPTARMOR_API_KEY:${{ secrets.PROMPTARMOR_API_KEY }} > ~/test-logs/proxy.log &
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Start Anthropic proxy worker
run: |
cd worker
npx wrangler dev --port 8790 --var WORKER_TYPE:ANTHROPIC_PROXY PROMPTARMOR_API_KEY:${{ secrets.PROMPTARMOR_API_KEY }} > ~/test-logs/proxy.log &
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Start async worker
run: |
cd worker
npx wrangler dev --port 8788 --var WORKER_TYPE:HELICONE_API > ~/test-logs/async.log &
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Start gateway worker
run: |
cd worker
npx wrangler dev --port 8789 --var WORKER_TYPE:GATEWAY_API PROMPTARMOR_API_KEY:${{ secrets.PROMPTARMOR_API_KEY }} > ~/test-logs/gateway.log &
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Start Minio S3
run: |
pip install Minio
python minio_hcone.py --start &
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Start Supabase DB & API
run: supabase start db,api
- name: Install python dependencies
run: |
pip install requests pytest psycopg2 python-dotenv helicone httpx
- name: Run integration tests
working-directory: tests
env:
HELICONE_PROXY_URL: "http://127.0.0.1:8787/v1"
HELICONE_ASYNC_URL: "http://127.0.0.1:8788"
HELICONE_GATEWAY_URL: "http://127.0.0.1:8789"
ANTHROPIC_PROXY_URL: "http://127.0.0.1:8790/v1"
SUPABASE_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU"
SUPABASE_URL: "http://localhost:54321"
HELICONE_API_KEY: "sk-helicone-aizk36y-5yue2my-qmy5tza-n7x3aqa"
OPENAI_API_KEY: ${{ secrets.CI_OPENAI_API_KEY }}
OPENAI_ORG: ${{ secrets.CI_OPENAI_ORG }}
ANTHROPIC_API_KEY: ${{ secrets.CI_ANTHROPIC_API_KEY }}
run: |
pytest python_integration_tests.py
- name: Run helicone-python tests
working-directory: helicone-python
env:
HELICONE_PROXY_URL: "http://127.0.0.1:8787/v1"
HELICONE_ASYNC_URL: "http://127.0.0.1:8788"
HELICONE_GATEWAY_URL: "http://127.0.0.1:8789"
ANTHROPIC_PROXY_URL: "http://127.0.0.1:8790/v1"
SUPABASE_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU"
SUPABASE_URL: "http://localhost:54321"
HELICONE_API_KEY: "sk-helicone-aizk36y-5yue2my-qmy5tza-n7x3aqa"
OPENAI_API_KEY: ${{ secrets.CI_OPENAI_API_KEY }}
OPENAI_ORG: ${{ secrets.CI_OPENAI_ORG }}
ANTHROPIC_API_KEY: ${{ secrets.CI_ANTHROPIC_API_KEY }}
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry install
poetry run pytest -s tests/test_async.py
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: job-logs
path: |
~/test-logs/*.log