Skip to content

Commit

Permalink
Add Poetry Version Option
Browse files Browse the repository at this point in the history
Adds an option to the setup-python action to allow specifying the poetry
version.

Signed-off-by: Hassan Abouelela <hassan@hassanamr.com>
  • Loading branch information
HassanAbouelela committed Sep 8, 2022
1 parent 4c445c4 commit 21ccaae
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions setup-python/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ inputs:
required: false
default: ""

poetry_version:
description: "The poetry version to install (passed to pip install)"
required: false
default: "poetry"

outputs:
cache-hit:
description: "Was there a cache hit for the python cache."
Expand Down Expand Up @@ -58,7 +63,7 @@ runs:
~/.cache/py-user-base
key: "python-${{ runner.os }}-${{ env.PYTHONUSERBASE }}-\
v1.2.1-\
${{ steps.python_setup.outputs.python-version }}-${{ inputs.dev }}-${{ inputs.working_dir }}\
${{ steps.python_setup.outputs.python-version }}-${{ inputs.dev }}-${{ inputs.working_dir }}-${{ inputs.poetry_version }}\
${{ hashFiles('./pyproject.toml', './poetry.lock') }}"

# Cache pre-commit independently of other cache
Expand All @@ -68,14 +73,14 @@ runs:
path: ~/.cache/pre-commit
key: "precommit-${{ runner.os }}-${{ env.PRE_COMMIT_HOME }}-\
v1.2.1-\
${{ steps.python_setup.outputs.python-version }}-${{ inputs.dev }}-${{ inputs.working_dir }}\
${{ steps.python_setup.outputs.python-version }}-${{ inputs.dev }}-${{ inputs.working_dir }}-${{ inputs.poetry_version }}\
${{ hashFiles('./.pre-commit-config.yaml') }}"

- name: Install Poetry
shell: bash
run: |
echo "::group::Install Poetry"
pip install poetry
pip install ${{ inputs.poetry_version }}
echo "::endgroup::"
- name: Install dependencies
Expand Down Expand Up @@ -107,3 +112,4 @@ runs:
run: |
cd ${{ inputs.working_dir }}
echo "$(python -m poetry env info --path)/bin" >> $GITHUB_PATH
python -m poetry -V

0 comments on commit 21ccaae

Please sign in to comment.