From 6cea218188fe4f1c581708607ea54cb5c802340e Mon Sep 17 00:00:00 2001 From: Derek Ricciuto Date: Tue, 3 Dec 2024 12:23:52 -0500 Subject: [PATCH] Fixed GH actions (added npm ci on root directory first) --- .github/workflows/lint.yml | 40 ++++++++++++++++++++++ .github/workflows/publish_agentkit.yml | 28 +++++++++++++++ .github/workflows/publish_docs.yml | 45 +++++++++++++++++++++++++ .github/workflows/publish_langchain.yml | 28 +++++++++++++++ .github/workflows/unit_tests.yml | 44 ++++++++++++++++++++++++ README.md | 4 +-- 6 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/publish_agentkit.yml create mode 100644 .github/workflows/publish_docs.yml create mode 100644 .github/workflows/publish_langchain.yml create mode 100644 .github/workflows/unit_tests.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..5e24f35 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,40 @@ +name: Lint + +on: [pull_request] + +jobs: + lint-agentkit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "18" + cache: "npm" + # Install dependencies in parent directory first + - run: npm ci + # Then install and lint in working directory + - name: Install and lint agentkit + working-directory: ./cdp-agentkit-core + run: | + npm ci + npm run lint + npm run format + + lint-langchain: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "18" + cache: "npm" + # Install dependencies in parent directory first + - run: npm ci + # Then install and lint in working directory + - name: Install and lint langchain + working-directory: ./cdp-langchain + run: | + npm ci + npm run lint + npm run format \ No newline at end of file diff --git a/.github/workflows/publish_agentkit.yml b/.github/workflows/publish_agentkit.yml new file mode 100644 index 0000000..46d0f0d --- /dev/null +++ b/.github/workflows/publish_agentkit.yml @@ -0,0 +1,28 @@ +name: Release AgentKit Core to NPM + +on: + workflow_dispatch: + +jobs: + deploy-agentkit: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "18" + registry-url: "https://registry.npmjs.org" + # Install dependencies in parent directory first + - run: npm ci + # Then install, build and publish in working directory + - name: Install, build and publish agentkit + working-directory: ./cdp-agentkit-core + run: | + npm ci + npm run build + npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml new file mode 100644 index 0000000..25adce9 --- /dev/null +++ b/.github/workflows/publish_docs.yml @@ -0,0 +1,45 @@ +name: Publish Docs to Github Pages + +on: + workflow_dispatch: + +jobs: + build-and-deploy-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "18" + cache: "npm" + + # Install dependencies in parent directory first + - run: npm ci + + # Build cdp-agentkit-core docs + - name: Build AgentKit Core docs + run: | + cd cdp-agentkit-core + npm ci + npm run docs + cd .. + mkdir -p docs/cdp-agentkit-core + cp -r cdp-agentkit-core/docs/* docs/cdp-agentkit-core/ + + # Build cdp-langchain docs + - name: Build LangChain docs + run: | + cd cdp-langchain + npm ci + npm run docs + cd .. + mkdir -p docs/cdp-langchain + cp -r cdp-langchain/docs/* docs/cdp-langchain/ + + # Deploy to GitHub Pages + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + keep_files: false \ No newline at end of file diff --git a/.github/workflows/publish_langchain.yml b/.github/workflows/publish_langchain.yml new file mode 100644 index 0000000..7ad921f --- /dev/null +++ b/.github/workflows/publish_langchain.yml @@ -0,0 +1,28 @@ +name: Publish LangChain to NPM + +on: + workflow_dispatch: + +jobs: + deploy-langchain: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "18" + registry-url: "https://registry.npmjs.org" + # Install dependencies in parent directory first + - run: npm ci + # Then install, build and publish in working directory + - name: Install, build and publish langchain + working-directory: ./cdp-langchain + run: | + npm ci + npm run build + npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 0000000..c097b6f --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,44 @@ +name: Unit Tests + +on: [pull_request] + +jobs: + test-agentkit: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ["18", "20"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + # Install dependencies in parent directory first + - run: npm ci + # Then install and test in working directory + - name: Install and test agentkit + working-directory: ./cdp-agentkit-core + run: | + npm ci + npm run test:unit + + test-langchain: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ["18", "20"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + # Install dependencies in parent directory first + - run: npm ci + # Then install and test in working directory + - name: Install and test langchain + working-directory: ./cdp-langchain + run: | + npm ci + npm run test:unit \ No newline at end of file diff --git a/README.md b/README.md index e99366f..63608ea 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CDP Agentkit.js +# CDP Agentkit Node.js SDK [![npm downloads](https://img.shields.io/npm/dm/@coinbase/cdp-agentkit-core?style=flat-square)](https://www.npmjs.com/package/@coinbase/cdp-agentkit-core) [![GitHub star chart](https://img.shields.io/github/stars/coinbase/cdp-agentkit-nodejs?style=flat-square)](https://star-history.com/#coinbase/cdp-agentkit-nodejs) @@ -48,4 +48,4 @@ See [SECURITY.md](SECURITY.md) for more information. ## Documentation - [CDP Agentkit Documentation](https://docs.cdp.coinbase.com/agentkit/docs/welcome) - [API Reference: CDP Agentkit Core](https://coinbase.github.io/cdp-agentkit-nodejs/cdp-agentkit-core/index.html) -- [API Reference: CDP Agentkit LangChain Extension](https://coinbase.github.io/cdp-agentkit-nodejs/cdp-langchain/index.html) +- [API Reference: CDP Agentkit LangChain Extension](https://coinbase.github.io/cdp-agentkit-nodejs/cdp-langchain/index.html) \ No newline at end of file