mirror of
https://gitea.com/actions/setup-node.git
synced 2025-07-02 10:23:08 +08:00
Do not ivalidate the cache entirely on lock file change (#744)
* Do not ivalidate the cache entirely on yarn3 lock file change * Use cache prefix if all sub-projects are yarn managed * Rename functions & add e2e tests
This commit is contained in:
@ -6,7 +6,8 @@ import {
|
||||
PackageManagerInfo,
|
||||
isCacheFeatureAvailable,
|
||||
supportedPackageManagers,
|
||||
getCommandOutput
|
||||
getCommandOutput,
|
||||
resetProjectDirectoriesMemoized
|
||||
} from '../src/cache-utils';
|
||||
import fs from 'fs';
|
||||
import * as cacheUtils from '../src/cache-utils';
|
||||
@ -103,6 +104,8 @@ describe('cache-utils', () => {
|
||||
(pattern: string): Promise<Globber> =>
|
||||
MockGlobber.create(['/foo', '/bar'])
|
||||
);
|
||||
|
||||
resetProjectDirectoriesMemoized();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -32,10 +32,20 @@ cat <<EOT >package.json
|
||||
EOT
|
||||
yarn set version 3.5.1
|
||||
yarn install
|
||||
if [ x$1 = 'xglobal' ];then
|
||||
echo enableGlobalCache
|
||||
echo 'enableGlobalCache: true' >> .yarnrc.yml
|
||||
fi
|
||||
|
||||
echo "create yarn1 project in the root"
|
||||
cd ..
|
||||
cat <<EOT >package.json
|
||||
if [ x$1 != 'xkeepcache' -a x$2 != 'xkeepcache' ]; then
|
||||
rm -rf sub2/.yarn/cache
|
||||
rm -rf sub3/.yarn/cache
|
||||
fi
|
||||
|
||||
if [ x$1 = 'xyarn1' ];then
|
||||
echo "create yarn1 project in the root"
|
||||
cat <<EOT >package.json
|
||||
{
|
||||
"name": "subproject",
|
||||
"dependencies": {
|
||||
@ -44,5 +54,6 @@ cat <<EOT >package.json
|
||||
}
|
||||
}
|
||||
EOT
|
||||
yarn set version 1.22.19
|
||||
yarn install
|
||||
yarn set version 1.22.19
|
||||
yarn install
|
||||
fi
|
Reference in New Issue
Block a user