From de03c52ed38493c88bc58140fa7554e9612ddc39 Mon Sep 17 00:00:00 2001 From: Saket Aryan Date: Wed, 10 Jun 2026 21:11:39 +0530 Subject: [PATCH] ci: add CI and CD workflows for pi-agent-plugin (#5469) --- .github/workflows/cd.yml | 6 +- .github/workflows/pi-agent-plugin-cd.yml | 46 ++++++++++ .github/workflows/pi-agent-plugin-checks.yml | 93 ++++++++++++++++++++ AGENTS.md | 2 + 4 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pi-agent-plugin-cd.yml create mode 100644 .github/workflows/pi-agent-plugin-checks.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2da4e97e1..efb7c958b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -7,7 +7,9 @@ on: jobs: build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI - if: startsWith(github.event.release.tag_name, 'v') + # Pure SDK version tags only (v1.2.3) — excludes package-prefixed tags + # like vercel-ai-v* that also start with 'v' + if: startsWith(github.event.release.tag_name, 'v') && !contains(github.event.release.tag_name, '-v') runs-on: ubuntu-latest permissions: id-token: write @@ -39,7 +41,7 @@ jobs: # packages_dir: dist/ - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-v') uses: pypa/gh-action-pypi-publish@release/v1 with: packages_dir: dist/ diff --git a/.github/workflows/pi-agent-plugin-cd.yml b/.github/workflows/pi-agent-plugin-cd.yml new file mode 100644 index 000000000..fb09e9684 --- /dev/null +++ b/.github/workflows/pi-agent-plugin-cd.yml @@ -0,0 +1,46 @@ +name: Publish @mem0/pi-agent-plugin 📦 to npm + +on: + release: + types: [published] + +jobs: + build-n-publish: + name: Build and publish @mem0/pi-agent-plugin 📦 to npm + if: startsWith(github.event.release.tag_name, 'pi-agent-v') + runs-on: ubuntu-latest + permissions: + id-token: write + defaults: + run: + working-directory: pi-agent-plugin + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + registry-url: 'https://registry.npmjs.org' + cache: 'pnpm' + cache-dependency-path: pi-agent-plugin/pnpm-lock.yaml + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm build + + - name: Publish to npm + run: | + if [ "${{ github.event.release.prerelease }}" = "true" ]; then + PREID=$(node -p "require('./package.json').version.split('-')[1].split('.')[0]") + npx npm@latest publish --provenance --access public --tag "$PREID" + else + npx npm@latest publish --provenance --access public + fi diff --git a/.github/workflows/pi-agent-plugin-checks.yml b/.github/workflows/pi-agent-plugin-checks.yml new file mode 100644 index 000000000..71118b72e --- /dev/null +++ b/.github/workflows/pi-agent-plugin-checks.yml @@ -0,0 +1,93 @@ +name: pi-agent-plugin checks + +on: + workflow_dispatch: + push: + branches: [main] + paths: + - 'pi-agent-plugin/**' + - '.github/workflows/pi-agent-plugin-checks.yml' + pull_request: + paths: + - 'pi-agent-plugin/**' + - '.github/workflows/pi-agent-plugin-checks.yml' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + cache-dependency-path: pi-agent-plugin/pnpm-lock.yaml + + - name: Install dependencies + run: cd pi-agent-plugin && pnpm install --frozen-lockfile + + - name: Type check + run: cd pi-agent-plugin && pnpm exec tsc --noEmit + + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20, 22] + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + cache-dependency-path: pi-agent-plugin/pnpm-lock.yaml + + - name: Install dependencies + run: cd pi-agent-plugin && pnpm install --frozen-lockfile + + - name: Run tests + run: cd pi-agent-plugin && pnpm exec vitest run + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + cache-dependency-path: pi-agent-plugin/pnpm-lock.yaml + + - name: Install dependencies + run: cd pi-agent-plugin && pnpm install --frozen-lockfile + + - name: Build + run: cd pi-agent-plugin && pnpm build + + - name: Verify dist output exists + run: | + test -f pi-agent-plugin/dist/index.js || (echo "Build output missing: dist/index.js" && exit 1) + test -f pi-agent-plugin/dist/index.d.ts || (echo "Build output missing: dist/index.d.ts" && exit 1) + test -f pi-agent-plugin/dist/entry.js || (echo "Build output missing: dist/entry.js" && exit 1) + test -f pi-agent-plugin/dist/entry.d.ts || (echo "Build output missing: dist/entry.d.ts" && exit 1) diff --git a/AGENTS.md b/AGENTS.md index bc40190b3..4d4c25978 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -414,6 +414,7 @@ To add a new LLM, embedding, vector store, or reranker provider: | Node CLI | `cli-node-ci.yml` | Push to `cli/node/`, PRs, manual | Biome lint + tsc + vitest + tsup build on Node 20, 22 | | OpenClaw | `openclaw-checks.yml` | Push to `openclaw/`, PRs, manual | tsc + vitest (with Codecov) + tsup build on Node 20, 22 | | OpenCode Plugin | `opencode-plugin-checks.yml` | Push to `mem0-plugin/.opencode-plugin/`, PRs, manual | Bun: tsc type-check + build + dist artifact check | +| Pi Agent Plugin | `pi-agent-plugin-checks.yml` | Push to `pi-agent-plugin/`, PRs, manual | tsc + vitest + tsup build (dist artifact check) on Node 20, 22 | ### CD Workflows (automated publishing) @@ -426,6 +427,7 @@ To add a new LLM, embedding, vector store, or reranker provider: | Vercel AI SDK | `vercel-ai-cd.yml` | `vercel-ai-v*` | npm (`@mem0/vercel-ai-provider`) | | OpenClaw | `openclaw-cd.yml` | `openclaw-v*` | npm (`@mem0/openclaw-mem0`) | | OpenCode Plugin | `opencode-plugin-cd.yml` | `opencode-v*` | npm (`@mem0/opencode-plugin`) | +| Pi Agent Plugin | `pi-agent-plugin-cd.yml` | `pi-agent-v*` | npm (`@mem0/pi-agent-plugin`) | - All publishing uses **OIDC trusted publishing** — no tokens or secrets required. - First publish of a new npm package must be done manually; OIDC works for subsequent versions.