From 2a29c0a4a7bbc0991cf55d9ae14070edbd98c668 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 19 Dec 2023 12:11:00 +0100 Subject: [PATCH 1/2] use caching in github actions workflows --- .../pull-with-lifecycle-manager.yaml | 13 ++++++--- .../pull-without-lifecycle-manager.yml | 27 +++++++++---------- .../push-with-lifecycle-manager.yaml | 13 ++++++--- .../workflows/{test.yml => unit-tests.yml} | 14 +++++----- 4 files changed, 37 insertions(+), 30 deletions(-) rename .github/workflows/{test.yml => unit-tests.yml} (75%) diff --git a/.github/workflows/pull-with-lifecycle-manager.yaml b/.github/workflows/pull-with-lifecycle-manager.yaml index 00b210d9..7f8221c5 100644 --- a/.github/workflows/pull-with-lifecycle-manager.yaml +++ b/.github/workflows/pull-with-lifecycle-manager.yaml @@ -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: @@ -21,6 +21,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Cache Go dependencies + uses: actions/setup-go@v5 + with: + go-version-file: "./go.mod" + - name: Install k3d tools run: | make -C hack/ci/ install-k3d-tools diff --git a/.github/workflows/pull-without-lifecycle-manager.yml b/.github/workflows/pull-without-lifecycle-manager.yml index a51c9cd4..ceee1257 100644 --- a/.github/workflows/pull-without-lifecycle-manager.yml +++ b/.github/workflows/pull-without-lifecycle-manager.yml @@ -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: @@ -24,9 +24,7 @@ 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: Install k3d tools run: | @@ -82,36 +80,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 diff --git a/.github/workflows/push-with-lifecycle-manager.yaml b/.github/workflows/push-with-lifecycle-manager.yaml index 1c45fc6e..34f30268 100644 --- a/.github/workflows/push-with-lifecycle-manager.yaml +++ b/.github/workflows/push-with-lifecycle-manager.yaml @@ -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: @@ -21,6 +21,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Cache Go dependencies + uses: actions/setup-go@v5 + with: + go-version-file: "./go.mod" + - name: Install k3d tools run: | make -C hack/ci/ install-k3d-tools diff --git a/.github/workflows/test.yml b/.github/workflows/unit-tests.yml similarity index 75% rename from .github/workflows/test.yml rename to .github/workflows/unit-tests.yml index 52e212d1..c0180127 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/unit-tests.yml @@ -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 @@ -32,7 +32,7 @@ jobs: - name: Cache Go dependencies uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: "./go.mod" - name: Execute unit test run: make test From fd9b4c523b6bd7fe47a3d2450563b667a814a4e7 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 19 Dec 2023 12:17:41 +0100 Subject: [PATCH 2/2] cache binaries --- .github/workflows/pull-with-lifecycle-manager.yaml | 7 +++++++ .github/workflows/pull-without-lifecycle-manager.yml | 7 +++++++ .github/workflows/push-with-lifecycle-manager.yaml | 7 +++++++ .github/workflows/unit-tests.yml | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/.github/workflows/pull-with-lifecycle-manager.yaml b/.github/workflows/pull-with-lifecycle-manager.yaml index 7f8221c5..c0832f9b 100644 --- a/.github/workflows/pull-with-lifecycle-manager.yaml +++ b/.github/workflows/pull-with-lifecycle-manager.yaml @@ -26,6 +26,13 @@ jobs: 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 diff --git a/.github/workflows/pull-without-lifecycle-manager.yml b/.github/workflows/pull-without-lifecycle-manager.yml index ceee1257..b709df75 100644 --- a/.github/workflows/pull-without-lifecycle-manager.yml +++ b/.github/workflows/pull-without-lifecycle-manager.yml @@ -26,6 +26,13 @@ jobs: 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 diff --git a/.github/workflows/push-with-lifecycle-manager.yaml b/.github/workflows/push-with-lifecycle-manager.yaml index 34f30268..6779bd0d 100644 --- a/.github/workflows/push-with-lifecycle-manager.yaml +++ b/.github/workflows/push-with-lifecycle-manager.yaml @@ -26,6 +26,13 @@ jobs: 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 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index c0180127..133dcb12 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -34,5 +34,12 @@ jobs: with: go-version-file: "./go.mod" + - name: Cache Binaries + id: cache-binaries + uses: actions/cache@v3 + with: + path: bin + key: ${{ runner.os }}-bin + - name: Execute unit test run: make test