Skip to content

Version Packages (beta) #24750

Version Packages (beta)

Version Packages (beta) #24750

Workflow file for this run

name: CI
on:
push:
branches:
- main
- release-v*
pull_request:
branches:
- main
- release-v*
jobs:
build-examples:
name: 'Build Examples'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Use Node.js 22
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Examples
run: pnpm run build:examples
prettier:
name: 'Prettier'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Use Node.js 22
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Prettier check
run: pnpm run prettier-check
eslint:
name: 'ESLint'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Use Node.js 22
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run ESLint check
run: pnpm run lint
types:
name: 'TypeScript'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Use Node.js 22
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run TypeScript type check
run: pnpm run type-check:full
bundle-size:
name: 'Bundle Size Check'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Use Node.js 22
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm run build:packages
- name: Check bundle size
run: cd packages/ai && pnpm run check-bundle-size
- name: Upload bundle size metafiles
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: bundle-size-metafiles
path: packages/ai/dist-bundle-check/*.json
test_matrix:
name: 'Test'
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
strategy:
matrix:
node-version: [20, 22]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run tests
run: pnpm test
# separate "test" job to set as required in branch protections,
# as the matrix build names above change each time Node versions change
test:
runs-on: ubuntu-latest
needs: test_matrix
if: ${{ !cancelled() }}
steps:
- name: All matrix versions passed
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some matrix version failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
load-time_matrix:
name: 'Load Time Check'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- module: 'ai'
max-load-time: 100
- module: '@ai-sdk/openai'
max-load-time: 65
- module: '@ai-sdk/openai-compatible'
max-load-time: 65
- module: '@ai-sdk/anthropic'
max-load-time: 65
- module: '@ai-sdk/google'
max-load-time: 65
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Use Node.js 22
uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm run build:packages
- name: Measure and check load time for ${{ matrix.module }}
id: load-time
working-directory: examples/ai-core
run: |
echo "📦 Measuring load time for ${{ matrix.module }}..."
pnpm tsx src/benchmark/load-time.ts "${{ matrix.module }}" | tee load-time-output.txt
# Extract the average time from the output
AVERAGE_TIME=$(grep "Average:" load-time-output.txt | awk '{print $2}' | sed 's/ms//')
echo ""
echo "🔍 Checking threshold..."
echo "Average load time: ${AVERAGE_TIME}ms"
echo "Maximum allowed: ${{ matrix.max-load-time }}ms"
if (( $(echo "$AVERAGE_TIME > ${{ matrix.max-load-time }}" | bc -l) )); then
echo ""
echo "❌ Load time check failed!"
echo "${{ matrix.module }}: ${AVERAGE_TIME}ms exceeds ${{ matrix.max-load-time }}ms threshold"
echo ""
echo "To fix this:"
echo "1. Investigate and optimize slow module initialization"
echo "2. Update the max-load-time in .github/workflows/ci.yml if the increase is justified"
exit 1
else
echo ""
echo "✅ Load time check passed!"
echo "${{ matrix.module }}: ${AVERAGE_TIME}ms is within ${{ matrix.max-load-time }}ms threshold"
# write result to summary
echo "- Load Time Check for ${{ matrix.module }}: ${AVERAGE_TIME}ms (Max: ${{ matrix.max-load-time }}ms)" >> $GITHUB_STEP_SUMMARY
fi
# separate "load-time" job to set as required in branch protections,
# as the matrix build names above change each time modules are added/removed
load-time:
runs-on: ubuntu-latest
needs: load-time_matrix
if: ${{ !cancelled() }}
steps:
- name: All matrix versions passed
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some matrix version failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1