Skip to content

Add cache to getReportName #83898

Add cache to getReportName

Add cache to getReportName #83898

Workflow file for this run

name: Jest Unit Tests
on:
workflow_call:
pull_request:
types: [opened, synchronize]
branches-ignore: [staging, production]
paths: ['**.js', '**.ts', '**.tsx', 'package.json', 'package-lock.json']
concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-jest
cancel-in-progress: true
jobs:
jest:
if: ${{ github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' || github.event_name == 'workflow_call' }}
runs-on: ubuntu-latest
env:
CI: true
strategy:
fail-fast: false
matrix:
chunk: [ 1, 2, 3 ]
name: test (job ${{ fromJSON(matrix.chunk) }})
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: ./.github/actions/composite/setupNode
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@31e91de0f8654375a21e8e83078be625380e2b18
- name: Cache Jest cache
id: cache-jest-cache
uses: actions/cache@v4
with:
path: .jest-cache
key: ${{ runner.os }}-jest
- name: Jest tests
run: NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" npx jest --silent --shard=${{ fromJSON(matrix.chunk) }}/${{ strategy.job-total }} --max-workers ${{ steps.cpu-cores.outputs.count }}
storybookTests:
if: ${{ github.actor != 'OSBotify' && github.actor != 'imgbot[bot]' || github.event_name == 'workflow_call' }}
runs-on: ubuntu-latest
name: Storybook tests
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/composite/setupNode
- name: Storybook run
run: npm run storybook -- --smoke-test --ci