Skip to content

update set ranked script #5786

update set ranked script

update set ranked script #5786

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, 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]
env:
CI: true
JWT_SECRET: anything
LOCAL: true
REVALIDATE_SECRET: whatever
NEW_RELIC_LICENSE_KEY: dummy
NEW_RELIC_APP_NAME: dummy
INTERNAL_JOB_TOKEN_SECRET_EMAILDIGEST: cocomelon
SITEMAP_PRIV_KEY: sitto
STRIPE_SECRET: fake-stripe-secret
jobs:
setup:
runs-on: ubuntu-latest
outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }}
steps:
- uses: actions/checkout@v3
- id: set-test-chunks
name: Set Chunks
run: echo "::set-output name=test-chunks::$(find ./tests -maxdepth 10 -name '*test.*' | jq --raw-input --slurp 'split("\n")' | jq 'map(select(length > 0))' | jq -cM '[_nwise(length / 5 | ceil)]')"
- id: set-test-chunk-ids
name: Set Chunk IDs
run: echo "::set-output name=test-chunk-ids::$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')"
env:
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test:
runs-on: ubuntu-latest
name: test (chunk ${{ matrix.chunk }})
needs:
- setup
strategy:
matrix:
chunk: ${{ fromJson(needs.setup.outputs['test-chunk-ids']) }}
steps:
- uses: actions/checkout@v3
- run: npm ci
- name: jest
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs npx jest --maxWorkers=2
env:
CHUNKS: ${{ needs.setup.outputs['test-chunks'] }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3