Skip to content

Add anthropic provider and refactor api field of publishJSON #288

Add anthropic provider and refactor api field of publishJSON

Add anthropic provider and refactor api field of publishJSON #288

Workflow file for this run

name: Tests
on:
pull_request:
env:
QSTASH_TOKEN: ${{ secrets.QSTASH_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ORGANIZATION: ${{ secrets.OPENAI_ORGANIZATION }}
jobs:
local-tests:
runs-on: ubuntu-latest
name: QStash Tests
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Dependencies
run: bun install
- name: Run tests
run: bun run test
- name: Build
run: bun run build
cloudflare-workers-local-build:
runs-on: ubuntu-latest
name: CF Workers Local Build
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Dependencies
run: bun install
- name: Build
run: bun run build
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: bun install
working-directory: examples/cloudflare-workers
- name: Install local package
run: bun install @upstash/qstash@file:../../dist
working-directory: examples/cloudflare-workers
- name: Change main file to ci.ts
run: sed -i 's/main = "src\/index.ts"/main = "src\/ci.ts"/' wrangler.toml
working-directory: examples/cloudflare-workers
- name: Add environment
run: |
echo '[vars]' >> wrangler.toml
echo "QSTASH_TOKEN = \"$QSTASH_TOKEN\"" >> ./wrangler.toml
working-directory: examples/cloudflare-workers
- name: Run example
run: bun dev &
working-directory: examples/cloudflare-workers
- name: Test
run: bun test ci.test.ts
working-directory: examples/cloudflare-workers
env:
DEPLOYMENT_URL: http://127.0.0.1:8787
cloudflare-workers-deployed:
concurrency: cloudflare-workers-deployed
needs:
- release
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup nodejs
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install example
run: |
bun add @upstash/qstash@${{needs.release.outputs.version}}
npm i -g wrangler
working-directory: examples/cloudflare-workers
- name: Add account ID
run: echo 'account_id = "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}"' >> wrangler.toml
working-directory: examples/cloudflare-workers
- name: Add environment
run: |
echo '[vars]' >> wrangler.toml
echo "QSTASH_TOKEN = \"$QSTASH_TOKEN\"" >> ./wrangler.toml
working-directory: examples/cloudflare-workers
- name: Change main file to ci.ts
run: sed -i 's/main = "src\/index.ts"/main = "src\/ci.ts"/' wrangler.toml
working-directory: examples/cloudflare-workers
- name: Deploy
run: wrangler publish
working-directory: examples/cloudflare-workers
env:
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_API_TOKEN}}
- name: Test
run: bun test ci.test.ts
working-directory: examples/cloudflare-workers
env:
DEPLOYMENT_URL: https://upstash-qstash.upsdev.workers.dev
nextjs-local-build:
runs-on: ubuntu-latest
# disabled because of a local build issue. Will be tested properly in
# the deployment test
if: false
name: NextJS Local Build
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Dependencies
run: bun install
- name: Build
run: bun run build
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
- name: Install Dependencies
run: pnpm install
working-directory: examples/nextjs
- name: Install local package
run: pnpm install @upstash/qstash@../../dist
working-directory: examples/nextjs
- name: Local build
run: pnpm run build
working-directory: examples/nextjs
- name: Run Example
run: pnpm dev &
working-directory: examples/nextjs
- name: Test
run: bun test ci.test.ts
working-directory: examples/nextjs
env:
DEPLOYMENT_URL: http://localhost:3000
nextjs-deployed:
concurrency: nextjs-deployed
runs-on: ubuntu-latest
needs:
- release
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Deploy
run: |
pnpm add @upstash/qstash@${{needs.release.outputs.version}}
DEPLOYMENT_URL=$(npx vercel --token=${{ secrets.VERCEL_TOKEN }})
echo "DEPLOYMENT_URL=${DEPLOYMENT_URL}" >> $GITHUB_ENV
env:
VERCEL_ORG_ID: ${{secrets.VERCEL_TEAM_ID}}
VERCEL_PROJECT_ID: "prj_dUPhtwNlX6otLH5CSV4N0CsZzoaq"
working-directory: examples/nextjs
- name: Test
run: bun test ci.test.ts
working-directory: examples/nextjs
release:
concurrency: release
outputs:
version: ${{ steps.version.outputs.version }}
needs:
- cloudflare-workers-local-build
# - nextjs-local-build
- local-tests
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Get version
id: version
run: echo "::set-output name=version::v0.0.0-ci.${GITHUB_SHA}-$(date +%Y%m%d%H%M%S)"
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Set version
run: |
echo $(jq --arg v "${{ steps.version.outputs.version }}" '(.version) = $v' package.json) > package.json
- name: Install Dependencies
run: bun install
- name: Build
run: bun run build
- name: Set NPM_TOKEN
run: npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
- name: Publish ci version
run: npm publish --tag=ci --verbose
working-directory: ./dist
- name: Sleep for 10s
run: sleep 10s
shell: bash