Skip to content
Merged
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
279 changes: 3 additions & 276 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,279 +14,6 @@ permissions:
contents: read

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci

lint:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: ESLint
run: npx eslint "src/**/*.ts"

typecheck:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: TypeScript type-check
run: npx tsc --noEmit

circular-deps:
needs: install
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Build and check for circular dependencies
run: |
output=$(npm run build:dev 2>&1)
echo "$output"
if echo "$output" | grep -qi "Circular depend"; then
echo "::error title=Circular dependency detected::Rollup reported a circular dependency. See the build output above."
exit 1
fi

unit-tests:
name: 'unit tests (shard ${{ matrix.shard }}/4)'
needs: install
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Run unit tests (shard ${{ matrix.shard }}/4)
run: npx jest --shard=${{ matrix.shard }}/4 --maxWorkers=50% --testPathIgnorePatterns=title.memory-leak.test.ts --testPathIgnorePatterns=llm.spec.ts --testPathIgnorePatterns=integration.test.ts --testPathIgnorePatterns=specs/summarization.test.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
AZURE_MODEL_NAME: ${{ secrets.AZURE_MODEL_NAME }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}
AZURE_OPENAI_API_INSTANCE: ${{ secrets.AZURE_OPENAI_API_INSTANCE }}
AZURE_OPENAI_API_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_API_DEPLOYMENT }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
BEDROCK_AWS_ACCESS_KEY_ID: ${{ secrets.BEDROCK_AWS_ACCESS_KEY_ID }}
BEDROCK_AWS_SECRET_ACCESS_KEY: ${{ secrets.BEDROCK_AWS_SECRET_ACCESS_KEY }}

summarization-tests:
name: 'summarization tests'
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Run summarization tests
run: npx jest src/specs/summarization.test.ts --maxWorkers=50%
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
AZURE_MODEL_NAME: ${{ secrets.AZURE_MODEL_NAME }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }}
AZURE_OPENAI_API_INSTANCE: ${{ secrets.AZURE_OPENAI_API_INSTANCE }}
AZURE_OPENAI_API_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_API_DEPLOYMENT }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
BEDROCK_AWS_ACCESS_KEY_ID: ${{ secrets.BEDROCK_AWS_ACCESS_KEY_ID }}
BEDROCK_AWS_SECRET_ACCESS_KEY: ${{ secrets.BEDROCK_AWS_SECRET_ACCESS_KEY }}

integration-tests:
name: 'integration tests (change-gated)'
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Restore node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Check for Google LLM changes
id: google_changes
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD 2>/dev/null | grep -q "^src/llm/google/"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi

- name: Run Google LLM tests (flaky - timeouts allowed)
id: google_llm_tests
if: steps.google_changes.outputs.changed == 'true'
continue-on-error: true
run: npx jest src/llm/google/llm.spec.ts --runInBand
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_TEST_CALL_GAP_MS: '1000'
GOOGLE_TEST_MAX_RETRIES: '2'
GOOGLE_TEST_MAX_RETRY_DELAY_MS: '50000'

- name: Surface Google LLM soft failure
if: always() && steps.google_changes.outputs.changed == 'true' && steps.google_llm_tests.outcome == 'failure'
run: |
echo "::warning title=Soft-failed Google LLM tests::The Google LLM integration suite failed, but this workflow allows provider API failures. Inspect the test job logs before merging."
{
echo "### Soft-failed Google LLM tests"
echo ""
echo "The Google LLM integration suite failed, but this job intentionally allows provider API failures."
echo ""
echo "- Suite: \`npx jest src/llm/google/llm.spec.ts --runInBand\`"
echo "- Active Gemini quotas: https://ai.dev/rate-limit"
echo "- Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
} >> "$GITHUB_STEP_SUMMARY"

- name: Check for Anthropic LLM changes
id: anthropic_changes
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD 2>/dev/null | grep -q "^src/llm/anthropic/"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi

- name: Run Anthropic LLM tests (flaky - timeouts allowed)
id: anthropic_llm_tests
if: steps.anthropic_changes.outputs.changed == 'true'
continue-on-error: true
run: npx jest src/llm/anthropic/llm.spec.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

- name: Surface Anthropic LLM soft failure
if: always() && steps.anthropic_changes.outputs.changed == 'true' && steps.anthropic_llm_tests.outcome == 'failure'
run: |
echo "::warning title=Soft-failed Anthropic LLM tests::The Anthropic LLM integration suite failed, but this workflow allows provider API failures. Inspect the test job logs before merging."
{
echo "### Soft-failed Anthropic LLM tests"
echo ""
echo "The Anthropic LLM integration suite failed, but this job intentionally allows provider API failures."
echo ""
echo "- Suite: \`npx jest src/llm/anthropic/llm.spec.ts\`"
echo "- Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
} >> "$GITHUB_STEP_SUMMARY"

- name: Check for PTC changes
id: ptc_changes
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD 2>/dev/null | grep -qE "^src/tools/ProgrammaticToolCalling\.ts|^src/tools/ToolNode\.ts|^src/agents/AgentContext\.ts|^src/test/mockTools\.ts"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi

- name: Run PTC unit tests
if: steps.ptc_changes.outputs.changed == 'true'
run: npx jest src/tools/__tests__/ProgrammaticToolCalling.test.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
LIBRECHAT_CODE_BASEURL: ${{ secrets.LIBRECHAT_CODE_BASEURL }}

- name: Check for Tool Search changes
id: tool_search_changes
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD 2>/dev/null | grep -qE "^src/tools/ToolSearch\.ts|^src/tools/ToolNode\.ts|^src/agents/AgentContext\.ts|^src/test/mockTools\.ts"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi

- name: Run Tool Search unit tests
if: steps.tool_search_changes.outputs.changed == 'true'
run: npx jest src/tools/__tests__/ToolSearch.test.ts
env:
NODE_OPTIONS: '--experimental-vm-modules'
NODE_ENV: test
LIBRECHAT_CODE_BASEURL: ${{ secrets.LIBRECHAT_CODE_BASEURL }}
validate:
uses: ./.github/workflows/validate.yml
secrets: inherit
Loading
Loading