Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install SBT on self-hosted gha runners #10

Closed
wants to merge 1 commit into from

Conversation

zarthross
Copy link
Contributor

The $HOME/work directory may not always exist on runners if they are self hosted for instance (our work folder was $HOME/_work).

Github has a $RUNNER_TEMP location though that gets cleaned up between jobs and will exist.

Instead of using a location like $HOME/work that might not exist we can use $RUNNER_TEMP that will.

@eed3si9n
Copy link
Member

https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L747
Maybe I'm supposed to use RUNNER_TOOL_CACHE?

@zarthross
Copy link
Contributor Author

Looking closer at the tool-cache, it does look like the RUNNER_TEMP is the right place to download the zip file tool, and RUNNER_TOOL_CACHE is the correct place to extract the zip to and add to the path. It would appear doing a check that its not already in the RUNNER_TOOL_CACHE before doing those things would be a wise idea.

@eed3si9n
Copy link
Member

It would appear doing a check that its not already in the RUNNER_TOOL_CACHE before doing those things would be a wise idea.

The action is using actions/cache to check if it needs to be downloaded or not:

    - name: Cache sbt distribution
      id: cache-dir
      uses: actions/cache@v4
      with:
        path: ${{ steps.cache-paths.outputs.setupsbt_path }}
        key: ${{ runner.os }}-sbt-${{ inputs.sbt-runner-version }}-1.1.1

@zarthross
Copy link
Contributor Author

Yes, the download is cached in the github cache... but i think the tool cache is different on self-hosted runners and persists after each run. So if you leave the extracted zip file in the tool runner folder, you might be able to just check that its there and not even have to pull from the cache, or download the zip again.

I'm trying some experiments to look into this.

@zarthross
Copy link
Contributor Author

A bit more of an involved change, but here is an alternative approach to the one here: #11

@zarthross zarthross closed this Oct 23, 2024
@zarthross zarthross deleted the self-hosted branch October 23, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants