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

Please document how to cache so that bb is not re-downloaded on each run #15

Open
holyjak opened this issue Jan 6, 2023 · 8 comments
Open

Comments

@holyjak
Copy link

holyjak commented Jan 6, 2023

I see that every run of the setup action, bb is downloaded anew. It should be possible to cache it.

Actually looking at DeLaGuardo/[email protected] it seems it does cache it itself:

Run DeLaGuardo/[email protected]
...
Cache restored successfully
Clojure CLI found in cache /opt/hostedtoolcache/ClojureToolsDeps/1.11.1-1208-10-1/x64

so perhaps setup-babashka could do the same? 🙏

@nha
Copy link
Contributor

nha commented Jan 27, 2023

setup-babashka should also use the cache if available.
See:

Is there an indication that this is not working as expected?

@liny01-nbsa
Copy link

Hi @nha , Below log is from one of our actions, and it's been running for weeks. And this is from its latest run

image

Looks, it couldn't find any cached version, and downloads bb.

This is the part of action

      - name: Install babashka v1.3.188
        uses: turtlequeue/[email protected]
        with:
          babashka-version: '1.3.188'

@liny01-nbsa
Copy link

@nha , I use the below snippet to workaround, it looks to work, is it possible that the issue is Windows only?

      - name: Cache Babashka binary (Workaround)
        uses: actions/cache@v4
        id: cache-bb
        with:
          # save-always: true
          path: C:\hostedtoolcache\windows\Babashka\1.3.188\x64
          key: ${{ runner.os }}-bb-1.3.188

      - name: Install babashka v1.3.188
        if: steps.cache-bb.outputs.cache-hit != 'true'
        uses: turtlequeue/[email protected]
        with:
          babashka-version: '1.3.188'

      - name: add bb to path
        if: steps.cache-bb.outputs.cache-hit == 'true'
        run: echo "C:\hostedtoolcache\windows\Babashka\1.3.188\x64" >> $env:GITHUB_PATH

@nha
Copy link
Contributor

nha commented Jan 29, 2024

@liny01-nbsa Thank you for the report, I will look into it. While I do not use Windows myself, it should work all the same.
Do I understand correctly that you are using the self-hosted github runner?

@liny01-nbsa
Copy link

@nha , no, we are using the hosted runner. windows-latest.

image

@nha
Copy link
Contributor

nha commented Apr 1, 2024

Please give a try to v1.7.0.

I should also mention that I am not convinced if caching makes a practical difference here because it usually takes about 3 seconds to run the action without caching.

@liny01-nbsa
Copy link

@nha , thank you! That is a very interesting point. I don't have access to my workstation now. But from my screenshot, I noticed in about Jan 2024, a non-cached run would take > 1 min.

I will test the new version when I got back.

image

@nha
Copy link
Contributor

nha commented Apr 8, 2024

Oh interesting. Here is a sample run from the main branch on windows, it took 3s:

Screenshot 2024-04-08 at 15 44 30

https://github.com/turtlequeue/setup-babashka/actions/runs/8510483088/job/23308162033

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

No branches or pull requests

3 participants