Skip to content

Commit

Permalink
Add final, working Vercel app e2e Edge GH workflow (#278)
Browse files Browse the repository at this point in the history
## Problem

Setting the necessary Pinecone-related environment variables in the
Vercel UI enabled us to finalize the e2e Edge GH workflow pipeline.
Everything now deploys and is workable in the `preview` environment (all
we need for right now).

Final working preview:
https://vercel.com/pinecone-io/pinecone-rag-demo/G6hqB1w2fdNyLbHhdjqYvx7pgVzo

## Solution

Pass Pinecone-related env vars needed by app through Vercel
UI/dashboard.

## Type of Change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [x] Non-code change (docs, etc)
- [ ] None of the above: (explain here)




---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1208153851794098
  • Loading branch information
aulorbe authored Aug 30, 2024
1 parent 768cee0 commit 2930bcf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 103 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"es2021": true,
"node": true
},
"ignorePatterns": ["dist", "src/pinecone-generated-ts-fetch"],
"ignorePatterns": [
"dist",
"src/pinecone-generated-ts-fetch",
"pinecone-rag-demo"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
Expand Down
103 changes: 15 additions & 88 deletions .github/actions/e2e-testing/edge/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ name: Spin up Vercel App
inputs:
vercel-token:
required: true
vercel-project-id:
required: true
vercel-org-id:
required: true
PINECONE_API_KEY:
required: true
OPENAI_API_KEY:
required: true
VERCEL_TEAM_SCOPE:
required: true

runs:
using: 'composite'
Expand All @@ -25,102 +15,39 @@ runs:
with:
node-version: '18.20.3'

- name: Install pinecone-ts-client deps
run: npm install
shell: bash

- name: Build pinecone-ts-client code
run: npm run build && echo "Step 3, building pinecone-ts-client!"
run: npm install && npm run build
shell: bash

- name: Package pinecone-ts-client code
run: npm pack && echo "Step 4, running npm pack"
shell: bash

- name: Clone Pinecone Vercel app into pinecone-ts-client
run: |
git clone [email protected]:pinecone-io/pinecone-rag-demo.git
cd pinecone-rag-demo
git pull origin main
echo "Step 5, Cloning Vercel app into TS client"
shell: bash
- name: Clone Vercel app
uses: GuillaumeFalourd/clone-github-repo-action@main
with:
owner: 'pinecone-io'
repository: 'pinecone-rag-demo'
branch: 'main'

- name: Move package to pinecone-rag-demo
run: mv pinecone-database-pinecone-*.tgz . && echo "Step 6, Moving client package to rag-demo"
run: cd pinecone-rag-demo && mv ../pinecone-database-pinecone-*.tgz .
shell: bash

- name: Setup Vercel
uses: amondnet/vercel-action@master
with:
vercel-token: ${{ inputs.vercel-token }}
vercel-project-id: ${{ inputs.vercel-project-id }}
vercel-org-id: ${{ inputs.vercel-org-id }}
env:
vercel-token: ${{ inputs.vercel-token }}
vercel-project-id: ${{ inputs.vercel-project-id }}
vercel-org-id: ${{ inputs.vercel-org-id }}

- name: Install Pinecone Vercel app dependencies
run: npm install && echo "Step 8, Installing Vercel deps"
- name: Install rag-demo deps
run: cd pinecone-rag-demo && npm install
shell: bash

- name: Install pinecone-ts-client "main" branch code into the Vercel app
run: npm install pinecone-database-pinecone-*.tgz && echo "Step 9, Installing main branch code into rag-demo"
shell: bash

- name: Install NextJS explicitly
run: npm install -g next@latest && echo "Step 10, Installing NextJS"
shell: bash

- name: Install pnpm
run: npm install -g pnpm && echo "Step 11, Installing pnpm"
shell: bash

- name: Install rag app dependencies with pnpm
run: pnpm install && echo "Step 12, Installing rag-demo deps"
shell: bash

- name: Remove linting temporarily
run: rm -rf .eslintrc.json && echo "Step 13, remove linting"
shell: bash

- name: Build Pinecone Vercel app
run: pnpm run build && echo "Step 14, build Vercel app"
run: cd pinecone-rag-demo && npm install pinecone-database-pinecone-*.tgz
shell: bash

- name: Install Vercel CLI
run: pnpm add -g vercel && echo "Step 15, Vercel CLI"
shell: bash

- name: Create vercel.json file
run: |
echo '{
"version": 2,
"public": false,
"github": {
"enabled": false
},
"buildCommand": "next build",
"installCommand": "npm install"
"framework": "nextjs",
"functions": {
"src/app/**/*.{ts,tsx}": {
"runtime": "[email protected]",
}
}
}' > vercel.json && echo "Step 16, create vercel.json file"
run: cd pinecone-rag-demo && npm install vercel
shell: bash

- name: Deploy to Vercel
env:
VERCEL_TEAM_SCOPE: ${{ inputs.VERCEL_TEAM_SCOPE }}
vercel-token: ${{ inputs.vercel-token }}
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }}
PINECONE_REGION: us-west-2
PINECONE_INDEX: end-to-end-edge-test
PINECONE_CLOUD: aws
OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }}
- name: Deploy Project Artifacts to Vercel
run: |
vercel --yes --logs --token=$vercel-token --scope=$VERCEL_TEAM_SCOPE
echo "!! Step 17, You are here = " + pwd
cd pinecone-rag-demo
vercel --scope=pinecone-io --token=${{ inputs.vercel-token }} --yes
shell: bash
14 changes: 0 additions & 14 deletions .github/workflows/e2e-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,4 @@ jobs:
- name: Run e2e tests for edge runtime
uses: ./.github/actions/e2e-testing/edge
with:
CI: true
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
VERCEL_TEAM_SCOPE: ${{ secrets.VERCEL_TEAM_SCOPE }}
env:
CI: true
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
VERCEL_TEAM_SCOPE: ${{ secrets.VERCEL_TEAM_SCOPE }}

0 comments on commit 2930bcf

Please sign in to comment.