Skip to content

Commit

Permalink
Merge pull request Tribler#6949 from drew2a/feature/pyenv_invalidate
Browse files Browse the repository at this point in the history
Add `invalidate-cache` flag
  • Loading branch information
drew2a authored Jun 27, 2022
2 parents 21168b4 + 53bf62e commit 77abcb1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/actions/pyenv/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ inputs:
description: 'The path to requirements.txt file'
required: false

invalidate-cache:
default: 'false'
description: 'Force create a virtualenv'
required: false

outputs:
virtualenv-directory:
description: 'The path to the restored or created virtualenv'
Expand All @@ -24,13 +29,20 @@ runs:
python-version: ${{inputs.python-version}}

- name: Restore virtual env
uses: syphar/restore-virtualenv@v1
uses: drew2a/restore-virtualenv@v1.2.1
id: cache-virtualenv
with:
requirement_files: ${{inputs.requirements}}

- name: Invalidate cache
if: inputs.invalidate-cache == 'true'
shell: bash
run: |
rm -rf ${{steps.cache-virtualenv.outputs.virtualenv-directory}}
python -m venv ${{steps.cache-virtualenv.outputs.virtualenv-directory}}
- name: Install pip dependencies
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
if: steps.cache-virtualenv.outputs.cache-hit != 'true' || inputs.invalidate-cache == 'true'
shell: bash
run: |
python -m pip install --upgrade pip
Expand Down

0 comments on commit 77abcb1

Please sign in to comment.