Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ jobs:

- run: npm ci

# ioredis 6 needs Node >= 20; @babelqueue/redis still supports ioredis ^5 on Node 18. The lockfile
# pins ioredis 6, so the Node 18 job swaps it for ioredis 5 (job-local, never committed) before build/typecheck/test.
- name: Use ioredis 5 on Node 18
if: ${{ matrix.node == '18' }}
run: |
# `npm install [--no-save] ioredis@5` keeps the lockfile's ioredis 6 on npm 10 ("up to date"), and so does
# `npm install` after only editing package.json: npm 10 trusts the nested lockfile entry. So the job-local
# working copy gets the devDependency range moved to ^5 AND the nested lock entries of this workspace
# dropped, then the tree is re-resolved (the rest of the lockfile is still honoured). Nothing is committed.
npm pkg set devDependencies.ioredis='^5.0.0' -w @babelqueue/redis
node -e 'const fs = require("fs"); const l = JSON.parse(fs.readFileSync("package-lock.json", "utf8")); for (const k of Object.keys(l.packages)) if (k.startsWith("packages/redis/node_modules/")) delete l.packages[k]; fs.writeFileSync("package-lock.json", JSON.stringify(l, null, 2) + "\n")'
npm install
# Fail loudly if the swap did not take effect, so an "ioredis 5" leg can never silently run ioredis 6.
node -e 'const v = require(require.resolve("ioredis/package.json", { paths: ["packages/redis"] })).version; console.log("ioredis " + v); if (!v.startsWith("5.")) process.exit(1)'

- name: Build
run: npm run build

Expand Down Expand Up @@ -92,12 +107,18 @@ jobs:
done

redis:
name: Redis live (redis_layout + Lua integration)
# Both supported ioredis majors run against live Redis. The lockfile pins ioredis 6 (the plain job name
# is unchanged, so an existing required-check name keeps matching); the ioredis 5 job swaps it in.
name: Redis live (redis_layout + Lua integration)${{ matrix.ioredis == '5' && ' - ioredis 5' || '' }}
# Required check: the live Redis tests (conformance `redis_layout`, the Lua scripts, kill-9 /
# late-ack recovery) must run for real here. BQ_REQUIRE_REDIS turns an unreachable Redis into a
# failure instead of the local-dev skip, so this job can never go green by skipping.
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
ioredis: [ "6", "5" ]
services:
redis:
image: redis:7
Expand All @@ -123,14 +144,32 @@ jobs:

- run: npm ci

- name: Use ioredis 5
if: ${{ matrix.ioredis == '5' }}
run: |
# `npm install [--no-save] ioredis@5` keeps the lockfile's ioredis 6 on npm 10 ("up to date"), and so does
# `npm install` after only editing package.json: npm 10 trusts the nested lockfile entry. So the job-local
# working copy gets the devDependency range moved to ^5 AND the nested lock entries of this workspace
# dropped, then the tree is re-resolved (the rest of the lockfile is still honoured). Nothing is committed.
npm pkg set devDependencies.ioredis='^5.0.0' -w @babelqueue/redis
node -e 'const fs = require("fs"); const l = JSON.parse(fs.readFileSync("package-lock.json", "utf8")); for (const k of Object.keys(l.packages)) if (k.startsWith("packages/redis/node_modules/")) delete l.packages[k]; fs.writeFileSync("package-lock.json", JSON.stringify(l, null, 2) + "\n")'
npm install
# Fail loudly if the swap did not take effect, so an "ioredis 5" leg can never silently run ioredis 6.
node -e 'const v = require(require.resolve("ioredis/package.json", { paths: ["packages/redis"] })).version; console.log("ioredis " + v); if (!v.startsWith("5.")) process.exit(1)'

- name: Build
run: npm run build

- name: Typecheck (@babelqueue/redis against ioredis ${{ matrix.ioredis }})
run: npm run typecheck -w @babelqueue/redis

- name: Redis tests (live Redis, no skips)
run: npm run test -w @babelqueue/redis

# The bullmq adapter creates the `Queue` of a `deadLetterQueue: true | "<name>"` itself; that path needs Redis.
# It brings its own ioredis, so it is independent of the matrix and runs once.
- name: BullMQ tests (live Redis for the deadLetterQueue Queue creation)
if: ${{ matrix.ioredis == '6' }}
run: npm run test -w @babelqueue/bullmq

- name: Assert no conformance failures
Expand Down
Loading