File tree Expand file tree Collapse file tree 6 files changed +85
-10
lines changed
actions/setup-pyenv-python Expand file tree Collapse file tree 6 files changed +85
-10
lines changed Original file line number Diff line number Diff line change 1+ name : setup-pyenv-python
2+ description : Setup Python via pyenv
3+ inputs :
4+ python-version :
5+ description : Python version to setup
6+ pyenv-version :
7+ description : Pyenv version to setup
8+ default : " v2.4.19"
9+ runs :
10+ using : " composite"
11+ steps :
12+ - name : Clone pyenv
13+ uses : actions/checkout@v4
14+ with :
15+ repository : " pyenv/pyenv"
16+ ref : ${{ inputs.pyenv-version }}
17+ path : pyenv
18+
19+ - name : Setup environment variables
20+ shell : bash
21+ run : |
22+ echo PATH="${PWD}/pyenv/bin:${PATH}" >> "${GITHUB_ENV}"
23+ echo PYENV_ROOT="${PWD}/pyenv" >> "${GITHUB_ENV}"
24+
25+ - name : Setup pyenv into profile
26+ shell : bash
27+ run : |
28+ eval "$(pyenv init -)" >> ~/.profile
29+
30+ - name : Install required packages
31+ shell : bash
32+ run : |
33+ sudo apt-get update
34+ sudo apt-get install -y libncurses5-dev libbz2-dev libreadline-dev libsqlite3-dev libssl-dev zlib1g-dev liblzma-dev
35+
36+ - name : Setup Python
37+ shell : bash
38+ run : |
39+ set -x
40+ pyenv install ${{ inputs.python-version }}
41+ pyenv global ${{ inputs.python-version }}
42+ echo PATH="$(dirname $(pyenv which python${{ inputs.python-version }})):$PATH" >> ${GITHUB_ENV}
43+
44+ - name : Use python as python3
45+ shell : bash
46+ run : |
47+ set -x
48+ ls -l ~/.local/bin/
49+ ln -sf $(which pip${{ inputs.python-version }}) ~/.local/bin/pip
50+ ln -sf $(which python${{ inputs.python-version }}) ~/.local/bin/python
51+ ln -sf $(which pip${{ inputs.python-version }}) ~/.local/bin/pip3
52+ ln -sf $(which python${{ inputs.python-version }}) ~/.local/bin/python3
Original file line number Diff line number Diff line change 3939 description : Ignore pytest.skip
4040 type : boolean
4141 default : false
42- use_system_python :
43- description : Use system Python
42+ use_pyenv_python :
43+ description : Use Python built with pyenv
4444 type : boolean
4545 default : false
4646
6464 skip_list : ${{ inputs.skip_list }}
6565 run_name : ${{ inputs.run_name || format('Build and test {0}', inputs.runner_label) }}
6666 enable_unskip : ${{ inputs.enable_unskip }}
67- use_system_python : ${{ inputs.use_system_python || false }}
67+ use_pyenv_python : ${{ inputs.use_pyenv_python || false }}
Original file line number Diff line number Diff line change 3232 description : Ignore pytest.skip
3333 type : boolean
3434 default : false
35+ use_pyenv_python :
36+ description : Use Python built with pyenv
37+ type : boolean
38+ default : false
3539
3640permissions : read-all
3741
7983 skip_list : ${{ inputs.skip_list }}
8084 run_name : ${{ inputs.run_name }}
8185 enable_unskip : ${{ inputs.enable_unskip }}
86+ use_pyenv_python : ${{ inputs.use_pyenv_python || false }}
Original file line number Diff line number Diff line change 5656 description : Runner label for version
5757 type : string
5858 default : runner-0.0.20
59- use_system_python :
60- description : Use system Python
59+ use_pyenv_python :
60+ description : Use Python built with pyenv
6161 type : boolean
6262 default : false
6363
@@ -94,12 +94,18 @@ jobs:
9494 path : $HOME/.cache/pip
9595 key : pip-${{ inputs.python_version }}-${{ hashFiles('python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
9696
97- - name : Install Python ${{ inputs.python_version }}
98- if : ${{ !inputs.use_system_python }}
97+ - name : Install Python (using actions/setup-python) ${{ inputs.python_version }}
98+ if : ${{ !inputs.use_pyenv_python }}
9999 uses : actions/setup-python@v5
100100 with :
101101 python-version : ${{ inputs.python_version }}
102102
103+ - name : Install Python (from pyenv) ${{ inputs.python_version }}
104+ if : ${{ inputs.use_pyenv_python }}
105+ uses : ./.github/actions/setup-pyenv-python
106+ with :
107+ python-version : ${{ inputs.python_version }}
108+
103109 - name : Identify Python version
104110 run : |
105111 PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info[0]}.{ sys.version_info[1]}")')"
Original file line number Diff line number Diff line change 3939 description : Ignore pytest.skip
4040 type : boolean
4141 default : false
42+ use_pyenv_python :
43+ description : Use Python built with pyenv
44+ type : boolean
45+ default : false
4246
4347 pull_request :
4448 branches :
@@ -130,3 +134,4 @@ jobs:
130134 skip_list : ${{ inputs.skip_list }}
131135 run_name : ${{ inputs.run_name }}
132136 enable_unskip : ${{ inputs.enable_unskip || false }}
137+ use_pyenv_python : ${{ inputs.use_pyenv_python || false }}
Original file line number Diff line number Diff line change 2828 description : JSON list of benchmarks to skip
2929 type : string
3030 default : " []"
31- use_system_python :
32- description : Use system Python
31+ use_pyenv_python :
32+ description : Use Python built with pyenv
3333 type : boolean
3434 default : false
35+
3536 schedule :
3637 - cron : " 5 23 * * *"
3738 pull_request :
@@ -71,11 +72,17 @@ jobs:
7172 key : pip-$PYTHON_VERSION-$GITHUB_SHA
7273
7374 - name : Install Python
74- if : ${{ !(inputs.use_system_python || false) }}
75+ if : ${{ !(inputs.use_pyenv_python || false) }}
7576 uses : actions/setup-python@v5
7677 with :
7778 python-version : ${{ env.PYTHON_VERSION }}
7879
80+ - name : Install Python (from pyenv) ${{ inputs.python_version }}
81+ if : ${{ inputs.use_pyenv_python }}
82+ uses : ./.github/actions/setup-pyenv-python
83+ with :
84+ python-version : ${{ env.PYTHON_VERSION }}
85+
7986 - name : Identify Python version
8087 run : |
8188 PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info[0]}.{ sys.version_info[1]}")')"
You can’t perform that action at this time.
0 commit comments