Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): add support to cache tools in CI #278

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought, perhaps we should move all actions to actions


- 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') }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to may be hash hack/tools.sh instead. What ObO does is to create a '.github/tools` file see: https://github.com/rhobs/observability-operator/blob/main/.github/tools
The hash of that file is used to check of new binaries need to be downloaded.


- 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