Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache + test #17353

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5363c5b
chore: test
heorhi-deriv Oct 29, 2024
19026de
chore: test
heorhi-deriv Oct 29, 2024
cc3ad6d
chore: test
heorhi-deriv Oct 30, 2024
2347b33
chore: test
heorhi-deriv Oct 30, 2024
6cea764
chore: test
heorhi-deriv Oct 30, 2024
2d84eef
chore: test
heorhi-deriv Oct 30, 2024
7198c76
chore: test
heorhi-deriv Oct 30, 2024
7376338
Merge branch 'deriv-com:master' into cache-actions-v3
heorhi-deriv Oct 30, 2024
518a14e
Update action.yml
heorhi-deriv Oct 30, 2024
2d6d27f
Update package.json
heorhi-deriv Oct 30, 2024
30022db
chore: test
heorhi-deriv Oct 30, 2024
c0f6dfb
Merge branch 'deriv-com:master' into cache-actions-v3
heorhi-deriv Oct 31, 2024
3c7080e
chore: test
heorhi-deriv Oct 31, 2024
33f93a4
chore: test
heorhi-deriv Oct 31, 2024
13b26fe
chore: test
heorhi-deriv Oct 31, 2024
cf61cbb
chore: test
heorhi-deriv Oct 31, 2024
b124325
chore: test
heorhi-deriv Oct 31, 2024
4371641
chore: test
heorhi-deriv Oct 31, 2024
0c14bb0
chore: test
heorhi-deriv Oct 31, 2024
49b3bd9
Trigger CI or redeploy
heorhi-deriv Oct 31, 2024
ffc8e45
chore: change weight
heorhi-deriv Oct 31, 2024
ac4f44e
chore: check
heorhi-deriv Oct 31, 2024
7de5f2b
chore: test
heorhi-deriv Nov 4, 2024
991d519
chore: fix
heorhi-deriv Nov 4, 2024
506d3f5
chore: test
heorhi-deriv Nov 4, 2024
a11d4ff
chore: artifact
heorhi-deriv Nov 4, 2024
d0ea8b7
chore: test
heorhi-deriv Nov 4, 2024
211a332
chore: test
heorhi-deriv Nov 4, 2024
5b2456d
chore: test
heorhi-deriv Nov 4, 2024
e9abc8a
chore: test
heorhi-deriv Nov 4, 2024
2bbce78
chore: test
heorhi-deriv Nov 4, 2024
45c1440
chore: test
heorhi-deriv Nov 4, 2024
7a84bfa
chore: test
heorhi-deriv Nov 4, 2024
682d80f
Merge branch master into cache-actions-v3
heorhi-deriv Nov 12, 2024
44c9740
chore: update screen
heorhi-deriv Nov 12, 2024
7c68f0e
chore: test
heorhi-deriv Nov 12, 2024
ec45fac
chore: test
heorhi-deriv Nov 12, 2024
641a3c0
chore: test
heorhi-deriv Nov 12, 2024
f987dfc
chore: coverage
heorhi-deriv Nov 12, 2024
ec9ace0
chore: test
heorhi-deriv Nov 12, 2024
8618f9b
chore: coverage
heorhi-deriv Nov 12, 2024
1dade46
chore: test
heorhi-deriv Nov 12, 2024
9ec3ff3
chore: test
heorhi-deriv Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ inputs:
runs:
using: composite
steps:
- name: Build all packages
- name: Restore nx cache and run build
uses: actions/cache/restore@v4
id: restore-cache
with:
path: nx
key: nx-cache-${{ hashFiles('package-lock.json', 'packages/*/package.json') }}
- name: Run build
env:
NODE_ENV: ${{ inputs.NODE_ENV }}
DATADOG_APPLICATION_ID: ${{ inputs.DATADOG_APPLICATION_ID }}
Expand All @@ -79,3 +85,9 @@ runs:
TRUSTPILOT_API_KEY: ${{ inputs.TRUSTPILOT_API_KEY }}
run: npm run build:all
shell: bash
- if: ${{ steps.restore-cache.outputs.cache-hit != 'true' }}
name: Invalidate and save nx cache
uses: actions/cache/save@v4
with:
path: nx
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
19 changes: 14 additions & 5 deletions .github/actions/npm_install_from_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ description: Install npm packages
runs:
using: composite
steps:
- name: Install npm packages
run: npm ci
shell: bash
- name: Bootstrap
run: npm run bootstrap:ci
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
# npm cache files are stored in `node_modules` on Linux/macOS
path: |
node_modules
packages/*/node_modules
key: node_modules-cache-${{ hashFiles('package-lock.json') }}-${{ hashFiles('packages/*/package.json') }}
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: Install dependencies
run: |
npm ci
npm run bootstrap:ci
shell: bash
32 changes: 26 additions & 6 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,39 @@ on:
types: [opened, synchronize, edited]
name: Coveralls
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 }} npm run test:shard -- --collectCoverage
- name: Coveralls Parallel
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
allow-empty: true
flag-name: ${{ matrix.shard}}
parallel: true

finish:
name: Coveralls Finished
needs: [test]
if: ${{ always() }}
runs-on: Runner_16cores_Deriv-app
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
parallel-finished: true
1 change: 0 additions & 1 deletion jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

module.exports = {
collectCoverage: false,
collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}', '!**/node_modules/**', '!**/dist/**'],
coverageReporters: ['lcov'],
coverageDirectory: './coverage/',
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const baseConfig = require('./jest.config.base');

module.exports = {
collectCoverage: false,
collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}', '!**/node_modules/**', '!**/dist/**'],
coverageReporters: ['lcov'],
coverageDirectory: './coverage/',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"test:stylelint": "stylelint \"./packages/*/src/**/*.s(a|c)ss\"",
"test:ci": "f () { npm run test:stylelint && npm run test:eslint-all ;}; f",
"test:jest": "jest --all --maxWorkers=${JEST_MAX_WORKERS:-'50%'}",
"test:shard": "jest --all --shard=${SHARD_INDEX}/10 --maxWorkers=${JEST_MAX_WORKERS:-'50%'} --coverage",
"test:performance": "cd e2e-tests && jest -c ./jest.config.js --detectOpenHandles performance",
"stylelint:fix": "stylelint \"./packages/*/src/**/*.s(a|c)ss\" --fix",
"translate": "f () { npm exec --workspace=@deriv/translations -- npm run translate ;}; f",
Expand All @@ -118,4 +119,4 @@
"optionalDependencies": {
"fsevents": "^2.3.2"
}
}
}
3 changes: 2 additions & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"deploy:clean": "echo \"No deploy:clean specified\"",
"deploy:folder": "echo \"No deploy:folder specified\"",
"deploy:staging": "echo \"No deploy:staging specified\"",
"deploy:production": "echo \"No deploy:production specified\""
"deploy:production": "echo \"No deploy:production specified\"",
"test-test": "npm run test && npm run serve"
},
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.8",
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
Loading