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

Feature request: Support built-in cache #130

Closed
qsliu2017 opened this issue Jul 17, 2021 · 6 comments
Closed

Feature request: Support built-in cache #130

qsliu2017 opened this issue Jul 17, 2021 · 6 comments
Labels
feature request New feature or request to improve the current logic

Comments

@qsliu2017
Copy link

I always use actions/cache to cache the default location for cache data, and I think this should be a built-in feature of this action, like setup-node supports dependency caching.

@sebastianst
Copy link

That'd be awesome. For reference, actions/cache recommends the following step in your job for Go repos (Linux):

- uses: actions/cache@v2
  with:
    path: |
      ~/.cache/go-build
      ~/go/pkg/mod
    key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    restore-keys: |
      ${{ runner.os }}-go-

A nice start would be to mention this actions/cache setup in the README.

@dmitry-shibanov
Copy link
Contributor

Hello everyone. We released the new version of setup-go with caching support and updated major tag. For now I'm going to close the issue if you have any concerns feel free to ping us.

@lucacome
Copy link

lucacome commented Aug 6, 2022

Hello, I replaced

- uses: actions/cache@v2
  with:
    path: |
      ~/.cache/go-build
      ~/go/pkg/mod
    key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    restore-keys: |
      ${{ runner.os }}-go-

with the built-in cache, but seems like it's not achieving the same result, as the build time is up to 3-4 minutes form ~40s-1m.

I suspect this is because it needs to download the modules instead of using the cached ones, any ideas?

EDIT: It might be because I have the setup in different jobs, but the key is always the same, so the cache is not updated? I used to have different keys, for like the unit tests and the build

@e-korolevskii
Copy link
Contributor

Hello @lucacome
Could you please open a separate issue with a detailed description and steps to reproduce it?

@same-id
Copy link

same-id commented Mar 23, 2023

Maybe perhaps this is because there are not "restore-keys", only exact match on primary key?

At least this is what I'm trying to understand now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants