diff --git a/demos/use_cases/vercel-ai-sdk/.env.example b/demos/use_cases/vercel-ai-sdk/.env.example new file mode 100644 index 00000000..43d71d59 --- /dev/null +++ b/demos/use_cases/vercel-ai-sdk/.env.example @@ -0,0 +1,23 @@ +# Generate a random secret: https://generate-secret.vercel.app/32 or `openssl rand -base64 32` +AUTH_SECRET=**** + +# The following keys below are automatically created and +# added to your environment when you deploy on Vercel + +# Instructions to create an AI Gateway API key here: https://vercel.com/ai-gateway +# API key required for non-Vercel deployments +# For Vercel deployments, OIDC tokens are used automatically +# https://vercel.com/ai-gateway +AI_GATEWAY_API_KEY=**** + + +# Instructions to create a Vercel Blob Store here: https://vercel.com/docs/vercel-blob +BLOB_READ_WRITE_TOKEN=**** + +# Instructions to create a PostgreSQL database here: https://vercel.com/docs/postgres +POSTGRES_URL=**** + + +# Instructions to create a Redis store here: +# https://vercel.com/docs/redis +REDIS_URL=**** diff --git a/demos/use_cases/vercel-ai-sdk/.github/workflows/lint.yml b/demos/use_cases/vercel-ai-sdk/.github/workflows/lint.yml new file mode 100644 index 00000000..1d57a670 --- /dev/null +++ b/demos/use_cases/vercel-ai-sdk/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint +on: + push: + +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + matrix: + node-version: [20] + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.12.3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + - name: Install dependencies + run: pnpm install + - name: Run lint + run: pnpm lint diff --git a/demos/use_cases/vercel-ai-sdk/.github/workflows/playwright.yml b/demos/use_cases/vercel-ai-sdk/.github/workflows/playwright.yml new file mode 100644 index 00000000..6e18c3ec --- /dev/null +++ b/demos/use_cases/vercel-ai-sdk/.github/workflows/playwright.yml @@ -0,0 +1,73 @@ +name: Playwright Tests +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + timeout-minutes: 30 + runs-on: ubuntu-latest + env: + AUTH_SECRET: ${{ secrets.AUTH_SECRET }} + POSTGRES_URL: ${{ secrets.POSTGRES_URL }} + BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }} + REDIS_URL: ${{ secrets.REDIS_URL }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: latest + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Cache Playwright browsers + uses: actions/cache@v3 + id: playwright-cache + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} + + - name: Install Playwright Browsers + if: steps.playwright-cache.outputs.cache-hit != 'true' + run: pnpm exec playwright install --with-deps chromium + + - name: Run Playwright tests + run: pnpm test + + - uses: actions/upload-artifact@v4 + if: always() && !cancelled() + with: + name: playwright-report + path: playwright-report/ + retention-days: 7