Skip to content

Commit ebfed45

Browse files
committed
ci: add cache for integration, conformance and CRD validation tests
1 parent 339f08f commit ebfed45

File tree

1 file changed

+95
-5
lines changed

1 file changed

+95
-5
lines changed

.github/workflows/tests.yaml

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ jobs:
124124
- name: Checkout repository
125125
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
126126

127-
- name: Setup go
128-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
129-
with:
130-
go-version-file: go.mod
131-
132127
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
133128
with:
134129
install: false
@@ -355,11 +350,30 @@ jobs:
355350
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
356351
with:
357352
go-version-file: go.mod
353+
cache: false
358354

359355
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
360356
with:
361357
install: false
362358

359+
- run: |
360+
echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
361+
echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV
362+
363+
- run: echo "GO_CACHE_KEY=go-integrationtests-${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.mod') }}" >> $GITHUB_ENV
364+
- run: echo "GO_CACHE_KEY_2=go-integrationtests-${{ runner.os }}-${{ runner.arch }}-go-" >> $GITHUB_ENV
365+
366+
- name: Go cache
367+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
368+
with:
369+
path: |
370+
${{ env.GO_MOD_CACHE }}
371+
${{ env.GO_BUILD_CACHE }}
372+
key: ${{ env.GO_CACHE_KEY }}
373+
restore-keys: |
374+
${{ env.GO_CACHE_KEY }}
375+
${{ env.GO_CACHE_KEY_2 }}
376+
363377
- name: Run the crds validation tests
364378
run: |
365379
VERSION="${{ matrix.kubernetes-node-version }}"
@@ -414,11 +428,30 @@ jobs:
414428
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
415429
with:
416430
go-version-file: go.mod
431+
cache: false
417432

418433
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
419434
with:
420435
install: false
421436

437+
- run: |
438+
echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
439+
echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV
440+
441+
- run: echo "GO_CACHE_KEY=go-conformancetests-${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.mod') }}" >> $GITHUB_ENV
442+
- run: echo "GO_CACHE_KEY_2=go-conformancetests-${{ runner.os }}-${{ runner.arch }}-go-" >> $GITHUB_ENV
443+
444+
- name: Go cache
445+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
446+
with:
447+
path: |
448+
${{ env.GO_MOD_CACHE }}
449+
${{ env.GO_BUILD_CACHE }}
450+
key: ${{ env.GO_CACHE_KEY }}
451+
restore-keys: |
452+
${{ env.GO_CACHE_KEY }}
453+
${{ env.GO_CACHE_KEY_2 }}
454+
422455
- name: run conformance tests
423456
run: make test.conformance
424457
env:
@@ -478,11 +511,30 @@ jobs:
478511
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
479512
with:
480513
go-version-file: go.mod
514+
cache: false
481515

482516
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
483517
with:
484518
install: false
485519

520+
- run: |
521+
echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
522+
echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV
523+
524+
- run: echo "GO_CACHE_KEY=go-integrationtests-${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.mod') }}" >> $GITHUB_ENV
525+
- run: echo "GO_CACHE_KEY_2=go-integrationtests-${{ runner.os }}-${{ runner.arch }}-go-" >> $GITHUB_ENV
526+
527+
- name: Go cache
528+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
529+
with:
530+
path: |
531+
${{ env.GO_MOD_CACHE }}
532+
${{ env.GO_BUILD_CACHE }}
533+
key: ${{ env.GO_CACHE_KEY }}
534+
restore-keys: |
535+
${{ env.GO_CACHE_KEY }}
536+
${{ env.GO_CACHE_KEY_2 }}
537+
486538
- name: run integration tests
487539
run: make test.integration-${{ matrix.suite }}
488540
env:
@@ -542,11 +594,30 @@ jobs:
542594
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
543595
with:
544596
go-version-file: go.mod
597+
cache: false
545598

546599
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
547600
with:
548601
install: false
549602

603+
- run: |
604+
echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
605+
echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV
606+
607+
- run: echo "GO_CACHE_KEY=go-integrationtestsvalidatingwebhook-${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.mod') }}" >> $GITHUB_ENV
608+
- run: echo "GO_CACHE_KEY_2=go-integrationtestsvalidatingwebhook-${{ runner.os }}-${{ runner.arch }}-go-" >> $GITHUB_ENV
609+
610+
- name: Go cache
611+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
612+
with:
613+
path: |
614+
${{ env.GO_MOD_CACHE }}
615+
${{ env.GO_BUILD_CACHE }}
616+
key: ${{ env.GO_CACHE_KEY }}
617+
restore-keys: |
618+
${{ env.GO_CACHE_KEY }}
619+
${{ env.GO_CACHE_KEY_2 }}
620+
550621
- name: run integration tests
551622
run: make test.integration_validatingwebhook
552623
env:
@@ -597,11 +668,30 @@ jobs:
597668
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
598669
with:
599670
go-version-file: go.mod
671+
cache: false
600672

601673
- uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
602674
with:
603675
install: false
604676

677+
- run: |
678+
echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
679+
echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV
680+
681+
- run: echo "GO_CACHE_KEY=go-integrationtestsbluegreen-${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.mod') }}" >> $GITHUB_ENV
682+
- run: echo "GO_CACHE_KEY_2=go-integrationtestsbluegreen-${{ runner.os }}-${{ runner.arch }}-go-" >> $GITHUB_ENV
683+
684+
- name: Go cache
685+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
686+
with:
687+
path: |
688+
${{ env.GO_MOD_CACHE }}
689+
${{ env.GO_BUILD_CACHE }}
690+
key: ${{ env.GO_CACHE_KEY }}
691+
restore-keys: |
692+
${{ env.GO_CACHE_KEY }}
693+
${{ env.GO_CACHE_KEY_2 }}
694+
605695
- name: run integration tests
606696
run: make test.integration_bluegreen
607697
env:

0 commit comments

Comments
 (0)