Skip to content

Commit 31df5cf

Browse files
authored
Add cache to e2e tests (#826)
1 parent 937fa34 commit 31df5cf

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.github/actions/build-push-image/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Build Container Image
22
description: Builds the operator container image for the given architecture
33
inputs:
4+
get-existing-cache:
5+
description: 'Get cache from the previous build'
6+
required: false
7+
default: 'false'
48
platforms:
59
description: The list of platforms for which the image will be built
610
required: true
@@ -68,6 +72,7 @@ runs:
6872
with:
6973
go-version-file: "${{ github.workspace }}/go.mod"
7074
- name: Setup cache
75+
if: ${{ inputs.get-existing-cache == 'false' }}
7176
uses: actions/cache@v3
7277
with:
7378
path: |

.github/workflows/test-e2e.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ jobs:
8282
path: |
8383
./*
8484
key: ${{ github.sha }}
85+
- name: Check go dependencies
86+
id: cache-go
87+
uses: actions/cache@v3
88+
with:
89+
path: |
90+
~/.cache/go-build
91+
~/go/pkg/mod
92+
key: ${{ runner.os }}-go-full-${{ hashFiles('**/go.sum') }}
93+
- name: Get go dependencies if cache is missed
94+
if: steps.cache-go.outputs.cache-hit != 'true'
95+
run: |
96+
cd cmd/manager
97+
go get -d
8598
- name: Prepare docker tag
8699
id: prepare-docker-bundle-tag
87100
run: |
@@ -92,6 +105,7 @@ jobs:
92105
- name: Build and Push image
93106
uses: ./.github/actions/build-push-image
94107
with:
108+
get-existing-cache: true
95109
file: bundle.Dockerfile
96110
repository: ${{ env.DOCKER_BUNDLES_REPO }}
97111
version: ${{ steps.prepare.outputs.tag }}
@@ -143,6 +157,13 @@ jobs:
143157
with:
144158
path: ./*
145159
key: ${{ github.sha }}
160+
- name: Get all go dependencies
161+
uses: actions/cache@v3
162+
with:
163+
path: |
164+
~/.cache/go-build
165+
~/go/pkg/mod
166+
key: ${{ runner.os }}-go-full-${{ hashFiles('**/go.sum') }}
146167
- name: Prepare tag
147168
id: prepare
148169
uses: ./.github/actions/set-tag

0 commit comments

Comments
 (0)