mirror of
https://github.com/actions/setup-python.git
synced 2025-07-07 00:31:51 +00:00

* add support to install pypy * resolved comments, update readme, add e2e tests. * resolve throw error * Add pypy unit tests to cover code * add tests * Update test-pypy.yml * Update test-python.yml * Update test-python.yml * Update README.md * fixing tests * change order Co-authored-by: Maxim Lobanov <v-malob@microsoft.com> * add pypy tests and fix issue with pypy-3-nightly Co-authored-by: Maxim Lobanov <v-malob@microsoft.com>
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import * as core from '@actions/core';
|
|
import * as finder from './find-python';
|
|
import * as finderPyPy from './find-pypy';
|
|
import * as path from 'path';
|
|
import * as os from 'os';
|
|
|
|
function isPyPyVersion(versionSpec: string) {
|
|
return versionSpec.startsWith('pypy-');
|
|
}
|
|
|
|
async function run() {
|
|
try {
|
|
let version = core.getInput('python-version');
|
|
if (version) {
|
|
const arch: string = core.getInput('architecture') || os.arch();
|
|
if (isPyPyVersion(version)) {
|
|
const installed = await finderPyPy.findPyPyVersion(version, arch);
|
|
core.info(
|
|
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
|
|
);
|
|
} else {
|
|
const installed = await finder.findPythonVersion(version, arch);
|
|
core.info(
|
|
`Successfully setup ${installed.impl} (${installed.version})`
|
|
);
|
|
}
|
|
}
|
|
const matchersPath = path.join(__dirname, '..', '.github');
|
|
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
|
} catch (err) {
|
|
core.setFailed(err.message);
|
|
}
|
|
}
|
|
|
|
run();
|