Skip to content

Commit f8b194a

Browse files
committed
ci: enable sccache in GHA build
1 parent 89d69bd commit f8b194a

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/build_python_3.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,27 @@ jobs:
9696
if [[ "$(uname -m)-$(uname -i)-$(uname -o | tr '[:upper:]' '[:lower:]')-$(ldd --version 2>&1 | head -n 1 | awk '{print $1}')" != "i686-unknown-linux-musl" ]]; then
9797
curl -sSf https://sh.rustup.rs | sh -s -- -y;
9898
fi
99-
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH CMAKE_BUILD_PARALLEL_LEVEL=24 CMAKE_ARGS="-DNATIVE_TESTING=OFF" SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DDTRACE=${{ needs.compute_version.outputs.library_version }}
99+
CIBW_ENVIRONMENT_LINUX: >
100+
PATH=$HOME/.cargo/bin:$PATH
101+
CARGO_BUILD_JOBS=24
102+
CMAKE_BUILD_PARALLEL_LEVEL=24
103+
CMAKE_ARGS="-DNATIVE_TESTING=OFF"
104+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DDTRACE=${{ needs.compute_version.outputs.library_version }}
105+
SCCACHE_GHA_ENABLED=true
106+
SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }}
107+
SCCACHE_PATH=/host/${{ env.SCCACHE_PATH }}
108+
SCCACHE_CACHE_SIZE=1G
109+
DD_USE_SCCACHE=1
100110
# SYSTEM_VERSION_COMPAT is a workaround for versioning issue, a.k.a.
101111
# `platform.mac_ver()` reports incorrect MacOS version at 11.0
102112
# See: https://stackoverflow.com/a/65402241
103-
CIBW_ENVIRONMENT_MACOS: CMAKE_BUILD_PARALLEL_LEVEL=24 SYSTEM_VERSION_COMPAT=0 CMAKE_ARGS="-DNATIVE_TESTING=OFF" SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DDTRACE=${{ needs.compute_version.outputs.library_version }}
104-
CIBW_ENVIRONMENT_WINDOWS: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DDTRACE=${{ needs.compute_version.outputs.library_version }}
113+
CIBW_ENVIRONMENT_MACOS: >
114+
CMAKE_BUILD_PARALLEL_LEVEL=24
115+
SYSTEM_VERSION_COMPAT=0
116+
CMAKE_ARGS="-DNATIVE_TESTING=OFF"
117+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DDTRACE=${{ needs.compute_version.outputs.library_version }}
118+
CIBW_ENVIRONMENT_WINDOWS: >
119+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DDTRACE=${{ needs.compute_version.outputs.library_version }}
105120
# cibuildwheel repair will copy anything's under /output directory from the
106121
# build container to the host machine. This is a bit hacky way, but seems
107122
# to be the only way getting debug symbols out from the container while
@@ -121,6 +136,7 @@ jobs:
121136
python scripts/zip_filter.py {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
122137
MACOSX_DEPLOYMENT_TARGET=12.7 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
123138
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: python scripts/zip_filter.py "{wheel}" "*.c" "*.cpp" "*.cc" "*.h" "*.hpp" "*.pyx" "*.md" && mv "{wheel}" "{dest_dir}"
139+
CIBW_BEFORE_TEST_LINUX: /host/${{ env.SCCACHE_PATH }} --show-stats
124140
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"
125141

126142
steps:
@@ -129,6 +145,9 @@ jobs:
129145
persist-credentials: false
130146
fetch-depth: 0
131147

148+
- name: Enable sccache
149+
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 0.0.9
150+
132151
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
133152
name: Install Python
134153
with:

0 commit comments

Comments
 (0)