erlef / setup-beam

Set up your BEAM-based GitHub Actions workflow (Erlang, Elixir, Gleam, ...)
MIT License
376 stars 50 forks source link

Question: Caching Elixir/OTP installs to save build minutes #231

Closed lolo-frank closed 8 months ago

lolo-frank commented 1 year ago

To save build minutes and improve CI speeds, caching OTP and Elixir installs is desired. Using a self-hosted runner, I am able to cache the Elixir and OTP directories. However, after restoring them I am unable to use mix or elixir due to the PATH not being updated.

Is there a way to have setup-beam not install OTP/Elixir if they exist within the install directories but update the path as if it did install?

I'm only caching for 24 hours, everything is built fresh on the first run of the new day.

I had to manually set the directories to cache as the ENV variable for installation paths are only available post install.

Restoration paths:

Any help would be appreciated as I cannot find any posted solutions at this time.

update: I added the paths to GITHUB_PATH but the binaries were not found still.

paulo-ferraz-oliveira commented 1 year ago

Hi, @lolo-frank.

There's currently no way to do what you ask.

One idea that occurs to me is that you could take the PATH elements the action issues, store those, e.g. in a file, and recover them at a later date. It's not ideal, but it should work.

Check, for example, INSTALL_DIR_FOR_OTP, from the environment, after the action is run. It should be a path to a folder that, if suffixed with bin, should contain the Erlang executable. All other possible env. variables are mentioned in the README.

I would assume, from what you wrote before, that ~/actions-runner/_work/_tool/otp/ubuntu-22.04/OTP-25.3.2.6/bin is where you'd find the Erlang executables.

paulo-ferraz-oliveira commented 8 months ago

I don't think we'll add support to this, for the moment, and this issue gained no more traction. I'm closing, for now, but feel free to reopen if you can state a potential path for a solution. Thanks.