Skip to content

Commit 408b778

Browse files
committed
[CI] enable ccache
1 parent 2053720 commit 408b778

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/python-build/action.yml

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ inputs:
2727
default: 'sudo'
2828
description: >
2929
The sudo argument to use. Set to '' if already running as root.
30+
ccache:
31+
required: false
32+
default: ''
33+
description: >
34+
The ccache program to use during the build.
3035
3136
runs:
3237
using: composite
@@ -157,3 +162,6 @@ runs:
157162
-C local="${{ github.workspace }}/scripts/ci/py-build-cmake.toml" \
158163
-C cross=/opt/x-tools/${{ inputs.host }}.${{ inputs.python-version }}.py-build-cmake.cross.toml \
159164
-C cross=conan-py-build-cmake.cross.pbc
165+
env:
166+
CMAKE_C_COMPILER_LAUNCHER: ${{ inputs.ccache }}
167+
CMAKE_CXX_COMPILER_LAUNCHER: ${{ inputs.ccache }}

.github/workflows/wheel.yml

+37
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,25 @@ jobs:
2323
strategy:
2424
matrix:
2525
python-version: ['3.13']
26+
env:
27+
CCACHE_DIR: ${{ github.workspace }}/.ccache
2628
steps:
2729
- name: Checkout
2830
uses: actions/checkout@v4
2931

32+
# Ccache
33+
- name: Install ccache
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y ccache
37+
mkdir -p "${{ env.CCACHE_DIR }}"
38+
- name: Cache ccache
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ env.CCACHE_DIR }}
42+
key: ${{ runner.os }}-wheel-native-ccache-${{ github.run_id }}
43+
restore-keys: ${{ runner.os }}-wheel-native-ccache
44+
3045
- name: Install Python
3146
uses: actions/setup-python@v5
3247
with:
@@ -72,6 +87,9 @@ jobs:
7287
7388
- name: Build Wheel package
7489
run: python3 -m build -w -C local="scripts/ci/py-build-cmake.toml"
90+
env:
91+
CMAKE_C_COMPILER_LAUNCHER: ccache
92+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
7593
- name: Upload Wheel
7694
uses: actions/upload-artifact@v4
7795
with:
@@ -95,6 +113,9 @@ jobs:
95113
done < build/python-debug/install_manifest_python_modules.txt
96114
while IFS= read -r f || [ -n "$f" ]; do rm -f "$f"
97115
done < build/python-release/install_manifest_python_modules.txt
116+
env:
117+
CMAKE_C_COMPILER_LAUNCHER: ccache
118+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
98119
- name: Create sdist
99120
run: python3 -m build -s
100121

@@ -142,10 +163,25 @@ jobs:
142163
python-version:
143164
- python3.13
144165
- pypy3.10-v7.3
166+
env:
167+
CCACHE_DIR: ${{ github.workspace }}/.ccache
145168
steps:
146169
- name: Checkout
147170
uses: actions/checkout@v4
148171

172+
# Ccache
173+
- name: Install ccache
174+
run: |
175+
sudo apt-get update
176+
sudo apt-get install -y ccache
177+
mkdir -p "${{ env.CCACHE_DIR }}"
178+
- name: Cache ccache
179+
uses: actions/cache@v4
180+
with:
181+
path: ${{ env.CCACHE_DIR }}
182+
key: ${{ runner.os }}-wheel-${{ matrix.host }}-${{ matrix.python-version }}-ccache-${{ github.run_id }}
183+
restore-keys: ${{ runner.os }}-wheel-${{ matrix.host }}-${{ matrix.python-version }}-ccache
184+
149185
- name: Download sdist
150186
uses: actions/download-artifact@v4
151187
with:
@@ -160,6 +196,7 @@ jobs:
160196
source-dir: sdist
161197
host: ${{ matrix.host }}
162198
python-version: ${{ matrix.python-version }}
199+
ccache: ccache
163200

164201
- name: Upload package
165202
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)