bun #1673
Workflow file for this run
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
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" # daily | |
env: | |
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }} | |
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
concurrency: test | |
name: Tests | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- name: Install Dependencies | |
run: bun install | |
- name: Lint | |
run: bun run fmt | |
- name: Run tests | |
run: bun test pkg --bail | |
- name: Build | |
run: bun run build | |
nextjs-local: | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- name: Install Dependencies | |
run: bun install | |
- name: Build | |
run: bun run build | |
- name: Install example | |
run: | | |
bun install | |
bun add @upstash/redis@../../dist | |
working-directory: ./examples/nextjs | |
- name: Build example | |
run: bun run build | |
working-directory: ./examples/nextjs | |
- name: Start example | |
run: bun run start & | |
working-directory: ./examples/nextjs | |
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/nextjs/ci.test.ts | |
env: | |
DEPLOYMENT_URL: http://localhost:3000 | |
nextjs-edge-local: | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- name: Install Dependencies | |
run: bun install | |
- name: Build | |
run: bun run build | |
- name: Install example | |
run: | | |
bun install | |
bun add @upstash/redis@../../dist | |
working-directory: ./examples/nextjs_edge | |
- name: Build example | |
run: bun run build | |
working-directory: ./examples/nextjs_edge | |
- name: Start example | |
run: bun run start & sleep 5 | |
working-directory: ./examples/nextjs_edge | |
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/nextjs_edge/ci.test.ts | |
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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Deploy | |
run: | | |
pnpm --dir=examples/nextjs 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/nextjs/ci.test.ts | |
working-directory: examples/nextjs | |
nextjs-edge-deployed: | |
concurrency: nextjs-edge-deployed | |
runs-on: ubuntu-latest | |
needs: | |
- release | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Deploy | |
run: | | |
pnpm --dir=examples/nextjs_edge 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/nextjs_edge/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 | |
- 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: deno test -A ./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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- name: Install Dependencies | |
run: bun install | |
- name: Build | |
run: bun run build | |
- name: Install example | |
run: | | |
bun install | |
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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- 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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- name: Install Dependencies | |
run: bun install | |
- name: Build | |
run: bun run build | |
- name: Install example | |
run: | | |
bun install | |
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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- 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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Install bun | |
run: npm install -g bun | |
- name: Install Dependencies | |
run: bun install | |
- name: Build | |
run: bun run build | |
- name: Install example | |
working-directory: ./examples/fastly | |
run: | | |
bun install | |
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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- 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@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- 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 | |
- nextjs-local | |
- nextjs-edge-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::8}-$(date '+%Y%m%d')" | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install bun | |
run: npm install -g bun | |
- name: Set package version | |
run: | | |
bun run ./scripts/set-version.js . ${{ steps.version.outputs.version }} | |
echo "export const VERSION='${{ steps.version.outputs.version }}'" > ./version.ts | |
- name: Install Dependencies | |
run: bun install | |
- name: Build | |
run: bun run build | |
- name: Publish ci version | |
working-directory: ./dist | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" > .npmrc | |
npm publish --tag=ci |