Skip to content

Core Package Tests #22573

Core Package Tests

Core Package Tests #22573

name: Core Package Tests
on:
workflow_run:
workflows: ['Quality assurance']
types:
- completed
jobs:
check-changes:
if: ${{ github.repository == 'mastra-ai/mastra' }}
runs-on: ubuntu-latest
outputs:
core-changed: ${{ steps.changes.outputs.core }}
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: 'Core Package 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: Check for core package changes
uses: dorny/paths-filter@v3
id: changes
with:
base: main
ref: ${{ github.event.workflow_run.head_sha }}
predicate-quantifier: 'every'
filters: |
core:
- 'packages/core/**'
- 'packages/schema-compat/**'
- '!**/*.md'
skip-tests:
needs: check-changes
if: needs.check-changes.outputs.core-changed == 'false'
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- uses: actions/checkout@v5
- name: Set success status for unchanged core
uses: ./.github/workflows/shared-actions/set-pr-status
with:
status: 'success'
context: 'Core Package Tests'
description: 'Core package 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.core-changed == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_CACHE: remote:r
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 cli
run: pnpm build:core
- name: Run Zod compatibility checks
run: pnpm test:core:zod
- name: Run Core tests
run: pnpm test:core
env:
NODE_OPTIONS: '--max_old_space_size=8096'
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
test-success:
needs: [check-changes, test]
if: ${{ always() && needs.check-changes.outputs.core-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: 'Core Package Tests'
description: 'All core 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.core-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: 'Core Package Tests'
description: 'Core 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 }}