Skip to content
Open

test #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Gateway Tests

on:
issue_comment:
types: [created]

jobs:
gateway-tests:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'run tests') }}
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout head
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install dependencies
run: npm ci

- name: Start gateway and run tests
id: run-tests
continue-on-error: true
run: |
npm run dev &
echo "Waiting for gateway to start..."
while ! curl -s http://localhost:8787 > /dev/null; do
sleep 1
done
echo "Gateway is ready. Running tests..."
npm run test:gateway

- name: Update PR Check
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;

try {
const { data: pull_request } = await github.rest.pulls.get({
owner,
repo,
pull_number: issue_number,
});

const sha = pull_request.head.sha;

await github.rest.checks.create({
owner,
repo,
name: 'Gateway Tests (Comment Triggered)',
head_sha: sha,
status: 'completed',
conclusion: '${{ steps.run-tests.outcome }}',
output: {
title: 'Gateway Test Results',
summary: 'Gateway tests have completed.',
text: 'These tests were triggered by a comment on the PR.'
},
});

console.log('Check run created successfully');
} catch (error) {
console.error('Error creating check run:', error);
core.setFailed(`Action failed with error: ${error}`);
}

env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"start:node": "node build/start-server.js",
"format": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\"",
"format:check": "prettier --check \"./**/*.{js,jsx,ts,tsx,json}\"",
"test": "ts-jest",
"test:gateway": "jest src/",
"test:plugins": "jest plugins/",
"pre-push": "npm run build && node start-test.js",
"prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky"
},
Expand Down
2 changes: 1 addition & 1 deletion src/providers/anthropic/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export const AnthropicChatCompleteConfig: ProviderConfig = {
if (tool.function) {
tools.push({
name: tool.function.name,
description: tool.function?.description || '',
description: tool.function?.description || 'sdas',
input_schema: {
type: tool.function.parameters?.type || 'object',
properties: tool.function.parameters?.properties || {},
Expand Down
Loading