chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
name: "setup-pyenv"
|
||||
description: "Setup pyenv"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
########## Ubuntu ##########
|
||||
- name: Install python build tools
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
# Ref: https://github.com/pyenv/pyenv/wiki#suggested-build-environment
|
||||
# Note: llvm is optional (required only for building PyPy/clang)
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get purge -y man-db || true
|
||||
sudo apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev \
|
||||
libbz2-dev libreadline-dev libsqlite3-dev wget curl \
|
||||
libncursesw5-dev xz-utils libffi-dev liblzma-dev
|
||||
- name: Install pyenv
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
# Pin to pyenv v2.6.25 by tag + SHA verification for reproducible builds
|
||||
git clone --branch v2.6.25 --depth 1 https://github.com/pyenv/pyenv.git "$HOME/.pyenv"
|
||||
actual_sha=$(git -C "$HOME/.pyenv" rev-parse HEAD)
|
||||
expected_sha="aa2e8b82605b8ba085dd15f7a31fe1990fabdcfa"
|
||||
if [ "$actual_sha" != "$expected_sha" ]; then
|
||||
echo "::error::pyenv SHA mismatch: expected $expected_sha, got $actual_sha"
|
||||
exit 1
|
||||
fi
|
||||
- name: Setup environment variables
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
PYENV_ROOT="$HOME/.pyenv"
|
||||
PYENV_BIN="$PYENV_ROOT/bin"
|
||||
echo "$PYENV_BIN" >> $GITHUB_PATH
|
||||
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
|
||||
- name: Check pyenv version
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
pyenv --version
|
||||
|
||||
########## Windows ##########
|
||||
- name: Install pyenv
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
uv pip install --system pyenv-win --target $HOME\\.pyenv
|
||||
- name: Setup environment variables
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "PYENV=$USERPROFILE\.pyenv\pyenv-win\\" >> $GITHUB_ENV
|
||||
echo "PYENV_ROOT=$USERPROFILE\.pyenv\pyenv-win\\" >> $GITHUB_ENV
|
||||
echo "PYENV_HOME=$USERPROFILE\.pyenv\pyenv-win\\" >> $GITHUB_ENV
|
||||
echo "$USERPROFILE\.pyenv\pyenv-win\\bin\\" >> $GITHUB_PATH
|
||||
- name: Check pyenv version
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
pyenv --version
|
||||
Reference in New Issue
Block a user