Skip to content

Commit eb9d44b

Browse files
committed
ci: add ccache for riscv64 without overriding pyproject.toml env
Use symlink-based ccache (ln -sf ccache /usr/local/bin/gcc) instead of CIBW_ENVIRONMENT_LINUX which clobbers PKG_CONFIG_PATH and RUNNER_OS needed for openblas detection. Mount ccache dir via CIBW_CONTAINER_ENGINE. Signed-off-by: Bruno Verachten <gounthar@gmail.com>
1 parent 576e4fb commit eb9d44b

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/wheels.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,29 @@ jobs:
111111
env:
112112
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
113113

114+
- name: Restore ccache for riscv64
115+
if: matrix.buildplat[1] == 'manylinux_riscv64'
116+
uses: actions/cache@v4
117+
with:
118+
path: .ccache
119+
key: ccache-riscv64-${{ matrix.python }}-${{ github.sha }}
120+
restore-keys: |
121+
ccache-riscv64-${{ matrix.python }}-
122+
114123
- name: Build wheels (riscv64)
115124
if: matrix.buildplat[1] == 'manylinux_riscv64'
116-
run: python3 -m cibuildwheel --output-dir wheelhouse
125+
run: |
126+
mkdir -p ${{ github.workspace }}/.ccache
127+
python3 -m cibuildwheel --output-dir wheelhouse
117128
env:
118129
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
130+
CIBW_BEFORE_ALL_LINUX: >
131+
yum install -y ccache || true &&
132+
ln -sf $(which ccache) /usr/local/bin/gcc &&
133+
ln -sf $(which ccache) /usr/local/bin/g++ &&
134+
ln -sf $(which ccache) /usr/local/bin/cc &&
135+
ln -sf $(which ccache) /usr/local/bin/c++
136+
CIBW_CONTAINER_ENGINE: "docker; create_args: --volume=${{ github.workspace }}/.ccache:/root/.cache/ccache"
119137
CIBW_TEST_COMMAND: "python -c \"import numpy; print(numpy.__version__); numpy.show_config()\""
120138

121139
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0

0 commit comments

Comments
 (0)