#How do you efficiently share fetched dependencies across GitHub Action jobs?

4 messages · Page 1 of 1 (latest)

prisma pivot
#

I have a GitHub Action that has several jobs run in parallel. All of them need to do the following first set of steps:

- name: checkout
  uses: actions/checkout@v3
- name: setup go
  uses: actions/setup-go@v3
  with:
    go-version: stable
    check-latest: true
- name: get dependencies
  run: go mod download -x

The first 2 steps, checkout and setup go are very fast. However, get dependencies takes about 1 minute to complete. This wouldn't be much of a concern if I was only running 1 job within my action but I have 4 so that's 4m of actions used instead of 1.

I've been trying to look into this but haven't found anything that seems to fit the bill well...

  • GitHub composite actions run on the main job but I have many jobs.
  • Dispatched workflows do not have an easy way to get data back to the main job from the dispatched one.
  • Reusable workflows seem like they may work but that would be several artifacts to upload, as many as the dependencies I have which can change over time.

So with all that said, has anyone found a nice / efficient way to do this outside of the above options? Or, are the above options truly the best we have to choose from? Will I just have to eat the 3 extra minutes every run?

severe glade
#

cache?

harsh river
#

What about using actions/cache to cache the GOPATH?

prisma pivot
#

facepalm That sounds like it will do the trick. I will give it a try.