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

use caching in github actions workflows #262

Closed
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
20 changes: 16 additions & 4 deletions .github/workflows/pull-with-lifecycle-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ env:

on:
pull_request:
branches: [ "main" ]
branches: ["main"]
paths-ignore:
- 'docs/**'
- '**.md'
- 'sec-scanners-config.yaml'
- "docs/**"
- "**.md"
- "sec-scanners-config.yaml"

jobs:
e2e:
Expand All @@ -21,6 +21,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache Go dependencies
uses: actions/setup-go@v5
with:
go-version-file: "./go.mod"
muralov marked this conversation as resolved.
Show resolved Hide resolved

- name: Cache Binaries
id: cache-binaries
uses: actions/cache@v3
with:
path: bin
key: ${{ runner.os }}-bin
Comment on lines +29 to +34
Copy link
Contributor

@muralov muralov Dec 19, 2023

Choose a reason for hiding this comment

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

it seems the key is always same although binary is built newly. I've read the GH action documentation that the binary is only built only if key is different than previous key. However, here ${{ runner.os }}-bin is the same for the same OS although the code is changed.
Can you clarify this?


- name: Install k3d tools
run: |
make -C hack/ci/ install-k3d-tools
Expand Down
34 changes: 19 additions & 15 deletions .github/workflows/pull-without-lifecycle-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ env:

on:
pull_request:
branches: [ "main" ]
branches: ["main"]
paths-ignore:
- 'docs/**'
- '**.md'
- 'sec-scanners-config.yaml'
- "docs/**"
- "**.md"
- "sec-scanners-config.yaml"

jobs:
e2e:
Expand All @@ -24,9 +24,14 @@ jobs:
- name: Cache Go dependencies
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
check-latest: true
cache-dependency-path: './go.sum'
go-version-file: "./go.mod"

- name: Cache Binaries
id: cache-binaries
uses: actions/cache@v3
with:
path: bin
key: ${{ runner.os }}-bin

- name: Install k3d tools
run: |
Expand Down Expand Up @@ -82,36 +87,35 @@ jobs:
run: |
make e2e-cleanup


# the following steps only run on failure to help finding the cause of the failure
# the following steps only run on failure to help finding the cause of the failure

- name: List CRDs
if: failure()
if: failure()
run: |
kubectl get crd

- name: List Namespaces
if: failure()
if: failure()
run: |
kubectl get namespaces

- name: List StatefulSets
if: failure()
if: failure()
run: |
kubectl get sts --all-namespaces

- name: List Pods
if: failure()
if: failure()
run: |
kubectl get po --all-namespaces

- name: List PVCs
if: failure()
if: failure()
run: |
kubectl get pvc --all-namespaces

- name: List NATS CR
if: failure()
if: failure()
run: |
kubectl get nats --all-namespaces

Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/push-with-lifecycle-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ env:

on:
push:
branches: [ "main" ]
branches: ["main"]
paths-ignore:
- 'docs/**'
- '**.md'
- 'sec-scanners-config.yaml'
- "docs/**"
- "**.md"
- "sec-scanners-config.yaml"

jobs:
e2e:
Expand All @@ -21,6 +21,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache Go dependencies
uses: actions/setup-go@v5
with:
go-version-file: "./go.mod"

- name: Cache Binaries
id: cache-binaries
uses: actions/cache@v3
with:
path: bin
key: ${{ runner.os }}-bin

- name: Install k3d tools
run: |
make -C hack/ci/ install-k3d-tools
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/test.yml → .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ on:
branches:
- main
paths-ignore:
- 'docs/**'
- '**.md'
- 'sec-scanners-config.yaml'
- "docs/**"
- "**.md"
- "sec-scanners-config.yaml"

push:
branches:
- main
paths-ignore:
- 'docs/**'
- '**.md'
- 'sec-scanners-config.yaml'
- "docs/**"
- "**.md"
- "sec-scanners-config.yaml"

permissions:
contents: read
Expand All @@ -32,7 +32,14 @@ jobs:
- name: Cache Go dependencies
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version-file: "./go.mod"
Copy link
Contributor

@muralov muralov Dec 19, 2023

Choose a reason for hiding this comment

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

👍🏼


- name: Cache Binaries
id: cache-binaries
uses: actions/cache@v3
with:
path: bin
key: ${{ runner.os }}-bin

- name: Execute unit test
run: make test
Loading