@@ -251,29 +251,6 @@ def check(name: str, command: str, paths: t.Set[str]) -> None:
251
251
252
252
def gen_build_base_venvs () -> None :
253
253
"""Generate the list of base jobs for building virtual environments."""
254
- output = subprocess .check_output ([sys .executable , ROOT / "setup.py" , "ext_hashes" , "--inplace" ])
255
- cached_files = []
256
- for line in output .decode ().splitlines ():
257
- if not line .startswith ("#EXTHASH:" ):
258
- continue
259
- ext_name , ext_hash , ext_target = eval (line .split (":" , 1 )[- 1 ].strip ())
260
- cached_files .append ((f".ext_cache/{ ext_name } /{ ext_hash } /{ Path (ext_target ).name } " , ext_target ))
261
-
262
- restore_ext_cache = "\n " .join (
263
- [
264
- f" test -f { cached_file } && (cp { cached_file } { dest } && touch { dest } "
265
- f"&& echo 'Restored { cached_file } -> { dest } ') || true"
266
- for cached_file , dest in cached_files
267
- ]
268
- )
269
-
270
- save_ext_cache = "\n " .join (
271
- [
272
- f" test -f { cached_file } || mkdir -p { Path (cached_file ).parent } && (cp { dest } { cached_file } "
273
- f"&& echo 'Saved { dest } -> { cached_file } ' || true)"
274
- for cached_file , dest in cached_files
275
- ]
276
- )
277
254
278
255
current_month = datetime .datetime .now ().month
279
256
@@ -297,6 +274,7 @@ def gen_build_base_venvs() -> None:
297
274
DD_FAST_BUILD: '1'
298
275
DD_CMAKE_INCREMENTAL_BUILD: '1'
299
276
DD_SETUP_CACHE_DOWNLOADS: '1'
277
+ EXT_CACHE_VENV: '${{CI_PROJECT_DIR}}/.cache/ext_cache_venv'
300
278
rules:
301
279
- if: '$CI_COMMIT_REF_NAME == "main"'
302
280
variables:
@@ -306,11 +284,20 @@ def gen_build_base_venvs() -> None:
306
284
set -e -o pipefail
307
285
apt update && apt install -y sccache
308
286
pip install riot==0.20.1
309
- { restore_ext_cache }
287
+ if [ ! -d $EXT_CACHE_VENV ]; then
288
+ python$PYTHON_VERSION -m venv $EXT_CACHE_VENV
289
+ source $EXT_CACHE_VENV/bin/activate
290
+ pip install cmake setuptools_rust Cython
291
+ else
292
+ source $EXT_CACHE_VENV/bin/activate
293
+ fi
294
+ python scripts/gen_ext_cache_scripts.py
295
+ deactivate
296
+ $SHELL scripts/restore-ext-cache.sh
310
297
riot -P -v generate --python=$PYTHON_VERSION
311
298
echo "Running smoke tests"
312
299
riot -v run -s --python=$PYTHON_VERSION smoke_test
313
- { save_ext_cache }
300
+ $SHELL scripts/save-ext-cache.sh
314
301
cache:
315
302
# Share pip/sccache between jobs of the same Python version
316
303
- key: v1-build_base_venvs-${{PYTHON_VERSION}}-cache-{ current_month }
@@ -325,6 +312,8 @@ def gen_build_base_venvs() -> None:
325
312
artifacts:
326
313
name: venv_$PYTHON_VERSION
327
314
paths:
315
+ - scripts/restore-ext-cache.sh
316
+ - scripts/save-ext-cache.sh
328
317
- ddtrace/**/*.so*
329
318
- ddtrace/internal/datadog/profiling/crashtracker/crashtracker_exe*
330
319
- ddtrace/internal/datadog/profiling/test/test_*
0 commit comments