Compare commits

..

2 Commits

Author SHA1 Message Date
Clinton Blackburn
81ed0cdc6a Merge 5993da79df into 574f09a9fa 2025-01-22 11:10:59 -03:00
Clinton Blackburn
5993da79df Added Node version to cache key 2024-12-13 23:44:39 -08:00
8 changed files with 2881 additions and 3320 deletions

View File

@@ -1,9 +1,9 @@
--- ---
name: "@fastify/busboy" name: "@fastify/busboy"
version: 2.1.1 version: 2.0.0
type: npm type: npm
summary: A streaming parser for HTML form data for node.js summary: A streaming parser for HTML form data for node.js
homepage: homepage:
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@@ -1,6 +1,6 @@
--- ---
name: undici name: undici
version: 5.28.5 version: 5.28.4
type: npm type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://undici.nodejs.org homepage: https://undici.nodejs.org

View File

@@ -115,7 +115,7 @@ describe('cache-restore', () => {
it.each([['npm7'], ['npm6'], ['pnpm6'], ['yarn1'], ['yarn2'], ['random']])( it.each([['npm7'], ['npm6'], ['pnpm6'], ['yarn1'], ['yarn2'], ['random']])(
'Throw an error because %s is not supported', 'Throw an error because %s is not supported',
async packageManager => { async packageManager => {
await expect(restoreCache(packageManager, '')).rejects.toThrow( await expect(restoreCache(packageManager, '', '')).rejects.toThrow(
`Caching for '${packageManager}' is not supported` `Caching for '${packageManager}' is not supported`
); );
} }
@@ -124,13 +124,13 @@ describe('cache-restore', () => {
describe('Restore dependencies', () => { describe('Restore dependencies', () => {
it.each([ it.each([
['yarn', '2.1.2', yarnFileHash], ['yarn', '2.1.2', yarnFileHash, '22'],
['yarn', '1.2.3', yarnFileHash], ['yarn', '1.2.3', yarnFileHash, '20.17'],
['npm', '', npmFileHash], ['npm', '', npmFileHash, '22.12'],
['pnpm', '', pnpmFileHash] ['pnpm', '', pnpmFileHash, '18']
])( ])(
'restored dependencies for %s', 'restored dependencies for %s',
async (packageManager, toolVersion, fileHash) => { async (packageManager, toolVersion, fileHash, nodeVersion) => {
getCommandOutputSpy.mockImplementation((command: string) => { getCommandOutputSpy.mockImplementation((command: string) => {
if (command.includes('version')) { if (command.includes('version')) {
return toolVersion; return toolVersion;
@@ -139,10 +139,10 @@ describe('cache-restore', () => {
} }
}); });
await restoreCache(packageManager, ''); await restoreCache(packageManager, '', nodeVersion);
expect(hashFilesSpy).toHaveBeenCalled(); expect(hashFilesSpy).toHaveBeenCalled();
expect(infoSpy).toHaveBeenCalledWith( 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( expect(infoSpy).not.toHaveBeenCalledWith(
`${packageManager} cache is not found` `${packageManager} cache is not found`
@@ -170,7 +170,7 @@ describe('cache-restore', () => {
}); });
restoreCacheSpy.mockImplementationOnce(() => undefined); restoreCacheSpy.mockImplementationOnce(() => undefined);
await restoreCache(packageManager, ''); await restoreCache(packageManager, '', '');
expect(hashFilesSpy).toHaveBeenCalled(); expect(hashFilesSpy).toHaveBeenCalled();
expect(infoSpy).toHaveBeenCalledWith( expect(infoSpy).toHaveBeenCalledWith(
`${packageManager} cache is not found` `${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,10 +1061,9 @@
} }
}, },
"node_modules/@fastify/busboy": { "node_modules/@fastify/busboy": {
"version": "2.1.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz",
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==",
"license": "MIT",
"engines": { "engines": {
"node": ">=14" "node": ">=14"
} }
@@ -5585,10 +5584,9 @@
} }
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "5.28.5", "version": "5.28.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==", "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
"license": "MIT",
"dependencies": { "dependencies": {
"@fastify/busboy": "^2.0.0" "@fastify/busboy": "^2.0.0"
}, },

View File

@@ -15,7 +15,8 @@ import {
export const restoreCache = async ( export const restoreCache = async (
packageManager: string, packageManager: string,
cacheDependencyPath: string cacheDependencyPath: string,
nodeVersion: string
) => { ) => {
const packageManagerInfo = await getPackageManagerInfo(packageManager); const packageManagerInfo = await getPackageManagerInfo(packageManager);
if (!packageManagerInfo) { 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}`; const primaryKey = `${keyPrefix}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`); core.debug(`primary key is ${primaryKey}`);

View File

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