mirror of
https://github.com/actions/setup-python.git
synced 2025-06-25 13:11:08 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
e336b852d5 | |||
3342d62b16 | |||
fe821292b0 | |||
0611362f9b | |||
633a4406d7 |
13
README.md
13
README.md
@ -1,5 +1,9 @@
|
|||||||
# setup-python
|
# setup-python
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<a href="https://github.com/actions/setup-python"><img alt="GitHub Actions status" src="https://github.com/actions/setup-python/workflows/Main%20workflow/badge.svg"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
This action sets up a python environment for use in actions by:
|
This action sets up a python environment for use in actions by:
|
||||||
|
|
||||||
- optionally installing a version of python and adding to PATH. Note that this action only uses versions of Python already installed in the cache. The action will fail if no matching versions are found.
|
- optionally installing a version of python and adding to PATH. Note that this action only uses versions of Python already installed in the cache. The action will fail if no matching versions are found.
|
||||||
@ -15,8 +19,8 @@ steps:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
version: 3.x // Version range or exact version of a Python version to use, using semvers version range syntax.
|
python-version: '3.x' // Version range or exact version of a Python version to use, using semvers version range syntax.
|
||||||
architecture: x64 // (x64 or x86)
|
architecture: 'x64' // (x64 or x86)
|
||||||
- run: python my_script.py
|
- run: python my_script.py
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -24,16 +28,17 @@ Matrix Testing:
|
|||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
runs-on: ubuntu-16.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python: [ 2.x, 3.x, pypy3 ]
|
python: [ '2.x', '3.x', 'pypy3' ]
|
||||||
name: Python ${{ matrix.python }} sample
|
name: Python ${{ matrix.python }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Setup python
|
- name: Setup python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- run: python my_script.py
|
- run: python my_script.py
|
||||||
```
|
```
|
||||||
|
11
action.yml
11
action.yml
@ -1,13 +1,16 @@
|
|||||||
name: 'Setup Node.js for use with actions'
|
name: 'Setup Python environment'
|
||||||
description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support'
|
description: 'Setup a Python environment and add it to the PATH, additionally providing proxy support'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
python-version:
|
||||||
description: 'Version range or exact version of a Python version to use, using semvers version range syntax.'
|
description: 'Version range or exact version of a Python version to use, using semvers version range syntax.'
|
||||||
default: '3.x'
|
default: '3.x'
|
||||||
architecture:
|
architecture:
|
||||||
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
||||||
default: 'x64'
|
default: 'x64'
|
||||||
|
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||||
|
version:
|
||||||
|
description: 'Deprecated. Use python-version instead. Will not be supported after October 1, 2019'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/setup-python.js'
|
main: 'lib/setup-python.js'
|
||||||
|
@ -21,7 +21,10 @@ const path = __importStar(require("path"));
|
|||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const version = core.getInput('version');
|
let version = core.getInput('version');
|
||||||
|
if (!version) {
|
||||||
|
version = core.getInput('python-version');
|
||||||
|
}
|
||||||
if (version) {
|
if (version) {
|
||||||
const arch = core.getInput('architecture', { required: true });
|
const arch = core.getInput('architecture', { required: true });
|
||||||
yield finder.findPythonVersion(version, arch);
|
yield finder.findPythonVersion(version, arch);
|
||||||
|
@ -4,7 +4,10 @@ import * as path from 'path';
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const version: string = core.getInput('version');
|
let version = core.getInput('version');
|
||||||
|
if (!version) {
|
||||||
|
version = core.getInput('python-version');
|
||||||
|
}
|
||||||
if (version) {
|
if (version) {
|
||||||
const arch: string = core.getInput('architecture', {required: true});
|
const arch: string = core.getInput('architecture', {required: true});
|
||||||
await finder.findPythonVersion(version, arch);
|
await finder.findPythonVersion(version, arch);
|
||||||
|
Reference in New Issue
Block a user