Skip to content

Commit 79cd32b

Browse files
committed
chore(CI): setup Python using pyenv
1 parent c5b0dda commit 79cd32b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/test-and-publish.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,20 @@ jobs:
179179
submodules: recursive
180180
fetch-depth: 0 # fetch all history for all branches and tags
181181
# poetry-dynamic-versioning needs git tags to produce the correct version number
182+
- name: Setup Python
183+
if: ${{ runner.os == 'Linux' }}
184+
run: |
185+
# Use pyenv to install Python version that is not available via `actions/setup-python`
186+
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
187+
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
188+
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
189+
echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc
190+
pyenv install $PYTHON_VERSION
191+
pyenv global $PYTHON_VERSION
192+
env:
193+
PYTHON_VERSION: ${{ matrix.python_version }}
182194
- uses: actions/setup-python@v5
195+
if: ${{ runner.os != 'Linux' }}
183196
with:
184197
python-version: ${{ matrix.python_version }}
185198
- name: Setup Poetry

0 commit comments

Comments
 (0)