Skip to content

Commit

Permalink
ci(actions): add action setup-pyenv
Browse files Browse the repository at this point in the history
  ## what
  - add action `setup-pyenv`
    - setup locales (on ubuntu OS)
    - install build dependencies (on ubuntu OS)
    - setup pyenv ENVs
    - install pyenv
    - check pyenv version

  ## how
  - obtained from
    - https://github.com/mlflow/mlflow/blob/master/.github/actions/setup-pyenv/action.yml

  ## why
  - this will be used for setting up pyenv
  - this will declutter code in `.github/workflows/ci.yaml`

  ## where
  - ./.github/actions/setup-pyenv/action.yaml

  ## usage
  `uses: ./.github/actions/setup-pyenv`

  ## issue or pull request
  • Loading branch information
Clumsy-Coder committed Feb 6, 2024
1 parent 13decd1 commit c102a4f
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/actions/setup-pyenv/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---

# obtained from
# https://github.com/mlflow/mlflow/blob/master/.github/actions/setup-pyenv/action.yml

name: "setup-pyenv"
description: "Setup pyenv"

runs:
using: "composite"
steps:
- name: Setup locales
shell: bash
if: runner.os == 'Linux'
run: |
export LANG=en_CA.UTF-8
export LC_ALL=en_CA.UTF-8
sudo locale-gen "en_CA.UTF-8"
sudo dpkg-reconfigure locales
- name: Install python build tools
shell: bash
if: runner.os == 'Linux'
# Ref: https://github.com/pyenv/pyenv/wiki#suggested-build-environment
run: |
sudo apt-get update -y
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev ffmpeg
- name: Setup pyenv ENV variables
shell: bash
run: |
PYENV_ROOT="$HOME/.pyenv" ;
PYENV_BIN="$PYENV_ROOT/bin" ;
PYENV_SHIMS="$PYENV_ROOT/shims" ;
echo "$PYENV_BIN" >> "$GITHUB_PATH" ;
echo "$PYENV_SHIMS" >> "$GITHUB_PATH" ;
echo "PYENV_ROOT=$PYENV_ROOT" >> "$GITHUB_ENV" ;
- name: Install pyenv
shell: bash
run: curl https://pyenv.run | bash

- name: Check pyenv version
shell: bash
run: pyenv --version

0 comments on commit c102a4f

Please sign in to comment.