Skip to content

Commit dfc870d

Browse files
jeduardoSaphMB
andcommitted
chore: added cache to build tools
Co-authored-by: Sapphire Mason-Brown <[email protected]>
1 parent 67682fe commit dfc870d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.github/actions/setup-common/action.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ inputs:
3838
description: 'Whether to enable tmate ssh debugging session (true/false)'
3939
required: false
4040
default: 'false'
41+
tools_base_path:
42+
description: 'Base path where tools will be installed and cached'
43+
required: false
44+
default: 'kratix'
4145

4246
runs:
4347
using: 'composite'
@@ -74,6 +78,28 @@ runs:
7478
check-latest: true
7579
cache-dependency-path: ${{ inputs.path }}/go.sum
7680

81+
- name: Prepare cache control variables
82+
shell: bash
83+
run: |
84+
cd "${{ inputs.tools_base_path }}"
85+
echo "KUSTOMIZE_VERSION=$(grep -E '^KUSTOMIZE_VERSION[[:space:]]*\?=' Makefile | tail -n1 | awk '{print $3}')" >> "$GITHUB_ENV"
86+
echo "CONTROLLER_TOOLS_VERSION=$(grep -E '^CONTROLLER_TOOLS_VERSION[[:space:]]*\?=' Makefile | tail -n1 | awk '{print $3}')" >> "$GITHUB_ENV"
87+
88+
- name: Cache build tools
89+
uses: actions/cache@v4
90+
with:
91+
path: |
92+
${{ inputs.tools_base_path }}/bin/kustomize*
93+
${{ inputs.tools_base_path }}/bin/controller-gen*
94+
key: ${{ runner.os }}-kratix-tools-${{ env.KUSTOMIZE_VERSION }}-${{ env.CONTROLLER_TOOLS_VERSION }}
95+
96+
- name: Install build tools
97+
shell: bash
98+
run: |
99+
cd "${{ inputs.tools_base_path }}"
100+
make controller-gen
101+
make kustomize
102+
77103
- name: Install Kind
78104
uses: helm/kind-action@v1
79105
with:

.github/workflows/test-ske.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
submodule_repository: syntasso/kratix
4747
submodule_ref: ${{ github.event.inputs.sha }}
4848
submodule_path: enterprise-kratix/read-only-kratix
49+
tools_base_path: enterprise-kratix/read-only-kratix
4950
ssh_session: ${{ github.event.inputs.ssh_session }}
5051
- name: Quick start tests
5152
env:
@@ -73,6 +74,7 @@ jobs:
7374
submodule_repository: syntasso/kratix
7475
submodule_ref: ${{ github.event.inputs.sha }}
7576
submodule_path: enterprise-kratix/read-only-kratix
77+
tools_base_path: enterprise-kratix/read-only-kratix
7678
ssh_session: ${{ github.event.inputs.ssh_session }}
7779
- name: Install vCluster CLI
7880
uses: loft-sh/setup-vcluster@main
@@ -102,6 +104,7 @@ jobs:
102104
submodule_repository: syntasso/kratix
103105
submodule_ref: ${{ github.event.inputs.sha }}
104106
submodule_path: enterprise-kratix/read-only-kratix
107+
tools_base_path: enterprise-kratix/read-only-kratix
105108
ssh_session: ${{ github.event.inputs.ssh_session }}
106109
- name: Setup Backstage Environment
107110
uses: ./.github/actions/setup-backstage
@@ -139,6 +142,7 @@ jobs:
139142
submodule_repository: syntasso/kratix
140143
submodule_ref: ${{ github.event.inputs.sha }}
141144
submodule_path: enterprise-kratix/read-only-kratix
145+
tools_base_path: enterprise-kratix/read-only-kratix
142146
ssh_session: ${{ github.event.inputs.ssh_session }}
143147
- name: Run make test-e2e-ci
144148
run: |

0 commit comments

Comments
 (0)