feat(worker): better handling of concurrency when fetching jobs #3650
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
# 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@e33196f7422957bea03ed53f6fbb155025ffc7b8 # 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 | |
compatibility: | |
runs-on: ubuntu-latest | |
name: testing node@${{ matrix.node-version }}, redis@${{ matrix.redis-version }} | |
strategy: | |
matrix: | |
node-version: [lts/*, lts/-1, lts/-2, current] | |
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@e33196f7422957bea03ed53f6fbb155025ffc7b8 # 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 | |
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@e33196f7422957bea03ed53f6fbb155025ffc7b8 # 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 |