snok / install-poetry

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

.venv caching is not working using composable actions? #120

Closed emirkmo closed 1 year ago

emirkmo commented 1 year ago

I am running this action as part of a workflow to build a package. In the workflow, at build time, I generate a new lockfile for CI (as the usual lockfile uses an internal pypi repo not available to the GitHub actions runner).

Then I load this lockfile and the .venv in future test steps such as pytest, so that each step can be a job but each step does not have to re-create the lockfile and re-install from scratch.

However, I must be doing something wrong as the installed dependencies are not found even after I restore and source the cache-restored .venv/bin/activate and restore the lockfile as well.

The build and restore are themselves each a composable action, as I have many tests that will need to run these..

Is there something about the composable action runtime that is not allowing the .venv to be restored when used in a step of a different workflow?

is the issue perhaps that I also need to cache and restore the poetry install itself?

sondrelg commented 1 year ago

No, this should work :slightly_smiling_face: Please post your workflow and I'll see if I can work out what the problem is

emirkmo commented 1 year ago

In that case, the error is with the user behind the chair! Thanks! I'll fix it.

Edit: and fixed. The problem was calling the action again with create virtual environments, and use project ones, before restoring the cache. This somehow caused the cache restore to not work. But it works now. Great action!

sondrelg commented 1 year ago

Sweet :partying_face: