Skip to content

Commit 7b5ec9b

Browse files
committed
Disable cache on nightly and clear cache every week
Closes #GSK-1774
1 parent 1ecb78c commit 7b5ec9b

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

.github/workflows/build_backend.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ on:
1414
required: true
1515
type: boolean
1616
default: false
17+
use-cache:
18+
description: 'If cache should be used'
19+
required: true
20+
type: boolean
21+
default: true
1722
workflow_call:
1823
inputs:
1924
run-integration-tests:
2025
description: 'If integration test should be run'
2126
required: true
2227
type: boolean
2328
default: false
29+
use-cache:
30+
description: 'If cache should be used'
31+
required: true
32+
type: boolean
33+
default: false
2434
env:
2535
GSK_DISABLE_ANALYTICS: true
2636
defaults:
@@ -77,10 +87,12 @@ jobs:
7787
- name: Setup Gradle # To cache ~/.gradle
7888
uses: gradle/gradle-build-action@v2
7989
with:
90+
cache-disabled: ${{ github.event_name != 'pull_request' && !inputs.use-cache }}
8091
cache-read-only: false
8192

8293
- name: Cache SonarQube packages
8394
uses: actions/cache@v3
95+
if: ${{ github.event_name == 'pull_request' || inputs.use-cache }}
8496
with:
8597
path: ~/.sonar/cache
8698
key: ${{ runner.os }}-sonar
@@ -112,10 +124,12 @@ jobs:
112124
- name: Setup Gradle # To cache ~/.gradle
113125
uses: gradle/gradle-build-action@v2
114126
with:
127+
cache-disabled: ${{ github.event_name != 'pull_request' && !inputs.use-cache }}
115128
cache-read-only: false
116129

117130
- name: Cache Frontend dependencies
118131
uses: actions/cache@v3
132+
if: ${{ github.event_name == 'pull_request' || inputs.use-cache }}
119133
with:
120134
path: frontend/node_modules
121135
key: ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json')}}
@@ -168,6 +182,7 @@ jobs:
168182

169183
- name: Cache Python deps
170184
uses: actions/cache@v3
185+
if: ${{ github.event_name == 'pull_request' || inputs.use-cache }}
171186
with:
172187
path: python-client/.venv
173188
key: ${{ matrix.os }}-${{ matrix.python-version }}-python-deps-${{ hashFiles('python-client/tests/fixtures/**/*py')}}
@@ -186,6 +201,7 @@ jobs:
186201

187202
- name: Cache Giskard test resources
188203
uses: actions/cache@v3
204+
if: ${{ github.event_name == 'pull_request' || inputs.use-cache }}
189205
with:
190206
path: ~/.giskard
191207
key: ${{ matrix.os }}-${{ matrix.python-version }}-python-test-resources-${{ hashFiles('python-client/tests/fixtures/**/*py')}}

.github/workflows/clear-cache.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Clear all caches
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 * * 0' # Every week
6+
7+
permissions:
8+
actions: write
9+
10+
jobs:
11+
clear:
12+
name: Clear all cache
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Clear cache
16+
run: gh cache delete --all
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/nightly-test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ jobs:
88
call-full-ci:
99
uses: ./.github/workflows/build_backend.yml
1010
with:
11-
run-integration-tests: true
11+
run-integration-tests: true
12+
use-cache: false

0 commit comments

Comments
 (0)