Skip to content

Commit 4f7b55a

Browse files
authored
[github] Use month-based key for ccache cache (#16450)
This commit updates gitHub workflow ccache cache keys to use month-based (YYMM) identifiers instead of unique commit SHA. This will reduce cache updates to montly and remove duplicated cache storages for same workflow. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
1 parent 6ae5344 commit 4f7b55a

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.github/workflows/run-onecc-build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ jobs:
9292
path: ${{ env.NNCC_WORKSPACE }}/overlay
9393
key: overlay-onecc-${{ matrix.ubuntu_code }}-${{ hashFiles('compiler/common-artifacts/CMakeLists.txt') }}-${{ hashFiles('infra/cmake/packages/**/*.cmake') }}
9494

95+
- name: Get month for ccache cache key
96+
id: get-month
97+
run: echo "key_month=$(date +%y%m)" >> "$GITHUB_OUTPUT"
98+
9599
- name: Restore ccache cache
96100
uses: actions/cache/restore@v4
97101
id: ccache-cache
98102
with:
99103
path: ~/.cache/ccache
100-
key: ccache-onecc-${{ matrix.ubuntu_code }}-${{ matrix.type }}-${{ github.sha }}
104+
key: ccache-onecc-${{ matrix.ubuntu_code }}-${{ matrix.type }}-${{ steps.get-month.outputs.key_month }}
101105
restore-keys: |
102106
ccache-onecc-${{ matrix.ubuntu_code }}-${{ matrix.type }}
103107

.github/workflows/run-onert-android-build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ jobs:
7272
restore-keys: |
7373
external-onert-ndk-
7474
75+
- name: Get month for ccache cache key
76+
id: get-month
77+
run: echo "key_month=$(date +%y%m)" >> "$GITHUB_OUTPUT"
78+
7579
- name: Restore ccache cache
7680
uses: actions/cache/restore@v4
7781
id: cache-ccache
7882
with:
7983
path: ~/.cache/ccache
80-
key: ccache-onert-android-${{ github.sha }}
84+
key: ccache-onert-android-${{ steps.get-month.outputs.key_month }}
8185
restore-keys: |
8286
ccache-onert-android
8387

.github/workflows/run-onert-cross-build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,16 @@ jobs:
8080
restore-keys: |
8181
external-onert-${{ matrix.ubuntu_code }}-
8282
83+
- name: Get month for ccache cache key
84+
id: get-month
85+
run: echo "key_month=$(date +%y%m)" >> "$GITHUB_OUTPUT"
86+
8387
- name: Restore ccache cache
8488
uses: actions/cache/restore@v4
8589
id: ccache-cache
8690
with:
8791
path: ~/.cache/ccache
88-
key: ccache-onert-${{ matrix.ubuntu_code }}-${{ matrix.arch }}-${{ matrix.type }}-${{ github.sha }}
92+
key: ccache-onert-${{ matrix.ubuntu_code }}-${{ matrix.arch }}-${{ matrix.type }}-${{ steps.get-month.outputs.key_month }}
8993
restore-keys: |
9094
ccache-onert-${{ matrix.ubuntu_code }}-${{ matrix.arch }}-${{ matrix.type }}
9195

.github/workflows/run-onert-native-build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,16 @@ jobs:
8383
restore-keys: |
8484
external-onert-${{ matrix.ubuntu_code }}-
8585
86+
- name: Get month for ccache cache key
87+
id: get-month
88+
run: echo "key_month=$(date +%y%m)" >> "$GITHUB_OUTPUT"
89+
8690
- name: Restore ccache cache
8791
uses: actions/cache/restore@v4
8892
id: ccache-cache
8993
with:
9094
path: ~/.cache/ccache
91-
key: ccache-onert-${{ matrix.ubuntu_code }}-${{ matrix.arch }}-${{ matrix.type }}-${{ github.sha }}
95+
key: ccache-onert-${{ matrix.ubuntu_code }}-${{ matrix.arch }}-${{ matrix.type }}-${{ steps.get-month.outputs.key_month }}
9296
restore-keys: |
9397
ccache-onert-${{ matrix.ubuntu_code }}-${{ matrix.arch }}-${{ matrix.type }}
9498

0 commit comments

Comments
 (0)