Skip to content

Commit 3f4d5d0

Browse files
committed
refactor(ci): extract ccache setup into reusable composite action
Extract the repeated ccache install/cache/configure steps from all CI workflows into a single composite action at .github/actions/setup-ccache. This eliminates configuration drift by centralizing: - ccache installation via apt-get - Cache restore/save via actions/cache@v4 with branch-aware keys - ccache configuration via ci/scripts/setup_ccache.sh Updated workflows: - gcc_test.yaml - clang_test.yaml - gcc8_test.yaml - test_with_sanitizer.yaml - build_release.yaml (both clang-release and gcc-release jobs)
1 parent 6fbbfbf commit 3f4d5d0

6 files changed

Lines changed: 54 additions & 59 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2026-present Alibaba Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Setup ccache
16+
description: Install, configure and cache ccache for CI builds
17+
18+
inputs:
19+
cache-key-prefix:
20+
description: Prefix for the cache key (e.g., ccache-gcc-test)
21+
required: true
22+
23+
runs:
24+
using: composite
25+
steps:
26+
- name: Install ccache
27+
shell: bash
28+
run: sudo apt-get update && sudo apt-get install -y ccache
29+
30+
- name: Restore ccache
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.ccache
34+
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-${{ github.ref_name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
35+
restore-keys: |
36+
${{ inputs.cache-key-prefix }}-${{ runner.os }}-${{ github.ref_name }}-
37+
${{ inputs.cache-key-prefix }}-${{ runner.os }}-
38+
39+
- name: Configure ccache
40+
shell: bash
41+
run: ${{ github.workspace }}/ci/scripts/setup_ccache.sh

.github/workflows/build_release.yaml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ jobs:
4040
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4141
with:
4242
lfs: true
43-
- name: Install ccache
44-
run: sudo apt-get update && sudo apt-get install -y ccache
4543
- name: Setup ccache
46-
uses: actions/cache@v4
44+
uses: ./.github/actions/setup-ccache
4745
with:
48-
path: ~/.ccache
49-
key: ccache-clang-release-${{ runner.os }}-${{ github.ref_name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
50-
restore-keys: |
51-
ccache-clang-release-${{ runner.os }}-${{ github.ref_name }}-
52-
ccache-clang-release-${{ runner.os }}-
53-
- name: Configure ccache
54-
run: ci/scripts/setup_ccache.sh
46+
cache-key-prefix: ccache-clang-release
5547
- name: Build Paimon
5648
shell: bash
5749
env:
@@ -71,18 +63,10 @@ jobs:
7163
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
7264
with:
7365
lfs: true
74-
- name: Install ccache
75-
run: sudo apt-get update && sudo apt-get install -y ccache
7666
- name: Setup ccache
77-
uses: actions/cache@v4
67+
uses: ./.github/actions/setup-ccache
7868
with:
79-
path: ~/.ccache
80-
key: ccache-gcc-release-${{ runner.os }}-${{ github.ref_name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
81-
restore-keys: |
82-
ccache-gcc-release-${{ runner.os }}-${{ github.ref_name }}-
83-
ccache-gcc-release-${{ runner.os }}-
84-
- name: Configure ccache
85-
run: ci/scripts/setup_ccache.sh
69+
cache-key-prefix: ccache-gcc-release
8670
- name: Build Paimon
8771
shell: bash
8872
env:

.github/workflows/clang_test.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,10 @@ jobs:
4141
with:
4242
lfs: true
4343
fetch-depth: 0 # fetch all history for git diff in clang-tidy
44-
- name: Install ccache
45-
run: sudo apt-get update && sudo apt-get install -y ccache
4644
- name: Setup ccache
47-
uses: actions/cache@v4
45+
uses: ./.github/actions/setup-ccache
4846
with:
49-
path: ~/.ccache
50-
key: ccache-clang-test-${{ runner.os }}-${{ github.ref_name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
51-
restore-keys: |
52-
ccache-clang-test-${{ runner.os }}-${{ github.ref_name }}-
53-
ccache-clang-test-${{ runner.os }}-
54-
- name: Configure ccache
55-
run: ci/scripts/setup_ccache.sh
47+
cache-key-prefix: ccache-clang-test
5648
- name: Build Paimon
5749
shell: bash
5850
env:

.github/workflows/gcc8_test.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Install dependencies
4343
run: |
4444
apt-get update
45-
DEBIAN_FRONTEND=noninteractive apt-get install -y gcc-8 g++-8 ninja-build git git-lfs tar curl tzdata zip unzip pkg-config build-essential python3-dev gdb ccache
45+
DEBIAN_FRONTEND=noninteractive apt-get install -y gcc-8 g++-8 ninja-build git git-lfs tar curl tzdata zip unzip pkg-config build-essential python3-dev gdb
4646
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.tar.gz
4747
tar -zxvf cmake-3.28.3-linux-x86_64.tar.gz -C /usr/local --strip-components=1
4848
rm cmake-3.28.3-linux-x86_64.tar.gz
@@ -60,15 +60,9 @@ jobs:
6060
with:
6161
lfs: true
6262
- name: Setup ccache
63-
uses: actions/cache@v4
63+
uses: ./.github/actions/setup-ccache
6464
with:
65-
path: ~/.ccache
66-
key: ccache-gcc8-test-${{ runner.os }}-${{ github.ref_name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
67-
restore-keys: |
68-
ccache-gcc8-test-${{ runner.os }}-${{ github.ref_name }}-
69-
ccache-gcc8-test-${{ runner.os }}-
70-
- name: Configure ccache
71-
run: ci/scripts/setup_ccache.sh
65+
cache-key-prefix: ccache-gcc8-test
7266
- name: Build Paimon
7367
shell: bash
7468
env:

.github/workflows/gcc_test.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ jobs:
4040
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4141
with:
4242
lfs: true
43-
- name: Install ccache
44-
run: sudo apt-get update && sudo apt-get install -y ccache
4543
- name: Setup ccache
46-
uses: actions/cache@v4
44+
uses: ./.github/actions/setup-ccache
4745
with:
48-
path: ~/.ccache
49-
key: ccache-gcc-test-${{ runner.os }}-${{ github.ref_name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
50-
restore-keys: |
51-
ccache-gcc-test-${{ runner.os }}-${{ github.ref_name }}-
52-
ccache-gcc-test-${{ runner.os }}-
53-
- name: Configure ccache
54-
run: ci/scripts/setup_ccache.sh
46+
cache-key-prefix: ccache-gcc-test
5547
- name: Build Paimon
5648
shell: bash
5749
env:

.github/workflows/test_with_sanitizer.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ jobs:
4040
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4141
with:
4242
lfs: true
43-
- name: Install ccache
44-
run: sudo apt-get update && sudo apt-get install -y ccache
4543
- name: Setup ccache
46-
uses: actions/cache@v4
44+
uses: ./.github/actions/setup-ccache
4745
with:
48-
path: ~/.ccache
49-
key: ccache-sanitizer-${{ runner.os }}-${{ github.ref_name }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
50-
restore-keys: |
51-
ccache-sanitizer-${{ runner.os }}-${{ github.ref_name }}-
52-
ccache-sanitizer-${{ runner.os }}-
53-
- name: Configure ccache
54-
run: ci/scripts/setup_ccache.sh
46+
cache-key-prefix: ccache-sanitizer
5547
- name: Build Paimon
5648
shell: bash
5749
env:

0 commit comments

Comments
 (0)