diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ec42d4c608..40cd00b7e43 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,10 +40,16 @@ jobs: source $HOME/.poetry/env poetry config virtualenvs.in-project true - name: Set up cache + id: cache uses: actions/cache@v1 with: path: .venv key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} + - name: Ensure cache is healthy + if: steps.cache.outputs.cache-hit == 'true' + run: | + source $HOME/.poetry/env + poetry run pip --version >/dev/null 2>&1 || rm -rf .venv - name: Install dependencies run: | source $HOME/.poetry/env @@ -76,10 +82,16 @@ jobs: source $HOME/.poetry/env poetry config virtualenvs.in-project true - name: Set up cache + id: cache uses: actions/cache@v1 with: path: .venv key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} + - name: Ensure cache is healthy + if: steps.cache.outputs.cache-hit == 'true' + run: | + source $HOME/.poetry/env + poetry run pip --version >/dev/null 2>&1 || rm -rf .venv - name: Install dependencies run: | source $HOME/.poetry/env @@ -113,10 +125,17 @@ jobs: $env:Path += ";$env:Userprofile\.poetry\bin" poetry config virtualenvs.in-project true - name: Set up cache + id: cache uses: actions/cache@v1 with: path: .venv key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} + - name: Ensure cache is healthy + if: steps.cache.outputs.cache-hit == 'true' + shell: bash + run: | + source $(cmd.exe /C echo %USERPROFILE%)/.poetry/env + poetry run pip --version >/dev/null 2>&1 || rm -rf .venv - name: Install dependencies run: | $env:Path += ";$env:Userprofile\.poetry\bin"