Compare commits

...

3 Commits

Author SHA1 Message Date
Clinton Blackburn
a52d4ed100
Merge 5993da79df into 1d0ff469b7 2025-01-23 12:39:03 -08:00
dependabot[bot]
1d0ff469b7
Bump undici from 5.28.4 to 5.28.5 (#1205)
* Bump undici from 5.28.4 to 5.28.5

Bumps [undici](https://github.com/nodejs/undici) from 5.28.4 to 5.28.5.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.4...v5.28.5)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix for check-dist and license failures

* npm run updates

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com>
2025-01-22 13:15:11 -06:00
Clinton Blackburn
5993da79df
Added Node version to cache key 2024-12-13 23:44:39 -08:00
8 changed files with 3318 additions and 2877 deletions

Binary file not shown.

Binary file not shown.

View File

@ -115,7 +115,7 @@ describe('cache-restore', () => {
it.each([['npm7'], ['npm6'], ['pnpm6'], ['yarn1'], ['yarn2'], ['random']])(
'Throw an error because %s is not supported',
async packageManager => {
await expect(restoreCache(packageManager, '')).rejects.toThrow(
await expect(restoreCache(packageManager, '', '')).rejects.toThrow(
`Caching for '${packageManager}' is not supported`
);
}
@ -124,13 +124,13 @@ describe('cache-restore', () => {
describe('Restore dependencies', () => {
it.each([
['yarn', '2.1.2', yarnFileHash],
['yarn', '1.2.3', yarnFileHash],
['npm', '', npmFileHash],
['pnpm', '', pnpmFileHash]
['yarn', '2.1.2', yarnFileHash, '22'],
['yarn', '1.2.3', yarnFileHash, '20.17'],
['npm', '', npmFileHash, '22.12'],
['pnpm', '', pnpmFileHash, '18']
])(
'restored dependencies for %s',
async (packageManager, toolVersion, fileHash) => {
async (packageManager, toolVersion, fileHash, nodeVersion) => {
getCommandOutputSpy.mockImplementation((command: string) => {
if (command.includes('version')) {
return toolVersion;
@ -139,10 +139,10 @@ describe('cache-restore', () => {
}
});
await restoreCache(packageManager, '');
await restoreCache(packageManager, '', nodeVersion);
expect(hashFilesSpy).toHaveBeenCalled();
expect(infoSpy).toHaveBeenCalledWith(
`Cache restored from key: node-cache-${platform}-${arch}-${packageManager}-${fileHash}`
`Cache restored from key: node-cache-${platform}-${arch}-${nodeVersion}-${packageManager}-${fileHash}`
);
expect(infoSpy).not.toHaveBeenCalledWith(
`${packageManager} cache is not found`
@ -170,7 +170,7 @@ describe('cache-restore', () => {
});
restoreCacheSpy.mockImplementationOnce(() => undefined);
await restoreCache(packageManager, '');
await restoreCache(packageManager, '', '');
expect(hashFilesSpy).toHaveBeenCalled();
expect(infoSpy).toHaveBeenCalledWith(
`${packageManager} cache is not found`

3075
dist/cache-save/index.js vendored

File diff suppressed because it is too large Load Diff

3081
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

14
package-lock.json generated
View File

@ -1061,9 +1061,10 @@
}
},
"node_modules/@fastify/busboy": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz",
"integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
"license": "MIT",
"engines": {
"node": ">=14"
}
@ -5584,9 +5585,10 @@
}
},
"node_modules/undici": {
"version": "5.28.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
"integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
"version": "5.28.5",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},

View File

@ -15,7 +15,8 @@ import {
export const restoreCache = async (
packageManager: string,
cacheDependencyPath: string
cacheDependencyPath: string,
nodeVersion: string
) => {
const packageManagerInfo = await getPackageManagerInfo(packageManager);
if (!packageManagerInfo) {
@ -40,7 +41,7 @@ export const restoreCache = async (
);
}
const keyPrefix = `node-cache-${platform}-${arch}-${packageManager}`;
const keyPrefix = `node-cache-${platform}-${arch}-${nodeVersion}-${packageManager}`;
const primaryKey = `${keyPrefix}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`);

View File

@ -62,7 +62,7 @@ export async function run() {
if (cache && isCacheFeatureAvailable()) {
core.saveState(State.CachePackageManager, cache);
const cacheDependencyPath = core.getInput('cache-dependency-path');
await restoreCache(cache, cacheDependencyPath);
await restoreCache(cache, cacheDependencyPath, version);
}
const matchersPath = path.join(__dirname, '../..', '.github');