mirror of
https://github.com/actions/setup-python.git
synced 2025-06-25 05:01:09 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
65d7f2d534 | |||
f97b83114c |
4
.github/workflows/test-python.yml
vendored
4
.github/workflows/test-python.yml
vendored
@ -157,7 +157,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04]
|
||||||
python: [3.5.4, 3.6.7, 3.7.5, 3.8.15, 3.9.13]
|
python: [3.5.4, 3.6.7, 3.7.5, 3.8.15, 3.9.13, '==3.10.10']
|
||||||
exclude:
|
exclude:
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
python: 3.5.4
|
python: 3.5.4
|
||||||
@ -190,7 +190,7 @@ jobs:
|
|||||||
- name: Validate version
|
- name: Validate version
|
||||||
run: |
|
run: |
|
||||||
$pythonVersion = (python --version)
|
$pythonVersion = (python --version)
|
||||||
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
if ("Python ${{ matrix.python }}".replace("==", "") -ne "$pythonVersion"){
|
||||||
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ describe('Version from file test', () => {
|
|||||||
await io.mkdirP(tempDir);
|
await io.mkdirP(tempDir);
|
||||||
const pythonVersionFileName = 'pyproject.toml';
|
const pythonVersionFileName = 'pyproject.toml';
|
||||||
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
|
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
|
||||||
const pythonVersion = '>=3.7';
|
const pythonVersion = '>=3.7.0';
|
||||||
const pythonVersionFileContent = `[project]\nrequires-python = "${pythonVersion}"`;
|
const pythonVersionFileContent = `[project]\nrequires-python = "${pythonVersion}"`;
|
||||||
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
|
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
|
||||||
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
|
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
|
||||||
@ -119,7 +119,7 @@ describe('Version from file test', () => {
|
|||||||
await io.mkdirP(tempDir);
|
await io.mkdirP(tempDir);
|
||||||
const pythonVersionFileName = 'pyproject.toml';
|
const pythonVersionFileName = 'pyproject.toml';
|
||||||
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
|
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
|
||||||
const pythonVersion = '>=3.7';
|
const pythonVersion = '>=3.7.0';
|
||||||
const pythonVersionFileContent = `[tool.poetry.dependencies]\npython = "${pythonVersion}"`;
|
const pythonVersionFileContent = `[tool.poetry.dependencies]\npython = "${pythonVersion}"`;
|
||||||
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
|
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
|
||||||
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
|
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
|
||||||
|
11
dist/setup/index.js
vendored
11
dist/setup/index.js
vendored
@ -70143,7 +70143,16 @@ function getVersionInputFromTomlFile(versionFile) {
|
|||||||
versions.push(version);
|
versions.push(version);
|
||||||
}
|
}
|
||||||
core.info(`Extracted ${versions} from ${versionFile}`);
|
core.info(`Extracted ${versions} from ${versionFile}`);
|
||||||
return Array.from(versions, version => version.split(',').join(' '));
|
const rawVersions = Array.from(versions, version => version.split(',').join(' '));
|
||||||
|
const validatedVersions = rawVersions
|
||||||
|
.map(item => semver.validRange(item, true))
|
||||||
|
.filter((versionRange, index) => {
|
||||||
|
if (!versionRange) {
|
||||||
|
core.debug(`The version ${rawVersions[index]} is not valid SemVer range`);
|
||||||
|
}
|
||||||
|
return !!versionRange;
|
||||||
|
});
|
||||||
|
return validatedVersions;
|
||||||
}
|
}
|
||||||
exports.getVersionInputFromTomlFile = getVersionInputFromTomlFile;
|
exports.getVersionInputFromTomlFile = getVersionInputFromTomlFile;
|
||||||
/**
|
/**
|
||||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -6751,9 +6751,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/word-wrap": {
|
"node_modules/word-wrap": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz",
|
||||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
"integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
@ -12044,9 +12044,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"word-wrap": {
|
"word-wrap": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz",
|
||||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
"integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"wrap-ansi": {
|
"wrap-ansi": {
|
||||||
|
16
src/utils.ts
16
src/utils.ts
@ -229,7 +229,21 @@ export function getVersionInputFromTomlFile(versionFile: string): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.info(`Extracted ${versions} from ${versionFile}`);
|
core.info(`Extracted ${versions} from ${versionFile}`);
|
||||||
return Array.from(versions, version => version.split(',').join(' '));
|
const rawVersions = Array.from(versions, version =>
|
||||||
|
version.split(',').join(' ')
|
||||||
|
);
|
||||||
|
const validatedVersions = rawVersions
|
||||||
|
.map(item => semver.validRange(item, true))
|
||||||
|
.filter((versionRange, index) => {
|
||||||
|
if (!versionRange) {
|
||||||
|
core.debug(
|
||||||
|
`The version ${rawVersions[index]} is not valid SemVer range`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !!versionRange;
|
||||||
|
}) as string[];
|
||||||
|
return validatedVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user