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

Can't cache dependencies from a composite action #467

Open
2 of 5 tasks
dkirrane opened this issue Apr 2, 2024 · 7 comments
Open
2 of 5 tasks

Can't cache dependencies from a composite action #467

dkirrane opened this issue Apr 2, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@dkirrane
Copy link

dkirrane commented Apr 2, 2024

Description:
I have a repo with a go.mod and go.sum and I caller another repo that contains a composite action that checks out the caller repo and calls actions/setup-go@v5

name: Go Test

runs:
  using: "composite"

  steps:

    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup Go
      uses: actions/setup-go@v5
      with:
        go-version-file: test/go.mod
        cache-dependency-path: test/go.sum

    - name: go test
      run: |
        cd test/
        go test
      shell: bash

Action version:
actions/setup-go@v5

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
go 1.21

Repro steps:

Caller repo calling the above composite action:

name: Caller

on:
  workflow_dispatch:

jobs:

  Test:
    runs-on: ubuntu-latest
    steps:
      - name: Go Test
        uses: company/gotest-action/test@main

Expected behavior:
I was expecting dependencies to cache

Actual behavior:
Cache is not found

Run actions/setup-go@v5
Setup go version spec 1.21
Found in cache @ /opt/hostedtoolcache/go/1.21.8/x64
Added go to the path
Successfully set up Go version 1.21
/opt/hostedtoolcache/go/1.21.8/x64/bin/go env GOMODCACHE
/opt/hostedtoolcache/go/1.21.8/x64/bin/go env GOCACHE
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
Cache is not found
go version go1.21.8 linux/amd64
@dkirrane dkirrane added bug Something isn't working needs triage labels Apr 2, 2024
@matthewhughes934
Copy link

I was expecting dependencies to cache

Just to clarify: you're seeing the cache not found on repeated runs on the same branch in the calling repo?

Do you see the cache being successfully saved on a previous run with a line like (in the Post Go Test section):

Cache saved with the key: setup-go-Linux-ubuntu22-....

@aparnajyothi-y
Copy link

Hello @dkirrane, Thank you for creating this issue and we will look into it :)

@dkirrane
Copy link
Author

dkirrane commented Apr 5, 2024

@matthewhughes934 - yes to confirm re-runs always download dependencies again

image

I can see there is 1 cache

image

@matthewhughes934
Copy link

to confirm re-runs always download dependencies again

👍 in that case is your issue related to the first run of the action? From what I understand cache access is limited to workflows the repo they were created in (from: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) so I wouldn't expect the first run to hit any cache

@dkirrane
Copy link
Author

dkirrane commented Apr 9, 2024

Ok, seems similar to this actions/toolkit#1035
I'll try the workaround suggested

@priyagupta108 priyagupta108 self-assigned this Apr 10, 2024
@priyagupta108
Copy link

Hello @dkirrane 👋,
I've attempted to reproduce the issue on my end, but was unable to do so. In my test environment, caching and reuse of dependencies worked as expected. It appears that the issue might be confined to your specific setup or workflow configuration.
Could you please provide a link to a minimal reproduction of the issue? It would be very helpful in addressing your issue. Thank you!


@priyagupta108
Copy link

Hello @dkirrane,
Just a gentle reminder about the issue. If you could provide a minimal reproduction of the problem, it would help us in investigating this further. Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants