Skip to content

Commit

Permalink
feat(ci): add support to cache tools in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Vibhu Prashar <vibhu.sharma2929@gmail.com>
  • Loading branch information
vprashar2929 committed Oct 16, 2023
1 parent 61f220b commit 84fe777
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/publish-images/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ runs:
username: ${{ inputs.registry_login }}
password: ${{ inputs.registry_token }}

- name: Install all tools
uses: ./.github/tools-cache

- name: Build Operator
shell: bash
run: |
Expand Down
21 changes: 21 additions & 0 deletions .github/tools-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: tools-cache
description: Caches development tools
runs:
using: composite
steps:
- uses: actions/cache@v3
id: tools-cache
with:
path: ./tmp/bin
key: ${{ runner.os }}-tools-${{ hashFiles('./.github/tools-cache') }}

- name: Install Dependencies
if: steps.tools-cache.outputs.cache-hit != 'true'
shell: bash
run: make tools

- name: List tools installed
shell: bash
run: |
ls ./tmp/bin
10 changes: 9 additions & 1 deletion .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ jobs:
- uses: actions/setup-go@main
with:
go-version-file: go.mod

- name: Install all tools
uses: ./.github/tools-cache

- name: bundle
run: |
make generate manifests bundle
Expand All @@ -101,6 +105,9 @@ jobs:
run: |
echo "result=$(git rev-parse --short HEAD),v1alpha1" >> $GITHUB_OUTPUT
- name: Install all tools
uses: ./.github/tools-cache

- name: build images for PR checks
uses: ./.github/publish-images
with:
Expand Down Expand Up @@ -128,7 +135,8 @@ jobs:
go-version-file: go.mod

- name: Install all tools
run: make tools
uses: ./.github/tools-cache

- name: use kepler action for kind cluster build
uses: sustainable-computing-io/kepler-action@v0.0.2
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ jobs:
env:
VERSION: ${{ github.event.inputs.tag }}

- name: Install all tools
uses: ./.github/tools-cache

- name: Build Operator
run: |
make operator-build
Expand Down

0 comments on commit 84fe777

Please sign in to comment.