potatoqualitee / psmodulecache

This action makes caching PowerShell modules from the PowerShell Gallery easy for Linux, Windows and macOS runners.
MIT License
31 stars 12 forks source link

Cache restore missing some of the modules #45

Closed beau-witter closed 1 year ago

beau-witter commented 1 year ago

When there was a cache miss and the modules needed to be installed, my workflow worked just fine and the build was able to complete as shown here. cache_save

Once that was saved, however, the proceeding runs all fail with the same error. It appears that the module "PlatyPS" is not being correctly imported by the cacher cacher_malfunction

LaurentDardenne commented 1 year ago

Hi, where can I read the code and the logs of the Action used?

beau-witter commented 1 year ago

https://github.com/vexx32/PSKoans/actions/runs/4106356511/jobs/7084476447

LaurentDardenne commented 1 year ago

Thanks. Coul you delete the cache file 'Linux-5.0-Immutable-pwsh-PSDeploy-BuildHelpers-PlatyPS-Pester:5.0.2-EZOut' and run again the Action ?

beau-witter commented 1 year ago

Thanks. Coul you delete the cache file 'Linux-5.0-Immutable-pwsh-PSDeploy-BuildHelpers-PlatyPS-Pester:5.0.2-EZOut' and run again the Action ?

I do not have write access to the repo. I cannot delete the cache.

LaurentDardenne commented 1 year ago

Ok, I try to repro this issue.

I do not have write access to the repo. I cannot delete the cache.

To test, you can force the cache update by adding another module name, this creates a new cache key.

LaurentDardenne commented 1 year ago

I reproduce the error, I would test with the new version of the 'Cache' action.

LaurentDardenne commented 1 year ago

The name of the module path is platyPS. (Edit: This is the module manifest name that is used as the Nuget package name.)

The path name with PSModulecache is PlatyPS : image

Changing the case of the path name passed to the action seems to work. To be checked. image

beau-witter commented 1 year ago

Oh my, I can't believe it was a casing issue. Problem solved then. Thanks a ton!

LaurentDardenne commented 1 year ago

@potatoqualitee Hi, can you add the 'Bug' label and reopen this issue ?

The construction of the path name, during Save-Module, comes from the nuget package and not from the contents of the 'modules-to-cache' parameter : image

It's more a bug due to the behavior of PowershellGet. The contents of parameters targeting module names are case-insensitive except when writing to disk by PSGet(name of the nuget package generated when published). This case was not highlighted during my tests.

Moreover, I think that the dependent modules (present in a manifest), are not saved in the cache, I will check as soon as I have time.