mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-08 07:50:24 -05:00
chore: Updating system test node modules cache logic to support binary tests (#21187)
* Updating state cache key names to limit improper fallback matches. Sorting output for cache key for cross-arch determinism. * Trying to normalize cache output * Lost tracking for this change somehow * Changing key name to invalidate current cache. * Tweaking install script * Tweaking install script again * Another commit to test existing cache * Resetting keys for PR * Whoops, this slipped into the last commit * Missed one key rename somehow * Update system-tests/scripts/cache-key.sh Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
This commit is contained in:
+5
-6
@@ -201,7 +201,6 @@ commands:
|
||||
name: Restore system tests node_modules cache
|
||||
keys:
|
||||
- v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
|
||||
- v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-system-tests-projects-node-modules-cache-
|
||||
|
||||
update_cached_system_tests_deps:
|
||||
description: 'Update the cached node_modules for projects in "system-tests/projects/**"'
|
||||
@@ -215,7 +214,7 @@ commands:
|
||||
- restore_cache:
|
||||
name: Restore cache state, to check for known modules cache existence
|
||||
keys:
|
||||
- v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-system-tests-projects-node-modules-cache-state-{{ checksum "system_tests_cache_key" }}
|
||||
- v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-state-of-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
|
||||
- run:
|
||||
name: Send root honeycomb event for this CI build
|
||||
command: cd system-tests/scripts && node ./send-root-honecomb-event.js
|
||||
@@ -238,11 +237,11 @@ commands:
|
||||
name: Save system tests node_modules cache
|
||||
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
|
||||
paths:
|
||||
- ~/.cache/cy-system-tests-node-modules
|
||||
- /tmp/cy-system-tests-node-modules
|
||||
- run: touch /tmp/system_tests_node_modules_installed
|
||||
- save_cache:
|
||||
name: Save system tests node_modules cache state key
|
||||
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-system-tests-projects-node-modules-cache-state-{{ checksum "system_tests_cache_key" }}
|
||||
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-state-of-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
|
||||
paths:
|
||||
- /tmp/system_tests_node_modules_installed
|
||||
|
||||
@@ -262,7 +261,7 @@ commands:
|
||||
command: echo $PLATFORM > platform_key
|
||||
- restore_cache:
|
||||
name: Restore cache state, to check for known modules cache existence
|
||||
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-node-modules-cache-state-{{ checksum "circle_cache_key" }}
|
||||
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" }}
|
||||
- run:
|
||||
name: Bail if cache exists
|
||||
command: |
|
||||
@@ -304,7 +303,7 @@ commands:
|
||||
- run: touch node_modules_installed
|
||||
- save_cache:
|
||||
name: Saving node-modules cache state key
|
||||
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-node-modules-cache-state-{{ checksum "circle_cache_key" }}
|
||||
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" }}
|
||||
paths:
|
||||
- node_modules_installed
|
||||
- save_cache:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
import cachedir from 'cachedir'
|
||||
import execa from 'execa'
|
||||
import { cyTmpDir, projectPath, projects, root } from '../fixtures'
|
||||
import { getYarnCommand } from './yarn'
|
||||
@@ -162,7 +161,7 @@ export async function scaffoldProjectNodeModules (project: string, updateLockFil
|
||||
await execa(cmd, { cwd: projectDir, stdio: 'inherit', shell: true })
|
||||
}
|
||||
|
||||
const cacheNodeModulesDir = path.join(cachedir('cy-system-tests-node-modules'), project, 'node_modules')
|
||||
const cacheNodeModulesDir = path.join('/tmp', 'cy-system-tests-node-modules', project, 'node_modules')
|
||||
const tmpNodeModulesDir = path.join(projectPath(project), 'node_modules')
|
||||
|
||||
async function removeWorkspacePackages (packages: string[]): Promise<void> {
|
||||
|
||||
@@ -5,4 +5,12 @@
|
||||
# cd to this "scripts" directory
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
cat ../projects/**/{package.json,yarn.lock}
|
||||
# Sort glob output, as it can vary based on architecture. LC_ALL=C required for locale-agnostic sort.
|
||||
file_list=$(ls ../projects/**/{package.json,yarn.lock} | LC_ALL=C sort -f)
|
||||
|
||||
contents=''
|
||||
for t in ${file_list[@]}; do
|
||||
contents+=$(<$t)
|
||||
done
|
||||
|
||||
echo $contents
|
||||
|
||||
Reference in New Issue
Block a user