chore(ci): faster yarn install (#11479)

This commit is contained in:
Daniel Suchý
2024-03-12 11:08:13 +01:00
committed by GitHub
parent 710ff6f0bb
commit 4c9abe1afc
7 changed files with 27 additions and 3 deletions

View File

@@ -51,8 +51,12 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('**/.eslintrc.js') }}
- name: check for duplicate dependencies
run: yarn dedupe --check
# We skip build of deps which is mostly unnecessary in CI and adds about 1 minute to yarn install
# You can whitelist some build in root package.json dependenciesMeta if necessary
- name: install deps
run: yarn --immutable
run: |
echo -e "\nenableScripts: false" >> .yarnrc.yml
yarn --immutable
- name: check files for correct formatting
run: yarn nx format:check
- name: verify TS project references

View File

@@ -42,5 +42,10 @@ module.exports = {
// An array of regexp pattern strings that are matched against all module paths before those paths are
// to be considered 'visible' to the module loader
modulePathIgnorePatterns: ['libDev'],
moduleNameMapper: { '^uuid$': require.resolve('uuid') },
moduleNameMapper: {
// Enforce usage of JS version of bcrypto in tests because on CI we don't build native modules because it's slowing yarn install
'^bcrypto/lib/(.*)$': 'bcrypto/lib/$1-browser',
// Enforce usage of CommonJS version of uuid because ESM version is not working in Jest
'^uuid$': require.resolve('uuid'), // https://stackoverflow.com/questions/73203367/jest-syntaxerror-unexpected-token-export-with-uuid-library
},
};

View File

@@ -3,6 +3,7 @@ const {
testMatch,
testPathIgnorePatterns,
watchPathIgnorePatterns,
moduleNameMapper,
} = require('./jest.config.base');
const babelConfig = {
@@ -25,6 +26,7 @@ module.exports = {
testMatch,
testPathIgnorePatterns,
watchPathIgnorePatterns,
moduleNameMapper,
testEnvironment: 'jsdom',
preset: 'jest-expo',

View File

@@ -5,7 +5,8 @@
"{workspaceRoot}/nx.json",
"{workspaceRoot}/.yarnrc.yml",
"{workspaceRoot}/patches/*.patch",
"{workspaceRoot}/package.json"
"{workspaceRoot}/package.json",
"{workspaceRoot}/.github/workflows/*.yml"
],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"prod": ["default", "!{projectRoot}/**/*.test.{ts,tsx}"]

View File

@@ -151,6 +151,12 @@
"dependenciesMeta": {
"core-js-pure": {
"built": false
},
"electron": {
"built": true
},
"trezor-suite": {
"built": true
}
},
"packageManager": "yarn@4.0.2"

View File

@@ -32,6 +32,8 @@ module.exports = {
'\\.(mp4)$': '<rootDir>/__mocks__/import-mp4.js',
'\\.(svg)$': '<rootDir>/__mocks__/import-svg.js',
uuid: require.resolve('uuid'), // https://stackoverflow.com/questions/73203367/jest-syntaxerror-unexpected-token-export-with-uuid-library
// Enforce usage of JS version of bcrypto in tests because on CI we don't build native modules because it's slowing yarn install
'^bcrypto/lib/(.*)$': 'bcrypto/lib/$1-browser',
},
moduleFileExtensions: ['js', 'ts', 'tsx'],
coverageDirectory: './coverage',

View File

@@ -33259,6 +33259,10 @@ __metadata:
dependenciesMeta:
core-js-pure:
built: false
electron:
built: true
trezor-suite:
built: true
languageName: unknown
linkType: soft