Skip to content

feat: add helicone for caching openai response #2262

feat: add helicone for caching openai response

feat: add helicone for caching openai response #2262

Workflow file for this run

name: Run JS SDK test
on:
push:
branches:
- master
paths:
- 'js/**'
pull_request:
paths:
- 'js/**'
workflow_dispatch:
inputs:
environment:
type: choice
options:
- prod
- staging
- custom
default: prod
baseUrl:
type: string
required: false
apiKey:
type: string
required: false
jobs:
run-js-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install -g pnpm
- name: Install packages in js folder
run: cd js && pnpm install --frozen-lockfile
- name: pnpm build
run: cd js && pnpm build
- name: Set environment variables
run: |
echo "COMPOSIO_API_KEY=${{ inputs.apiKey }}" >> $GITHUB_ENV
echo "BACKEND_HERMES_URL=${{ inputs.baseUrl }}" >> $GITHUB_ENV
- name: If base URL, create js/test.config.custom.json
run: |
if [ -n "${{ inputs.baseUrl }}" ]; then
echo "Creating test.config.custom.json with base URL: $BACKEND_HERMES_URL"
echo "{\n \"COMPOSIO_API_KEY\": \"${{ inputs.apiKey }}\",\n \"BACKEND_HERMES_URL\": \"${{ inputs.baseUrl }}\"\n}" > js/config/test.config.custom.json
fi
- name: Print config file
run: |
echo "Running test with environment: ${{ inputs.environment || 'prod' }}"
- name: run test
run: cd js && TEST_ENV=${{ inputs.environment || 'prod' }} pnpm test:coverage --max-workers 16
- name: Upload `coverage` folder to R2
if: ${{ always() }}
uses: himanshu-dixit/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: github-action
source-dir: js/coverage
destination-dir: coverage-${{ github.run_id }}/coverage
- name: Print unique URL
if: ${{ always() }}
run: |
echo "URL: 'https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/coverage-${{ github.run_id }}/coverage/index.html'"
- name: Upload jest html-reporters folder to R2
if: ${{ always() }}
uses: himanshu-dixit/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: github-action
source-dir: js/html-report
destination-dir: html-report-${{ github.run_id }}/html-report
- name: Print HTML report folder unique URL
if: ${{ always() }}
run: |
echo "HTML report folder unique URL: 'https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/html-report-${{ github.run_id }}/html-report/report.html'"
- name: Find Comment
if: ${{ always() }}
uses: peter-evans/find-comment@v3
id: fc
continue-on-error: true
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: This comment was generated by github-actions[bot]!
- name: Create or update comment
if: ${{ github.event_name == 'pull_request' && always() }}
uses: peter-evans/create-or-update-comment@v4
continue-on-error: true
with:
edit-mode: replace
issue-number: ${{ github.event.pull_request.number }}
body: |
This comment was generated by github-actions[bot]!
## JS SDK Coverage Report
📊 Coverage report for JS SDK can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/coverage-${{ github.run_id }}/coverage/index.html
📁 Test report folder can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/html-report-${{ github.run_id }}/html-report/report.html
reactions: rocket
comment-id: ${{ steps.fc.outputs.comment-id }}