mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-07-02 20:32:58 +00:00
* 🪟 ci: Shard Windows Frontend Unit Tests Mirror the 4-way jest sharding the Ubuntu frontend test job already uses onto the Windows job, which currently runs the whole client suite in a single 20-minute job. Also drops the `--verbose` flag, which npm consumed itself (it preceded `--`) and only raised npm's own log level. * 🪟 ci: Trigger Frontend Tests on Workflow Changes
262 lines
7.8 KiB
YAML
262 lines
7.8 KiB
YAML
name: Frontend Unit Tests
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'client/**'
|
|
- 'packages/client/**'
|
|
- 'packages/data-provider/**'
|
|
- '.github/workflows/frontend-review.yml'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
NODE_OPTIONS: '--max-old-space-size=${{ secrets.NODE_MAX_OLD_SPACE_SIZE || 6144 }}'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build packages
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js 24.16.0
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24.16.0'
|
|
|
|
- name: Restore node_modules cache
|
|
id: cache-node-modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
client/node_modules
|
|
packages/client/node_modules
|
|
packages/data-provider/node_modules
|
|
key: node-modules-frontend-${{ runner.os }}-24.16.0-${{ 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@v4
|
|
with:
|
|
path: packages/data-provider/dist
|
|
key: build-data-provider-${{ runner.os }}-${{ hashFiles('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 client-package build cache
|
|
id: cache-client-package
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: packages/client/dist
|
|
key: build-client-package-${{ runner.os }}-${{ hashFiles('packages/client/src/**', 'packages/client/tsconfig*.json', 'packages/client/tsdown.config.mjs', 'packages/client/package.json', 'packages/data-provider/src/**', 'packages/data-provider/tsconfig*.json', 'packages/data-provider/tsdown.config.mjs', 'packages/data-provider/package.json') }}
|
|
|
|
- name: Build client-package
|
|
if: steps.cache-client-package.outputs.cache-hit != 'true'
|
|
run: npm run build:client-package
|
|
|
|
- name: Upload data-provider build
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-data-provider
|
|
path: packages/data-provider/dist
|
|
retention-days: 2
|
|
|
|
- name: Upload client-package build
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-client-package
|
|
path: packages/client/dist
|
|
retention-days: 2
|
|
|
|
typecheck:
|
|
name: TypeScript type checks (client)
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js 24.16.0
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24.16.0'
|
|
|
|
- name: Restore node_modules cache
|
|
id: cache-node-modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
client/node_modules
|
|
packages/client/node_modules
|
|
packages/data-provider/node_modules
|
|
key: node-modules-frontend-${{ runner.os }}-24.16.0-${{ hashFiles('package-lock.json') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Download data-provider build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-data-provider
|
|
path: packages/data-provider/dist
|
|
|
|
- name: Download client-package build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-client-package
|
|
path: packages/client/dist
|
|
|
|
- name: Type check client
|
|
run: npm run typecheck
|
|
working-directory: client
|
|
|
|
test-ubuntu:
|
|
name: 'Tests: Ubuntu (shard ${{ matrix.shard }}/4)'
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2, 3, 4]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js 24.16.0
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24.16.0'
|
|
|
|
- name: Restore node_modules cache
|
|
id: cache-node-modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
client/node_modules
|
|
packages/client/node_modules
|
|
packages/data-provider/node_modules
|
|
key: node-modules-frontend-${{ runner.os }}-24.16.0-${{ hashFiles('package-lock.json') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Download data-provider build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-data-provider
|
|
path: packages/data-provider/dist
|
|
|
|
- name: Download client-package build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-client-package
|
|
path: packages/client/dist
|
|
|
|
- name: Run unit tests (shard ${{ matrix.shard }}/4)
|
|
run: npm run test:ci -- --shard=${{ matrix.shard }}/4
|
|
working-directory: client
|
|
|
|
test-windows:
|
|
name: 'Tests: Windows (shard ${{ matrix.shard }}/4)'
|
|
needs: build
|
|
runs-on: windows-latest
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2, 3, 4]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js 24.16.0
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24.16.0'
|
|
|
|
- name: Restore node_modules cache
|
|
id: cache-node-modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
client/node_modules
|
|
packages/client/node_modules
|
|
packages/data-provider/node_modules
|
|
key: node-modules-frontend-${{ runner.os }}-24.16.0-${{ hashFiles('package-lock.json') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Download data-provider build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-data-provider
|
|
path: packages/data-provider/dist
|
|
|
|
- name: Download client-package build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-client-package
|
|
path: packages/client/dist
|
|
|
|
- name: Run unit tests (shard ${{ matrix.shard }}/4)
|
|
run: npm run test:ci -- --shard=${{ matrix.shard }}/4
|
|
working-directory: client
|
|
|
|
build-verify:
|
|
name: Vite build verification
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js 24.16.0
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24.16.0'
|
|
|
|
- name: Restore node_modules cache
|
|
id: cache-node-modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
client/node_modules
|
|
packages/client/node_modules
|
|
packages/data-provider/node_modules
|
|
key: node-modules-frontend-${{ runner.os }}-24.16.0-${{ hashFiles('package-lock.json') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Download data-provider build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-data-provider
|
|
path: packages/data-provider/dist
|
|
|
|
- name: Download client-package build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: build-client-package
|
|
path: packages/client/dist
|
|
|
|
- name: Build client
|
|
run: cd client && npm run build:ci
|