setup-go
setup-go copied to clipboard
Can't cache dependencies from a composite action
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:
- [x] Ubuntu
- [ ] macOS
- [ ] Windows
Runner type:
- [x] 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
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-....
Hello @dkirrane, Thank you for creating this issue and we will look into it :)
@matthewhughes934 - yes to confirm re-runs always download dependencies again
I can see there is 1 cache
to confirm re-runs always download dependencies again
:+1: 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
Ok, seems similar to this https://github.com/actions/toolkit/issues/1035 I'll try the workaround suggested
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!
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!
Hello @dkirrane👋 , A gentle reminder regarding the problem. A minimal reproduction of the problem from your end would be a great help. We look forward to your response. Thank you!
Hello @dkirrane👋, Due to inactivity, I'm going to close this issue for now. Please feel free to reopen the issue if necessary, or create a new one. Thank you :)