Skip to content

Commit

Permalink
Set Python UserBase During Install
Browse files Browse the repository at this point in the history
Set the PYTHONUSERBASE during installation to make the poetry module
available.

Signed-off-by: Hassan Abouelela <hassan@hassanamr.com>
  • Loading branch information
HassanAbouelela committed Sep 8, 2022
1 parent 492169a commit 92656c0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions setup-python/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ runs:

- name: Install dependencies
shell: bash
env:
PYTHONUSERBASE: ${{ github.workspace }}/.cache/py-user-base
run: |
if [ "${{ steps.python_cache.outputs.cache-hit }}" = "true" ]; then
if [ "${{ inputs.use_cache }}" = "false" ]; then
echo "Caching not enbaled, deleting cache."
rm -rf ${{ env.PYTHONUSERBASE }}
rm -rf ${{ env.PRE_COMMIT_HOME }}
rm -rf ~/.cache/py-user-base
rm -rf ~/.cache/pre-commit
else
echo "Cache hit, skipping install."
exit
Expand All @@ -93,14 +95,17 @@ runs:
cd ${{ inputs.working_dir }}
if [ "${{ inputs.dev }}" = "true" ]; then
poetry install ${{ inputs.install_args }}
python -m poetry install ${{ inputs.install_args }}
else
poetry install ${{ inputs.install_args }} --no-dev
python -m poetry install ${{ inputs.install_args }} --no-dev
fi
echo "::endgroup::"
- name: Configure Path
shell: bash
env:
PYTHONUSERBASE: ${{ github.workspace }}/.cache/py-user-base
run: |
cd ${{ inputs.working_dir }}
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
python -m poetry -V
echo "$(python -m poetry env info --path)/bin" >> $GITHUB_PATH

0 comments on commit 92656c0

Please sign in to comment.