Memory Tests #25198
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Memory Tests | |
| on: | |
| workflow_run: | |
| workflows: ['Quality assurance'] | |
| types: | |
| - completed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-changes: | |
| if: ${{ github.repository == 'mastra-ai/mastra' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed: ${{ steps.changes.outputs.changed }} | |
| permissions: | |
| contents: read | |
| statuses: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| - name: Set pending status | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'pending' | |
| context: 'Memory Tests' | |
| description: 'Checking for changes' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| - name: Setup pnpm and Node.js | |
| uses: ./.github/actions/setup-pnpm-node | |
| with: | |
| install-dependencies: 'false' | |
| - name: Check for memory package changes using Turborepo | |
| id: changes | |
| uses: ./.github/actions/turbo-changed | |
| with: | |
| packages: '@mastra/memory' | |
| tasks: 'build,test' | |
| base-ref: 'origin/main' | |
| skip-tests: | |
| needs: check-changes | |
| if: needs.check-changes.outputs.changed == 'false' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| statuses: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set success status for unchanged memory | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'success' | |
| context: 'Memory Tests' | |
| description: 'Memory packages unchanged - skipping tests' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| test: | |
| needs: check-changes | |
| if: ${{ github.repository == 'mastra-ai/mastra' && needs.check-changes.outputs.changed == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| suite: | |
| - pg | |
| - upstash | |
| - libsql | |
| - streaming | |
| - working-memory | |
| - agent-memory | |
| - fastembed | |
| - processors | |
| services: | |
| postgres: | |
| image: pgvector/pgvector:pg16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: mastra | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
| TURBO_CACHE: remote:r | |
| GITHUB_REF_NAME: ${{ github.event.workflow_run.head_branch }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| - name: Setup pnpm and Node.js | |
| uses: ./.github/actions/setup-pnpm-node | |
| - name: Build vector+store packages | |
| run: pnpm turbo build --filter "./stores/*" --filter "mastra" --filter "@mastra/memory" --filter "@mastra/fastembed" | |
| env: | |
| NODE_OPTIONS: '--max_old_space_size=6144' | |
| - name: Install integration test dependencies | |
| run: pnpm install --ignore-workspace | |
| working-directory: packages/memory/integration-tests | |
| - name: Compile TypeScript Workers | |
| run: | | |
| npx tsc packages/memory/integration-tests/src/worker/generic-memory-worker.ts packages/memory/integration-tests/src/worker/mock-embedder.ts --esModuleInterop --resolveJsonModule --module commonjs --target es2020 --outDir packages/memory/ --rootDir packages/memory/ --skipLibCheck | |
| - name: Run Memory ${{ matrix.suite }} tests | |
| run: pnpm run test:${{ matrix.suite }} | |
| working-directory: packages/memory/integration-tests | |
| env: | |
| NODE_OPTIONS: '--max_old_space_size=6144' | |
| DB_URL: 'postgresql://postgres:postgres@localhost:5432/mastra' | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| KV_REST_API_URL: ${{ secrets.KV_REST_API_URL }} | |
| KV_REST_API_TOKEN: ${{ secrets.KV_REST_API_TOKEN }} | |
| GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| test-success: | |
| needs: [check-changes, test] | |
| if: ${{ always() && needs.check-changes.outputs.changed == 'true' && needs.test.result == 'success' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| statuses: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set success status for completed tests | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'success' | |
| context: 'Memory Tests' | |
| description: 'All memory tests passed' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| test-failure: | |
| needs: [check-changes, test] | |
| if: ${{ always() && needs.check-changes.outputs.changed == 'true' && needs.test.result == 'failure' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| statuses: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set failure status for failed tests | |
| uses: ./.github/workflows/shared-actions/set-pr-status | |
| with: | |
| status: 'failure' | |
| context: 'Memory Tests' | |
| description: 'One or more memory tests failed' | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |