Skip to content

Remove sleep after the last retry attempt #2799

Remove sleep after the last retry attempt

Remove sleep after the last retry attempt #2799

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
env:
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
jobs:
test:
runs-on:
group: large-runners
labels: ubuntu-4x
concurrency: test
name: Tests
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Dependencies
run: bun install
- name: Lint
run: bun run fmt
- name: Run tests
run: bun test pkg --bail --timeout 20000
- name: Build
run: bun run build
vercel-functions-app-router-local:
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- 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 example
run: bun add @upstash/redis@../../dist
working-directory: ./examples/vercel-functions-app-router
- name: Build example
run: bun run build
working-directory: ./examples/vercel-functions-app-router
- name: Start example
run: bun run start &
working-directory: ./examples/vercel-functions-app-router
env:
NEXT_PUBLIC_UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
- name: Test
run: bun test examples/vercel-functions-app-router/ci.test.ts
env:
DEPLOYMENT_URL: http://localhost:3000
vercel-functions-pages-router-local:
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- 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 example
run: bun add @upstash/redis@../../dist
working-directory: ./examples/vercel-functions-pages-router
- name: Build example
run: bun run build
working-directory: ./examples/vercel-functions-pages-router
- name: Start example
run: bun run start & sleep 5
working-directory: ./examples/vercel-functions-pages-router
env:
NEXT_PUBLIC_UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
- name: Test
run: bun test examples/vercel-functions-pages-router/ci.test.ts
env:
DEPLOYMENT_URL: http://localhost:3000
vercel-functions-app-router-deployed:
concurrency: vercel-functions-app-router-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: Install @upstash/redis canary version
run: pnpm install @upstash/redis@${{needs.release.outputs.version}}
working-directory: examples/vercel-functions-app-router
- name: Deploy
run: |
pnpm --dir=examples/vercel-functions-app-router add @upstash/redis@${{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_pFFK1XgNIlnW014iiuqAIQmBBuZA"
- name: Test
run: bun test examples/vercel-functions-app-router/ci.test.ts
working-directory: examples/vercel-functions-app-router
vercel-functions-pages-router-deployed:
concurrency: vercel-functions-pages-router-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: Install @upstash/redis canary version
run: pnpm install @upstash/redis@${{needs.release.outputs.version}}
working-directory: examples/vercel-functions-pages-router
- name: Deploy
run: |
pnpm --dir=examples/vercel-functions-pages-router add @upstash/redis@${{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_bc5kMFz6ifbAaA7U3N86YSYqUUUI"
- name: Test
run: bun test examples/vercel-functions-pages-router/ci.test.ts
deno-deployed:
concurrency: deno-deployed
needs:
- release
env:
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Dependencies
run: bun install
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install @upstash/redis canary version
run: sed -i 's;@upstash/redis@latest;@upstash/redis@${{needs.release.outputs.version}};' ./examples/deno/main.ts
- name: Deploy
run: deno run -A https://deno.land/x/deploy/deployctl.ts deploy --project=upstash-redis ./main.ts
working-directory: examples/deno
env:
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
- name: Test
run: bun test main.test.ts
working-directory: examples/deno
env:
DEPLOYMENT_URL: https://upstash-redis-70jbfgxwz310.deno.dev
cloudflare-workers-local:
needs:
- test
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 Dependencies
run: bun install
- name: Build
run: bun run build
- name: Install example
run: |
bun add @upstash/redis@../../dist
npm install -g wrangler
working-directory: examples/cloudflare-workers
- name: Add environment
run: |
echo 'account_id = "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}"' >> wrangler.toml
echo '[vars]' >> wrangler.toml
echo 'UPSTASH_REDIS_REST_URL = "${{ secrets.UPSTASH_REDIS_REST_URL }}"' >> ./wrangler.toml
echo 'UPSTASH_REDIS_REST_TOKEN = "${{ secrets.UPSTASH_REDIS_REST_TOKEN }}"' >> ./wrangler.toml
working-directory: examples/cloudflare-workers
- name: Start example
run: wrangler dev & sleep 10
working-directory: examples/cloudflare-workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
- name: Test
run: bun test examples/cloudflare-workers/ci.test.ts
env:
DEPLOYMENT_URL: http://127.0.0.1:8787
cloudflare-workers-deployed:
concurrency: cloudflare-workers-deployed
needs:
- release
env:
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
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/redis@${{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: Deploy
run: wrangler publish
working-directory: examples/cloudflare-workers
env:
CLOUDFLARE_API_TOKEN: ${{secrets.CF_API_TOKEN}}
- name: Test
run: bun test examples/cloudflare-workers/ci.test.ts
env:
DEPLOYMENT_URL: https://upstash-redis.upstash.workers.dev
cloudflare-workers-with-typescript-local:
needs:
- test
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 Dependencies
run: bun install
- name: Build
run: bun run build
- name: Install example
run: |
bun add @upstash/redis@../../dist
npm install -g wrangler
working-directory: examples/cloudflare-workers-with-typescript
- name: Add environment
run: |
echo 'account_id = "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}"' >> wrangler.toml
echo '[vars]' >> wrangler.toml
echo 'UPSTASH_REDIS_REST_URL = "${{ secrets.UPSTASH_REDIS_REST_URL }}"' >> ./wrangler.toml
echo 'UPSTASH_REDIS_REST_TOKEN = "${{ secrets.UPSTASH_REDIS_REST_TOKEN }}"' >> ./wrangler.toml
working-directory: examples/cloudflare-workers-with-typescript
- name: Start example
run: wrangler dev & sleep 5
working-directory: examples/cloudflare-workers-with-typescript
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
- name: Test
run: bun test examples/cloudflare-workers-with-typescript/ci.test.ts
env:
DEPLOYMENT_URL: http://127.0.0.1:8787
cloudflare-workers-with-typescript-deployed:
concurrency: cloudflare-workers-with-typescript-deployed
needs:
- release
env:
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
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/redis@${{needs.release.outputs.version}}
npm i -g wrangler
working-directory: examples/cloudflare-workers-with-typescript
- name: Add account ID
run: echo 'account_id = "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}"' >> wrangler.toml
working-directory: examples/cloudflare-workers-with-typescript
- name: Deploy
run: wrangler publish
working-directory: examples/cloudflare-workers-with-typescript
env:
CLOUDFLARE_API_TOKEN: ${{secrets.CF_API_TOKEN}}
- name: Test
run: bun test examples/cloudflare-workers-with-typescript/ci.test.ts
env:
DEPLOYMENT_URL: https://cloudflare-workers-with-typescript.upstash.workers.dev
fastly-local:
if: false
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup nodejs
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
with:
version: latest
- 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 example
working-directory: ./examples/fastly
run: |
bun add @upstash/redis@../../dist
curl -L https://github.com/fastly/cli/releases/download/v1.7.0/fastly_v1.7.0_linux-amd64.tar.gz > fastly.tar.gz
tar -xf ./fastly.tar.gz
- name: Inject variables
working-directory: ./examples/fastly
run: |
sed -i 's;<UPSTASH_REDIS_REST_URL>;${{ secrets.UPSTASH_REDIS_REST_URL }};' fastly.toml
sed -i 's;<UPSTASH_REDIS_REST_URL>;${{ secrets.UPSTASH_REDIS_REST_URL }};' src/index.js
sed -i 's;<UPSTASH_REDIS_REST_TOKEN>;${{ secrets.UPSTASH_REDIS_REST_TOKEN }};' src/index.js
- name: Start example
working-directory: ./examples/fastly
run: ./fastly compute serve & sleep 10
- name: Test
run: bun test examples/fastly/ci.test.ts
env:
DEPLOYMENT_URL: http://localhost:7676
fastly-deployed:
if: false
concurrency: fastly-deployed
needs:
- release
env:
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v3
- 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: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Install example
working-directory: ./examples/fastly
run: |
npm install --global npm@latest
pnpm add @upstash/redis@${{needs.release.outputs.version}}
curl -L https://github.com/fastly/cli/releases/download/v1.7.0/fastly_v1.7.0_linux-amd64.tar.gz > fastly.tar.gz
tar -xf ./fastly.tar.gz
- name: Inject variables
working-directory: ./examples/fastly
run: |
sed -i 's;<UPSTASH_REDIS_REST_URL>;${{ secrets.UPSTASH_REDIS_REST_URL }};' fastly.toml
sed -i 's;<UPSTASH_REDIS_REST_URL>;${{ secrets.UPSTASH_REDIS_REST_URL }};' src/index.js
sed -i 's;<UPSTASH_REDIS_REST_TOKEN>;${{ secrets.UPSTASH_REDIS_REST_TOKEN }};' src/index.js
- name: Deploy
working-directory: ./examples/fastly
run: ./fastly compute publish --service-id=${{ secrets.FASTLY_SERVICE_ID }}
env:
FASTLY_API_TOKEN: ${{secrets.FASTLY_API_TOKEN}}
- run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' https://terminally-flowing-lizard.edgecompute.app)" != "200" ]]; do sleep 1; done
timeout-minutes: 2
- name: Test
run: bun test examples/fastly/ci.test.ts
env:
DEPLOYMENT_URL: https://terminally-flowing-lizard.edgecompute.app
nodejs-local:
needs:
- test
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 Dependencies
run: bun install
- name: Build
run: bun run build
- name: Install example
run: bun add @upstash/redis@../../dist
working-directory: examples/nodejs
- name: Run example
run: node ./index.js
working-directory: examples/nodejs
release:
concurrency: release
outputs:
version: ${{ steps.version.outputs.version }}
needs:
- nodejs-local
# - fastly-local - not working in ci for some reason, local is fine
- vercel-functions-app-router-local
- vercel-functions-pages-router-local
- cloudflare-workers-with-typescript-local
- cloudflare-workers-local
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
working-directory: ./dist
run: |
npm pkg delete scripts.prepare
npm publish --tag=ci --verbose
- name: Sleep for 10s
run: sleep 10s
shell: bash