Skip to content

Commit

Permalink
george / Improve coverall report time execution (#17537)
Browse files Browse the repository at this point in the history
* feat: improve coverall workflow

* chore: fix npm script, add error in test to check

* Update coveralls.yml
  • Loading branch information
heorhi-deriv authored Nov 22, 2024
1 parent c92d195 commit d15093e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,39 @@ on:
- master
pull_request:
types: [opened, synchronize, edited]
name: Coveralls
name: Reporter
jobs:
build:
name: Reporter
test:
name: Run tests in parallel
runs-on: Runner_16cores_Deriv-app
strategy:
matrix:
shard: [1,2,3,4,5,6,7,8,9,10]
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Node
uses: './.github/actions/setup_node'
- name: Install dependencies
uses: "./.github/actions/npm_install_from_cache"
- name: Build
uses: "./.github/actions/build"
- name: Build components package
working-directory: packages/components
run: npm run build
- name: Test
run: JEST_MAX_WORKERS=95% npm run test:jest -- --collectCoverage
- name: Coveralls
run: JEST_MAX_WORKERS=95% SHARD_INDEX=${{ matrix.shard }} SHARD_COUNT=10 npm run test:shard -- --collectCoverage
- name: Coveralls Parallel
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
flag-name: ${{ matrix.shard}}
parallel: true

finish:
name: Coveralls Finished
needs: [test]
runs-on: Runner_16cores_Deriv-app
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
parallel-finished: true
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"test": "f () { npm run test:stylelint && npm run test:eslint-all && npm run test:jest ;}; f",
"test:stylelint": "stylelint \"./packages/*/src/**/*.s(a|c)ss\"",
"test:ci": "f () { npm run test:stylelint && npm run test:eslint-all ;}; f",
"test:shard": "jest --all --shard=${SHARD_INDEX}/${SHARD_COUNT} --maxWorkers=${JEST_MAX_WORKERS:-'50%'}",
"test:jest": "jest --all --maxWorkers=${JEST_MAX_WORKERS:-'50%'}",
"test:performance": "cd e2e-tests && jest -c ./jest.config.js --detectOpenHandles performance",
"stylelint:fix": "stylelint \"./packages/*/src/**/*.s(a|c)ss\" --fix",
Expand Down
1 change: 1 addition & 0 deletions packages/appstore/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
'\\.s(c|a)ss$': '<rootDir>/../../__mocks__/styleMock.js',
'^.+\\.svg$': '<rootDir>/../../__mocks__/fileMock.js',
'@deriv-com/translations': '<rootDir>/../../__mocks__/translation.mock.js',
'^@deriv/account$': '<rootDir>/../account/src',
'@deriv-com/ui': '<rootDir>/../../__mocks__/deriv-com.ui.mock.js',
'^Assets/(.*)$': '<rootDir>/src/assets/$1',
'^Components/(.*)$': '<rootDir>/src/components/$1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jest.mock('@deriv-com/ui', () => ({
useDevice: jest.fn(() => ({ isDesktop: true })),
}));

jest.mock('@deriv/p2p', () => jest.fn(() => <div>P2P</div>));

jest.mock('@deriv/hooks', () => {
return {
...jest.requireActual('@deriv/hooks'),
Expand Down
1 change: 1 addition & 0 deletions packages/cfd/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
'\\.s(c|a)ss$': '<rootDir>/../../__mocks__/styleMock.js',
'^.+\\.svg$': '<rootDir>/../../__mocks__/styleMock.js',
'@deriv-com/translations': '<rootDir>/../../__mocks__/translation.mock.js',
'^@deriv/account$': '<rootDir>/../account/src',
'@deriv-com/ui': '<rootDir>/../../__mocks__/deriv-com.ui.mock.js',
'^_common/(.*)$': '<rootDir>/src/_common/$1',
'^App/(.*)$': '<rootDir>/src/App/$1',
Expand Down
1 change: 1 addition & 0 deletions packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
'\\.s(c|a)ss$': '<rootDir>/../../__mocks__/styleMock.js',
'^.+\\.svg$': '<rootDir>/../../__mocks__/styleMock.js',
'@deriv-com/translations': '<rootDir>/../../__mocks__/translation.mock.js',
'^@deriv/account$': '<rootDir>/../account/src',
'@deriv-com/ui': '<rootDir>/../../__mocks__/deriv-com.ui.mock.js',
'^_common/(.*)$': '<rootDir>/src/_common/$1',
'^App/(.*)$': '<rootDir>/src/App/$1',
Expand Down

0 comments on commit d15093e

Please sign in to comment.