snok / install-poetry

Github action for installing and configuring Poetry
MIT License
572 stars 53 forks source link

Cache not found #126

Closed jessicabowden closed 1 year ago

jessicabowden commented 1 year ago

Caching the poetry install works fine but seem to be having issues with caching the virtualenv, see:

Screenshot 2023-07-05 at 12 39 54 PM

Here is the workflow definition:

  lint:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up python
        id: setup-python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10.9'

      - name: Install and configure poetry
        uses: snok/install-poetry@v1
        with:
          virtualenvs-create: true

      - name: Load cached Poetry installation
        id: cached-poetry
        uses: actions/cache@v3
        with:
          path: ~/.local  # the path depends on the OS
          key: poetry-0  # increment to reset cache

      - name: Load cached venv
        id: cached-poetry-dependencies
        uses: actions/cache@v3
        with:
          path: .venv
          key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

      - name: Install dependencies
        if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
        run: poetry install --no-interaction --no-root

      - name: Lint
        run: |
          poetry run ruff . --format github
          poetry run black --skip-string-normalization .
          poetry run isort .
sondrelg commented 1 year ago

Were you able to resolve this @jessicabowden? Seems like it's saying there's no folder named .venv

jessicabowden commented 1 year ago

Have been unable to resolve this. Any idea what would be causing that? There's nothing in my pyproject.toml that would prevent creation of the virtualenv, and virtualenvs-create is set to true here

sondrelg commented 1 year ago

Ah, but you need virtualenvs-in-project: true for the path you've specified in the cache to be correct