Remove CLI version lookup based on release assets
This is now superseded by semantically versioned bundles
This commit is contained in:
parent
48c11ed2ba
commit
0407820509
6 changed files with 10 additions and 158 deletions
26
lib/codeql.test.js
generated
26
lib/codeql.test.js
generated
|
|
@ -141,46 +141,26 @@ function mockApiDetails(apiDetails) {
|
|||
});
|
||||
const EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES = [
|
||||
{
|
||||
cliVersion: "2.17.6",
|
||||
tagName: "codeql-bundle-2.17.6",
|
||||
expectedToolcacheVersion: "2.17.6",
|
||||
shouldCallReleasesApi: false,
|
||||
},
|
||||
{
|
||||
cliVersion: "2.17.6-pre",
|
||||
tagName: "codeql-bundle-20240805",
|
||||
expectedToolcacheVersion: "0.0.0-20240805",
|
||||
shouldCallReleasesApi: true,
|
||||
},
|
||||
{
|
||||
cliVersion: "2.17.6+202006100101",
|
||||
tagName: "codeql-bundle-20240805",
|
||||
expectedToolcacheVersion: "0.0.0-20240805",
|
||||
shouldCallReleasesApi: true,
|
||||
},
|
||||
];
|
||||
for (const { cliVersion, tagName, expectedToolcacheVersion, shouldCallReleasesApi, } of EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES) {
|
||||
(0, ava_1.default)(`caches an explicitly requested bundle containing CLI ${cliVersion} as ${expectedToolcacheVersion}`, async (t) => {
|
||||
for (const { tagName, expectedToolcacheVersion, } of EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES) {
|
||||
(0, ava_1.default)(`caches explicitly requested bundle ${tagName} as ${expectedToolcacheVersion}`, async (t) => {
|
||||
await util.withTmpDir(async (tmpDir) => {
|
||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||
mockApiDetails(testing_utils_1.SAMPLE_DOTCOM_API_DETAILS);
|
||||
sinon.stub(actionsUtil, "isRunningLocalAction").returns(true);
|
||||
const releaseApiMock = mockReleaseApi({
|
||||
assetNames: [`cli-version-${cliVersion}.txt`],
|
||||
tagName,
|
||||
});
|
||||
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
||||
tagName,
|
||||
});
|
||||
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||
if (shouldCallReleasesApi) {
|
||||
t.assert(releaseApiMock.isDone(), "Releases API should have been called");
|
||||
}
|
||||
else {
|
||||
t.false(releaseApiMock.isDone(), "Releases API should not have been called");
|
||||
}
|
||||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||
t.deepEqual(result.toolsVersion, cliVersion);
|
||||
t.deepEqual(result.toolsVersion, expectedToolcacheVersion);
|
||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue