Skip to content

fix(worker): mitigate job's locks extensions #4990

fix(worker): mitigate job's locks extensions

fix(worker): mitigate job's locks extensions #4990

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master, next]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
coverage:
runs-on: ubuntu-latest
name: coverage for node@lts, redis@7
env:
node-version: lts/*
redis-version: 7-alpine
allowed_coverage_change: -0.25
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: ${{ env.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ env.redis-version }}
- run: yarn install --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn coverage
- name: Upload LCOV to Coveralls
if: ${{ ( github.event_name == 'pull_request' && github.event.pull_request.head.fork == false ) || github.event_name == 'push' }}
uses: coverallsapp/github-action@95b1a2355bd0e526ad2fd62da9fd386ad4c98474 # branch=master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check coverage change not below threshold
shell: bash
run: |
sleep 2
COVERAGE_CHANGE=$(curl -s https://coveralls.io/builds/${{ github.sha }}.json | jq '.coverage_change')
echo coverage changed by ${COVERAGE_CHANGE}%
if [[ -z "$(echo ${COVERAGE_CHANGE} ${{ env.allowed_coverage_change }} | awk '$1 >= $2')" ]]; then
echo current coverage change ${COVERAGE_CHANGE}% below threshold ${{ env.allowed_coverage_change }}%
exit 1
fi
node-redis:
runs-on: ubuntu-latest
name: testing node@${{ matrix.node-version }}, redis@${{ matrix.redis-version }}
strategy:
matrix:
node-version: [current, lts/*, lts/-1, lts/-2]
redis-version: [7-alpine]
include:
- node-version: 'lts/*'
redis-version: 6-alpine
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ matrix.redis-version }}
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn test
node-valkey:
runs-on: ubuntu-latest
env:
node-version: lts/*
name: testing node@lts/*, valkey@8
services:
valkey:
image: valkey/valkey:8-alpine3.20
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v3 # v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn test
node-dragonflydb:
runs-on: ubuntu-latest
env:
node-version: lts/*
name: testing node@lts/*, dragonflydb@latest
services:
dragonflydb:
image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.24.0
env:
DFLY_cluster_mode: emulated
DFLY_lock_on_hashtags: true
HEALTHCHECK_PORT: 6379
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v3 # v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: BULLMQ_TEST_PREFIX={b} yarn test
# node-upstash:
# runs-on: ubuntu-latest
# continue-on-error: true
# env:
# node-version: lts/*
# REDIS_HOST: ${{ secrets.REDIS_HOST }}
# name: testing node@lts/*, upstash@latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3 # v3
# - name: Use Node.js ${{ env.node-version }}
# uses: actions/setup-node@v3 # v3
# with:
# node-version: lts/*
# cache: 'yarn'
# - run: yarn install --ignore-engines --frozen-lockfile --non-interactive
# - run: yarn build
# - run: yarn test
python:
runs-on: ubuntu-latest
name: testing python@${{ matrix.python-version }}, redis@${{ matrix.redis-version }}
strategy:
matrix:
node-version: [lts/*]
redis-version: [7-alpine]
python-version: ['3.10']
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Start Redis
uses: supercharge/redis-github-action@f63fe516254d0af5df91755a4488274c2e71e38c # 1.5.0
with:
redis-version: ${{ matrix.redis-version }}
- run: yarn install --ignore-engines --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn copy:lua:python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 mypy types-redis
pip install -r python/requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./python --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./python --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd python
./run_tests.sh