Skip to content

Commit 7d66237

Browse files
committed
Add job to download go modules
This commit adds a job that downloads all go modules to populate the cache, this is ran prior to the generate and test jobs which should save some time. Signed-off-by: David Bond <davidsbond93@gmail.com>
1 parent 3b17e6d commit 7d66237

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/go.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,25 @@ on:
2020
- '.github/workflows/go.yml'
2121

2222
jobs:
23+
mod:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4.2.2
28+
29+
- name: Install Go
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version-file: go.mod
33+
cache: true
34+
35+
- name: Download Modules
36+
run: go mod download
37+
2338
test:
2439
runs-on: ubuntu-latest
40+
needs:
41+
- mod
2542
steps:
2643
- name: Checkout
2744
uses: actions/checkout@v4.2.2
@@ -37,6 +54,8 @@ jobs:
3754

3855
generate:
3956
runs-on: ubuntu-latest
57+
needs:
58+
- mod
4059
steps:
4160
- name: Checkout
4261
uses: actions/checkout@v4.2.2
@@ -50,7 +69,7 @@ jobs:
5069
- name: Generate
5170
run: make generate
5271

53-
- name: Check changes
72+
- name: Check Changes
5473
run: |
5574
git add .
5675
git diff --staged --exit-code

0 commit comments

Comments
 (0)