name: Integration Tests # Runs every packages/api `*.integration.spec.ts` / `*.integration.test.ts` suite (e.g. the # durable HITL checkpointer and cross-replica subagent delivery against real MongoDB and # Redis, the admin config secret registry against a real Config collection, MCP flows # against in-process servers). `test:ci` deliberately excludes them, and the Redis-backed # `*.cache_integration` / `*.stream_integration` suites run in cache-integration-tests.yml — # without this job they run nowhere and their regressions guard nothing. Selection is by # suffix, not folder, so a suite added anywhere under src is picked up. on: pull_request: branches: - main - dev - dev-staging - release/* # The suites build and consume data-provider and data-schemas and import # across packages/api (the build-cache keys below hash all three src trees), # so they must re-run on any of them. paths: - 'packages/api/src/**' - 'packages/api/package.json' - 'packages/data-provider/src/**' - 'packages/data-provider/package.json' - 'packages/data-schemas/src/**' - 'packages/data-schemas/package.json' - '.github/workflows/agents-integration-tests.yml' - '.github/actions/mongodb-binary/**' - '!**.md' # The merge queue tests the commit about to land on dev. It has no path filter and no # selection: every job below runs in full. merge_group: types: [checks_requested] permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: agents_integration_tests: name: Integration Tests (MongoDB and Redis) timeout-minutes: 20 runs-on: ubuntu-latest services: redis: image: redis:7-alpine ports: - 6379:6379 options: >- --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 5s --health-retries 5 steps: - name: Checkout repository uses: actions/checkout@v5 - name: Use Node.js 24.22.3 uses: actions/setup-node@v5 with: node-version: '24.22.3' - name: Restore node_modules cache id: cache-node-modules uses: actions/cache@v5 with: path: | node_modules api/node_modules packages/api/node_modules packages/data-provider/node_modules packages/data-schemas/node_modules key: node-modules-backend-${{ runner.os }}-24.22.3-${{ hashFiles('package-lock.json') }} - name: Install dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci - name: Restore data-provider build cache id: cache-data-provider uses: actions/cache@v5 with: path: packages/data-provider/dist key: build-data-provider-${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'packages/data-provider/src/**', 'packages/data-provider/tsconfig*.json', 'packages/data-provider/tsdown.config.mjs', 'packages/data-provider/package.json') }} - name: Build data-provider if: steps.cache-data-provider.outputs.cache-hit != 'true' run: npm run build:data-provider - name: Restore data-schemas build cache id: cache-data-schemas uses: actions/cache@v5 with: path: packages/data-schemas/dist key: build-data-schemas-${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'packages/data-schemas/src/**', 'packages/data-schemas/tsconfig*.json', 'packages/data-schemas/tsdown.config.mjs', 'packages/data-schemas/package.json', 'packages/data-provider/src/**', 'packages/data-provider/tsconfig*.json', 'packages/data-provider/tsdown.config.mjs', 'packages/data-provider/package.json') }} - name: Build data-schemas if: steps.cache-data-schemas.outputs.cache-hit != 'true' run: npm run build:data-schemas - name: Restore api build cache id: cache-api uses: actions/cache@v5 with: path: packages/api/dist key: build-api-${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json', 'packages/api/src/**', 'packages/api/tsconfig*.json', 'packages/api/tsdown.config.mjs', 'packages/api/package.json', 'packages/data-provider/src/**', 'packages/data-provider/tsconfig*.json', 'packages/data-provider/tsdown.config.mjs', 'packages/data-provider/package.json', 'packages/data-schemas/src/**', 'packages/data-schemas/tsconfig*.json', 'packages/data-schemas/tsdown.config.mjs', 'packages/data-schemas/package.json') }} - name: Build api if: steps.cache-api.outputs.cache-hit != 'true' run: npm run build:api - name: Test MongoDB binary provisioning run: node --test .github/actions/mongodb-binary/prewarm.test.mjs # Every suite here runs in one Jest process with 15s hooks. A cold download of the # ~122MB mongod inside the first hook timed it out on a slow mirror day, and the suites # after it then spawned the half-written file (`spawn ETXTBSY`). - name: Provision MongoDB memory-server binary uses: ./.github/actions/mongodb-binary - name: Run integration tests working-directory: packages/api env: NODE_ENV: test REDIS_URI: redis://127.0.0.1:6379 run: npm run test:integration - name: Checkout merged browser enrollment compatibility fixture uses: actions/checkout@v5 with: repository: LibreChat-AI/code-interpreter ref: a3207a75c8327ba1c9526eff8b06f3588f3739ed path: .verification/browser-enrollment-upstream persist-credentials: false sparse-checkout: | packages/code service/src/bridge service/src/logger.ts sparse-checkout-cone-mode: false - name: Build the pinned merged CLI working-directory: .verification/browser-enrollment-upstream/packages/code run: npm ci --no-audit --no-fund && npm run build - name: Verify merged CLI enrollment and profile persistence working-directory: packages/api env: NODE_ENV: test CODE_SETUP_UPSTREAM: ${{ github.workspace }}/.verification/browser-enrollment-upstream CODE_SETUP_REDIS_URI: redis://127.0.0.1:6379/15 run: >- npx jest src/code/setup/compatibility.integration.spec.ts --runInBand --coverage=false --forceExit # dev's merge queue requires this job by name (see merge-gate.yml). It depends on every # other job here, so a new job has to be added to `needs`; merge-gate.test.mjs fails # until it is. No job here may be skipped. gate: name: integration needs: [agents_integration_tests] if: ${{ !cancelled() }} runs-on: ubuntu-latest timeout-minutes: 5 steps: - uses: actions/checkout@v5 with: persist-credentials: false sparse-checkout: .github/scripts - name: Verify every integration job passed env: NEEDS: ${{ toJSON(needs) }} run: node .github/scripts/merge-gate.mjs verify