LibreChat/.github/workflows/lighthouse.yml
Danny Avila d32403f851
Some checks failed
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Channel Gateway / gateway (push) Waiting to run
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Playwright E2E Tests / Codegraph select (push) Waiting to run
Playwright E2E Tests / e2e () (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 1) (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 2) (push) Blocked by required conditions
Playwright E2E Tests / MCP Apps (browser and server) (push) Waiting to run
Playwright E2E Tests / e2e (push) Blocked by required conditions
Main Promotion Policy Tests / Main promotion denial and fast-forward tests (push) Waiting to run
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Has been cancelled
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been cancelled
🍃 ci: Provision the mongod Binary Before Any Test Starts (#18053)
* 🍃 ci: Provision the mongod Binary Before Tests Start

mongodb-memory-server downloads its ~122 MB mongod the first time a test
starts a server, inside a 15 s beforeAll. Only backend-review.yml cached
~/.cache/mongodb-binaries (the same step pasted four times), and a cache
alone still leaves the download inside the first hook on a miss.

Integration Tests downloaded on every run: 6 failures in 274 runs with
"Exceeded timeout of 15000 ms for a hook" in secrets.integration.spec.ts,
followed by "spawn ETXTBSY" in the suites that started mongod while the
timed-out download was still writing it.

Add .github/actions/mongodb-binary: restore the cache with the existing
key scheme, ask the installed mongodb-memory-server for the binary it
wants (MongoBinary.getPath), make sure that binary sits in the home cache
every working directory resolves, run it once, and save the cache right
away. The step fails the job when no runnable binary can be put in place.

Use it in every job that starts mongodb-memory-server, after dependencies
are installed and before tests, and add the action to the path filters of
the workflows that list their own file.

* 🧪 test: Cover the mongod Provisioning Script Without the Network

Run the real script against a stand-in resolver that keeps the properties it relies on: home cache first, download when missing, and a memoised path until the cache is cleared. Integration Tests runs the suite before it uses the action.

* 🧪 test: Run mongod Provisioning Against the Real Resolver

The suite replaced mongodb-memory-server with a hand-written stand-in, so
it checked the script against a description of the resolver rather than the
installed one. It now runs the script against the real library and
replaces only the network: MONGOMS_DOWNLOAD_MIRROR points at a local
server that serves an archive whose bin/mongod is a shell script, with the
.md5 the library verifies it against.

Recovery also no longer charges a broken copy that was already on disk to
the download: with a broken binary in both the home cache and the root
node_modules/.cache, the first attempt removed one, the retry met the
other, and the step failed without ever downloading. Existing copies are
now discarded one at a time and the download keeps its own two attempts.

* 🧪 test: Reach the Exit-Status Check Behind the Library's System Binary Probe

A system binary that prints nothing is rejected by the library's own version probe, so the case never reached this script's check or the rule that a file the job named is not deleted. Add one that answers the probe and exits non-zero.
2026-11-11 10:31:46 -05:00

130 lines
4.8 KiB
YAML

name: Lighthouse CI
on:
pull_request:
paths:
- 'api/**'
- 'client/**'
- 'config/**'
- 'packages/**'
- 'e2e/**'
- 'package.json'
- 'package-lock.json'
- '.github/workflows/lighthouse.yml'
- '.github/actions/mongodb-binary/**'
- '!**.md'
workflow_dispatch:
permissions:
contents: read
pull-requests: write
concurrency:
group: lighthouse-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lighthouse:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
E2E_CHROMIUM_CHANNEL: chromium
LIGHTHOUSE_CHROME_FLAGS: --no-sandbox
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: '24.22.1'
cache: npm
- name: Test Lighthouse failure reporting
run: node --test e2e/lighthouse.test.mts
# Shares the E2E workflows' exact key and path list: one installed tree
# per lockfile, never a tree from another lockfile.
- name: Restore node_modules cache
id: cache-node-modules
uses: actions/cache/restore@v5
with:
path: |
node_modules
client/node_modules
packages/client/node_modules
packages/chat/node_modules
packages/data-provider/node_modules
packages/data-schemas/node_modules
packages/api/node_modules
packages/channel-gateway/node_modules
api/node_modules
key: node-modules-e2e-${{ runner.os }}-24.22.1-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
id: install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
# Saved before the audit runs, so nothing the build or the app writes can
# end up in the tree other jobs restore.
- name: Save node_modules cache
if: steps.install-dependencies.outcome == 'success'
continue-on-error: true
uses: actions/cache/save@v5
with:
path: |
node_modules
client/node_modules
packages/client/node_modules
packages/chat/node_modules
packages/data-provider/node_modules
packages/data-schemas/node_modules
packages/api/node_modules
packages/channel-gateway/node_modules
api/node_modules
key: ${{ steps.cache-node-modules.outputs.cache-primary-key }}
- name: Provision MongoDB memory-server binary
uses: ./.github/actions/mongodb-binary
- name: Install lockfile-pinned Chromium
run: npx playwright install --no-shell chromium
# The audit keeps the lockfile-pinned Chromium build, so its download above stays fatal.
# Its system packages do not: the runner's own Chrome already brings every library
# Chromium links, and what `--with-deps` installed on top were nine optional font packages
# (22MB from the Ubuntu mirror) that no budget reads. With the mirror unreachable, apt
# failed the combined command before any audit ran.
- name: Install optional Chromium system packages (best effort)
timeout-minutes: 4
continue-on-error: true
run: .github/scripts/install-playwright-fonts.sh chromium
- name: Select Lighthouse browser
run: |
chrome=$(node -p "require('@playwright/test').chromium.executablePath()")
"$chrome" --version
echo "CHROME_PATH=$chrome" >> "$GITHUB_ENV"
- run: npm run e2e:prepare
- name: Audit serial database latency
id: audit
shell: bash
run: |
set -o pipefail
npm run lighthouse:run 2>&1 | tee lighthouse-ci.log
- name: Comment Lighthouse findings
if: ${{ failure() && steps.audit.outcome == 'failure' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
{
echo 'Lighthouse CI failed. The last 80 log lines contain the measured budgets and assertion failures.'
echo
echo '```text'
tail -n 80 lighthouse-ci.log
echo '```'
echo
echo "[Open the full run]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)"
} > lighthouse-comment.md
gh pr comment "$PR_NUMBER" --body-file lighthouse-comment.md
- name: Upload Lighthouse reports
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v6
with:
name: lighthouse
path: |
.lighthouse/
lighthouse-ci.log
include-hidden-files: true
retention-days: 7