Skip to content

Use shared workflow for JS+PY release #739

Use shared workflow for JS+PY release

Use shared workflow for JS+PY release #739

Workflow file for this run

name: js
on:
pull_request:
push:
branches: [main]
jobs:
build:
name: node ${{ matrix.node-version }} / zod ${{ matrix.zod }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x, 24.x]
# zod is a peerDependency ("^3.25.0 || ^4.0.0"); test both majors.
zod: ["3", "4"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm install --frozen-lockfile
# The lockfile pins zod 3, so override across the whole tree
- name: Force zod 4
if: matrix.zod == '4'
run: |
printf '\noverrides:\n zod: ^4\n' >> pnpm-workspace.yaml
pnpm install --no-frozen-lockfile
- name: Verify resolved zod major
run: node -e "const v=require('zod/package.json').version; console.log('zod', v); if (!v.startsWith('${{ matrix.zod }}.')) { console.error('expected zod ${{ matrix.zod }}.x'); process.exit(1); }"
- run: pnpm run test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
- run: pnpm run build