111 lines
2.6 KiB
YAML
111 lines
2.6 KiB
YAML
name: TypeScript SDK CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'mem0-ts/**'
|
|
- '.github/workflows/ts-sdk-ci.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'mem0-ts/**'
|
|
|
|
jobs:
|
|
check_changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
ts_sdk_changed: ${{ steps.filter.outputs.ts_sdk }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
ts_sdk:
|
|
- 'mem0-ts/**'
|
|
|
|
build_ts_sdk:
|
|
needs: check_changes
|
|
if: needs.check_changes.outputs.ts_sdk_changed == 'true'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [20, 22]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
cache-dependency-path: mem0-ts/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
working-directory: mem0-ts
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Lint
|
|
working-directory: mem0-ts
|
|
run: npx prettier --check .
|
|
|
|
- name: Build
|
|
working-directory: mem0-ts
|
|
run: pnpm run build
|
|
|
|
- name: Run unit tests
|
|
working-directory: mem0-ts
|
|
run: pnpm run test:unit
|
|
|
|
- name: Verify package exports
|
|
working-directory: mem0-ts
|
|
run: |
|
|
node -e "const m = require('./dist/index.js'); console.log('Client exports:', Object.keys(m).length)"
|
|
node -e "const m = require('./dist/oss/index.js'); console.log('OSS exports:', Object.keys(m).length)"
|
|
|
|
- name: Upload coverage
|
|
if: matrix.node-version == 20
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: mem0-ts/coverage/
|
|
|
|
integration_ts_sdk:
|
|
needs: build_ts_sdk
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
max-parallel: 1
|
|
matrix:
|
|
node-version: [20, 22]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
cache-dependency-path: mem0-ts/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
working-directory: mem0-ts
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
working-directory: mem0-ts
|
|
run: pnpm run build
|
|
|
|
- name: Run integration tests (with cleanup)
|
|
working-directory: mem0-ts
|
|
env:
|
|
MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }}
|
|
run: pnpm run test:integration
|