Shard Jest tests to run complete them faster (#12061)
This commit is contained in:
parent
db7f0ba69a
commit
dcf45937aa
2 changed files with 18 additions and 1 deletions
4
.github/workflows/sonarqube.yml
vendored
4
.github/workflows/sonarqube.yml
vendored
|
@ -10,7 +10,9 @@ concurrency:
|
||||||
jobs:
|
jobs:
|
||||||
sonarqube:
|
sonarqube:
|
||||||
name: 🩻 SonarQube
|
name: 🩻 SonarQube
|
||||||
if: github.event.workflow_run.event != 'merge_group'
|
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'merge_group'
|
||||||
uses: matrix-org/matrix-js-sdk/.github/workflows/sonarcloud.yml@develop
|
uses: matrix-org/matrix-js-sdk/.github/workflows/sonarcloud.yml@develop
|
||||||
secrets:
|
secrets:
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
with:
|
||||||
|
sharded: true
|
||||||
|
|
15
.github/workflows/tests.yml
vendored
15
.github/workflows/tests.yml
vendored
|
@ -30,6 +30,11 @@ jobs:
|
||||||
jest:
|
jest:
|
||||||
name: Jest
|
name: Jest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
# Run multiple instances in parallel to speed up the tests
|
||||||
|
runner: [1, 2]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -62,7 +67,17 @@ jobs:
|
||||||
--coverage=${{ env.ENABLE_COVERAGE }} \
|
--coverage=${{ env.ENABLE_COVERAGE }} \
|
||||||
--ci \
|
--ci \
|
||||||
--max-workers ${{ steps.cpu-cores.outputs.count }} \
|
--max-workers ${{ steps.cpu-cores.outputs.count }} \
|
||||||
|
--shard ${{ matrix.runner }}/${{ strategy.job-total }} \
|
||||||
--cacheDirectory /tmp/jest_cache
|
--cacheDirectory /tmp/jest_cache
|
||||||
|
env:
|
||||||
|
JEST_SONAR_UNIQUE_OUTPUT_NAME: true
|
||||||
|
|
||||||
|
# tell jest to use coloured output
|
||||||
|
FORCE_COLOR: true
|
||||||
|
|
||||||
|
- name: Move coverage files into place
|
||||||
|
if: env.ENABLE_COVERAGE == 'true'
|
||||||
|
run: mv coverage/lcov.info coverage/${{ steps.setupNode.outputs.node-version }}-${{ matrix.runner }}.lcov.info
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
if: env.ENABLE_COVERAGE == 'true'
|
if: env.ENABLE_COVERAGE == 'true'
|
||||||
|
|
Loading…
Reference in a new issue