-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new Github action that deploys sample Vercel app (#257)
## Problem As part of a larger effort to set up e2e testing for different runtimes, we'd like to implement a new Github action that would run on PRs that spins up [a sample Vercel app](https://github.com/pinecone-io/pinecone-rag-demo/tree/main) that runs in the Edge runtime. ## Solution Upload this action as a test. ## 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 - [x] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan CI passes
- Loading branch information
Showing
3 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('test'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Spin up Vercel App | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
workflow_call: | ||
secrets: | ||
PINECONE_API_KEY: | ||
required: true | ||
VERCEL_TOKEN: | ||
required: true | ||
VERCEL_PROJECT_ID: | ||
required: true | ||
VERCEL_ORG_ID: | ||
required: true | ||
|
||
# todo: set up with different node versions | ||
jobs: | ||
spin-up-vercel-app: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.20.3' | ||
|
||
- name: Setup Vercel | ||
uses: amondnet/setup-vercel@v25 | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | ||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | ||
|
||
- name: Check out current repository (pinecone-ts-client) | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build pinecone-ts-client code | ||
run: npm run build | ||
|
||
- name: Package pinecone-ts-client code | ||
run: npm pack | ||
|
||
- 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 | ||
|
||
- name: Move package to pinecone-rag-demo | ||
run: mv ../pinecone-database-pinecone-*.tgz . | ||
|
||
- name: Install Pinecone Vercel app dependencies | ||
run: npm install | ||
|
||
- name: Install pinecone-ts-client "main" branch code into the Vercel app | ||
run: npm install pinecone-database-pinecone-*.tgz | ||
|
||
- name: Set up environment variables | ||
with: | ||
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | ||
PINECONE_REGION: us-west-2 | ||
PINECONE_INDEX: end-to-end-edge-test | ||
PINECONE_CLOUD: aws | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
||
- name: Install pnpm | ||
run: npm install pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm i | ||
|
||
# todo: remove linting | ||
- name: remove linting temporarily | ||
run: rm -rf ./eslintrc.json | ||
|
||
- name: Build Pinecone Vercel app | ||
run: pnpm run build | ||
|
||
- name: Install Vercel CLI | ||
run: pnpm add vercel | ||
|
||
- name: Deploy to Vercel | ||
run: vercel deploy --scope=${{ secrets.VERCEL_TEAM_SCOPE }} | ||
|
||
# todo: how to interact with vercel cli in ci? | ||
# - name: Build Pinecone Vercel app | ||
# run: | | ||
# npm run build | ||
# npm install -g pnpm | ||
# pnpm setup | ||
# source ~/.zshrc | ||
# pnpm i -g vercel | ||
# pnpm i | ||
# vercel deploy --scope=${{ secrets.VERCEL_TEAM_SCOPE }} | ||
# - name: Run Vercel app tests | ||
# run: npm run test:e2e | ||
|
||
# - name: Install playwright | ||
# run: npm i playwright && npx playwright test | ||
# env: | ||
# BASE_URL: https://vercel.live/link/pinecone-rag-demo-4rrbeb03q-pinecone-io.vercel.app?via=deployment-domains-list-commit | ||
|
||
# todo: figure out how to log into vercel while inside playwright | ||
# todo: figure out how to override localhost in actual test file -- maybe just make your own? | ||
# or don't? because we don't care about the ui... | ||
|
||
# - name: Hit endpoints | ||
# run: npx hitVercelAppEndpoints.ts # tsc? need tsconfig.json etc? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters