add licenses

This commit is contained in:
Dmitry Shibanov 2022-05-09 10:48:49 +02:00
parent 7339590dca
commit 381a73b90e
10 changed files with 52 additions and 58 deletions

View file

@ -1,6 +1,6 @@
--- ---
name: "@actions/core" name: "@actions/core"
version: 1.2.6 version: 1.7.0
type: npm type: npm
summary: Actions core lib summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core homepage: https://github.com/actions/toolkit/tree/main/packages/core

View file

@ -1,32 +0,0 @@
---
name: "@actions/http-client"
version: 1.0.8
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/http-client#readme
license: mit
licenses:
- sources: LICENSE
text: |
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View file

@ -34,7 +34,7 @@ describe('Finder tests', () => {
it('Finds Python if it is installed', async () => { it('Finds Python if it is installed', async () => {
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation((input) => false); getBooleanInputSpy.mockImplementation(input => false);
const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64'); const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64');
await io.mkdirP(pythonDir); await io.mkdirP(pythonDir);
@ -48,7 +48,7 @@ describe('Finder tests', () => {
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation((input) => false); getBooleanInputSpy.mockImplementation(input => false);
const installSpy: jest.SpyInstance = jest.spyOn( const installSpy: jest.SpyInstance = jest.spyOn(
installer, installer,
@ -68,7 +68,7 @@ describe('Finder tests', () => {
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation((input) => false); getBooleanInputSpy.mockImplementation(input => false);
const installSpy: jest.SpyInstance = jest.spyOn( const installSpy: jest.SpyInstance = jest.spyOn(
installer, installer,
@ -93,7 +93,7 @@ describe('Finder tests', () => {
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData); findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation((input) => true); getBooleanInputSpy.mockImplementation(input => true);
const cnSpy: jest.SpyInstance = jest.spyOn(process.stdout, 'write'); const cnSpy: jest.SpyInstance = jest.spyOn(process.stdout, 'write');
cnSpy.mockImplementation(line => { cnSpy.mockImplementation(line => {
@ -102,14 +102,10 @@ describe('Finder tests', () => {
}); });
const infoSpy: jest.SpyInstance = jest.spyOn(core, 'info'); const infoSpy: jest.SpyInstance = jest.spyOn(core, 'info');
infoSpy.mockImplementation(() => { infoSpy.mockImplementation(() => {});
});
const debugSpy: jest.SpyInstance = jest.spyOn(core, 'debug'); const debugSpy: jest.SpyInstance = jest.spyOn(core, 'debug');
debugSpy.mockImplementation(() => { debugSpy.mockImplementation(() => {});
});
const pythonDir: string = path.join(toolDir, 'Python', '1.2.2', 'x64'); const pythonDir: string = path.join(toolDir, 'Python', '1.2.2', 'x64');
const expPath: string = path.join(toolDir, 'Python', '1.2.3', 'x64'); const expPath: string = path.join(toolDir, 'Python', '1.2.3', 'x64');
@ -131,7 +127,9 @@ describe('Finder tests', () => {
await finder.useCpythonVersion('1.2', 'x64', true); await finder.useCpythonVersion('1.2', 'x64', true);
expect(infoSpy).toHaveBeenCalledWith("Resolved as '1.2.3'"); expect(infoSpy).toHaveBeenCalledWith("Resolved as '1.2.3'");
expect(infoSpy).toHaveBeenCalledWith('Version 1.2.3 was not found in the local cache'); expect(infoSpy).toHaveBeenCalledWith(
'Version 1.2.3 was not found in the local cache'
);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${os.EOL}`); expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${os.EOL}`);
}); });

2
dist/setup/index.js vendored
View file

@ -9752,7 +9752,7 @@ const utils_1 = __webpack_require__(163);
function installPyPy(pypyVersion, pythonVersion, architecture, releases) { function installPyPy(pypyVersion, pythonVersion, architecture, releases) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let downloadDir; let downloadDir;
releases !== null && releases !== void 0 ? releases : (releases = yield getAvailablePyPyVersions()); releases = releases !== null && releases !== void 0 ? releases : (yield getAvailablePyPyVersions());
if (!releases || releases.length === 0) { if (!releases || releases.length === 0) {
throw new Error('No release was found in PyPy version.json'); throw new Error('No release was found in PyPy version.json');
} }

View file

@ -41,12 +41,16 @@ export async function findPyPyVersion(
architecture architecture
); );
if(releaseData) { if (releaseData) {
core.info(`Resolved as PyPy ${releaseData.resolvedPyPyVersion} with Python (${releaseData.resolvedPythonVersion})`); core.info(
`Resolved as PyPy ${releaseData.resolvedPyPyVersion} with Python (${releaseData.resolvedPythonVersion})`
);
pypyVersionSpec.pythonVersion = releaseData.resolvedPythonVersion; pypyVersionSpec.pythonVersion = releaseData.resolvedPythonVersion;
pypyVersionSpec.pypyVersion = releaseData.resolvedPyPyVersion; pypyVersionSpec.pypyVersion = releaseData.resolvedPyPyVersion;
} else { } else {
core.info(`Failed to resolve PyPy ${pypyVersionSpec.pypyVersion} with Python (${pypyVersionSpec.pythonVersion}) from manifest`); core.info(
`Failed to resolve PyPy ${pypyVersionSpec.pypyVersion} with Python (${pypyVersionSpec.pythonVersion}) from manifest`
);
} }
} }
} }

View file

@ -42,13 +42,21 @@ export async function useCpythonVersion(
if (checkLatest) { if (checkLatest) {
manifest = await installer.getManifest(); manifest = await installer.getManifest();
const resolvedVersion = (await installer.findReleaseFromManifest(semanticVersionSpec, architecture, manifest))?.version; const resolvedVersion = (
await installer.findReleaseFromManifest(
semanticVersionSpec,
architecture,
manifest
)
)?.version;
if(resolvedVersion) { if (resolvedVersion) {
semanticVersionSpec = resolvedVersion; semanticVersionSpec = resolvedVersion;
core.info(`Resolved as '${semanticVersionSpec}'`); core.info(`Resolved as '${semanticVersionSpec}'`);
} else { } else {
core.info(`Failed to resolve version ${semanticVersionSpec} from manifest`); core.info(
`Failed to resolve version ${semanticVersionSpec} from manifest`
);
} }
} }

View file

@ -24,7 +24,8 @@ export async function installPyPy(
) { ) {
let downloadDir; let downloadDir;
releases ??= await getAvailablePyPyVersions(); releases = releases ?? (await getAvailablePyPyVersions());
if (!releases || releases.length === 0) { if (!releases || releases.length === 0) {
throw new Error('No release was found in PyPy version.json'); throw new Error('No release was found in PyPy version.json');
} }

View file

@ -17,7 +17,7 @@ export async function findReleaseFromManifest(
architecture: string, architecture: string,
manifest: tc.IToolRelease[] | null manifest: tc.IToolRelease[] | null
): Promise<tc.IToolRelease | undefined> { ): Promise<tc.IToolRelease | undefined> {
if(!manifest) { if (!manifest) {
manifest = await getManifest(); manifest = await getManifest();
} }
@ -32,8 +32,15 @@ export async function findReleaseFromManifest(
} }
export function getManifest(): Promise<tc.IToolRelease[]> { export function getManifest(): Promise<tc.IToolRelease[]> {
core.debug(`Getting manifest from ${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}@${MANIFEST_REPO_BRANCH}`); core.debug(
return tc.getManifestFromRepo(MANIFEST_REPO_OWNER, MANIFEST_REPO_NAME, AUTH, MANIFEST_REPO_BRANCH); `Getting manifest from ${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}@${MANIFEST_REPO_BRANCH}`
);
return tc.getManifestFromRepo(
MANIFEST_REPO_OWNER,
MANIFEST_REPO_NAME,
AUTH,
MANIFEST_REPO_BRANCH
);
} }
async function installPython(workingDirectory: string) { async function installPython(workingDirectory: string) {

View file

@ -39,13 +39,21 @@ async function run() {
let pythonVersion: string; let pythonVersion: string;
const arch: string = core.getInput('architecture') || os.arch(); const arch: string = core.getInput('architecture') || os.arch();
if (isPyPyVersion(version)) { if (isPyPyVersion(version)) {
const installed = await finderPyPy.findPyPyVersion(version, arch, checkLatest); const installed = await finderPyPy.findPyPyVersion(
version,
arch,
checkLatest
);
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`; pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
core.info( core.info(
`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})` `Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
); );
} else { } else {
const installed = await finder.useCpythonVersion(version, arch, checkLatest); const installed = await finder.useCpythonVersion(
version,
arch,
checkLatest
);
pythonVersion = installed.version; pythonVersion = installed.version;
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`); core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
} }