Skip to content

Commit

Permalink
[CI] enable ccache
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Dec 2, 2024
1 parent 2053720 commit 408b778
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/python-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ inputs:
default: 'sudo'
description: >
The sudo argument to use. Set to '' if already running as root.
ccache:
required: false
default: ''
description: >
The ccache program to use during the build.
runs:
using: composite
Expand Down Expand Up @@ -157,3 +162,6 @@ runs:
-C local="${{ github.workspace }}/scripts/ci/py-build-cmake.toml" \
-C cross=/opt/x-tools/${{ inputs.host }}.${{ inputs.python-version }}.py-build-cmake.cross.toml \
-C cross=conan-py-build-cmake.cross.pbc
env:
CMAKE_C_COMPILER_LAUNCHER: ${{ inputs.ccache }}
CMAKE_CXX_COMPILER_LAUNCHER: ${{ inputs.ccache }}
37 changes: 37 additions & 0 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,25 @@ jobs:
strategy:
matrix:
python-version: ['3.13']
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
steps:
- name: Checkout
uses: actions/checkout@v4

# Ccache
- name: Install ccache
run: |
sudo apt-get update
sudo apt-get install -y ccache
mkdir -p "${{ env.CCACHE_DIR }}"
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-wheel-native-ccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-wheel-native-ccache

- name: Install Python
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -72,6 +87,9 @@ jobs:
- name: Build Wheel package
run: python3 -m build -w -C local="scripts/ci/py-build-cmake.toml"
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
Expand All @@ -95,6 +113,9 @@ jobs:
done < build/python-debug/install_manifest_python_modules.txt
while IFS= read -r f || [ -n "$f" ]; do rm -f "$f"
done < build/python-release/install_manifest_python_modules.txt
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- name: Create sdist
run: python3 -m build -s

Expand Down Expand Up @@ -142,10 +163,25 @@ jobs:
python-version:
- python3.13
- pypy3.10-v7.3
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
steps:
- name: Checkout
uses: actions/checkout@v4

# Ccache
- name: Install ccache
run: |
sudo apt-get update
sudo apt-get install -y ccache
mkdir -p "${{ env.CCACHE_DIR }}"
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-wheel-${{ matrix.host }}-${{ matrix.python-version }}-ccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-wheel-${{ matrix.host }}-${{ matrix.python-version }}-ccache

- name: Download sdist
uses: actions/download-artifact@v4
with:
Expand All @@ -160,6 +196,7 @@ jobs:
source-dir: sdist
host: ${{ matrix.host }}
python-version: ${{ matrix.python-version }}
ccache: ccache

- name: Upload package
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 408b778

Please sign in to comment.