mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Add no_tools_cache flag
This commit is contained in:
parent
0b38e86c65
commit
7bd9f10bef
@ -256,27 +256,33 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | cache_url | source_url
|
version | no_tool_cache | cache_url | source_url
|
||||||
${'latest'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
${'latest'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
||||||
${'stable'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
${'stable'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar'} | ${'https://getcomposer.org/composer-stable.phar'}
|
||||||
${'snapshot'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
|
${'snapshot'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar'} | ${'https://getcomposer.org/composer.phar'}
|
||||||
${'preview'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
|
${'preview'} | ${'true'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar'} | ${'https://getcomposer.org/composer-preview.phar'}
|
||||||
${'1'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
${'1'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar'} | ${'https://getcomposer.org/composer-1.phar'}
|
||||||
${'2'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
|
${'2'} | ${'false'} | ${'https://github.com/shivammathur/composer-cache/releases/latest/download/composer-2.phar'} | ${'https://getcomposer.org/composer-2.phar'}
|
||||||
${'1.2.3'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
|
${'1.2.3'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3.phar'}
|
||||||
${'1.2.3-RC1'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
|
${'1.2.3-RC1'} | ${'false'} | ${'https://github.com/composer/composer/releases/download/1.2.3-RC1/composer.phar'} | ${'https://getcomposer.org/composer-1.2.3-RC1.phar'}
|
||||||
`(
|
`(
|
||||||
'checking addComposer: $version',
|
'checking addComposer: $version, $no_tool_cache',
|
||||||
async ({version, cache_url, source_url}) => {
|
async ({version, no_tool_cache, cache_url, source_url}) => {
|
||||||
const data = getData({
|
const data = getData({
|
||||||
tool: 'composer',
|
tool: 'composer',
|
||||||
domain: 'https://getcomposer.org',
|
domain: 'https://getcomposer.org',
|
||||||
repository: 'composer/composer',
|
repository: 'composer/composer',
|
||||||
version: version
|
version: version
|
||||||
});
|
});
|
||||||
expect(await tools.addComposer(data)).toContain(cache_url);
|
process.env['no_tools_cache'] = no_tool_cache;
|
||||||
|
if (no_tool_cache !== 'true') {
|
||||||
|
expect(await tools.addComposer(data)).toContain(
|
||||||
|
`${cache_url},${source_url}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
expect(await tools.addComposer(data)).toContain(source_url);
|
expect(await tools.addComposer(data)).toContain(source_url);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
|
3
dist/index.js
vendored
3
dist/index.js
vendored
@ -638,7 +638,8 @@ async function addComposer(data) {
|
|||||||
default:
|
default:
|
||||||
source_url = `${getcomposer}/composer-stable.phar`;
|
source_url = `${getcomposer}/composer-stable.phar`;
|
||||||
}
|
}
|
||||||
data['url'] = `${cache_url},${source_url}`;
|
const use_cache = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
|
||||||
|
data['url'] = use_cache ? `${cache_url},${source_url}` : source_url;
|
||||||
data['version_parameter'] = data['version'];
|
data['version_parameter'] = data['version'];
|
||||||
return await addArchive(data);
|
return await addArchive(data);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,8 @@ export async function addComposer(data: RS): Promise<string> {
|
|||||||
default:
|
default:
|
||||||
source_url = `${getcomposer}/composer-stable.phar`;
|
source_url = `${getcomposer}/composer-stable.phar`;
|
||||||
}
|
}
|
||||||
data['url'] = `${cache_url},${source_url}`;
|
const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
|
||||||
|
data['url'] = use_cache ? `${cache_url},${source_url}` : source_url;
|
||||||
data['version_parameter'] = data['version'];
|
data['version_parameter'] = data['version'];
|
||||||
return await addArchive(data);
|
return await addArchive(data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user