Unverified Commit 4bd45c57 authored by Denis_P's avatar Denis_P 👙 Committed by GitHub

cache prepopulation (#386)

* test (ci): cache prepopulation with debug info

* test (ci): remove CARGO_HOME caching

* test (ci): fix x mode for the script

* change (ci): undebug
parent ce29733a
Pipeline #90279 passed with stages
in 13 minutes and 33 seconds
......@@ -14,7 +14,6 @@ stages:
variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 100
CARGO_HOME: "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}"
CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
CI_SERVER_NAME: "GitLab CI"
REGISTRY: registry.parity.io/parity/infrastructure/scripts
......@@ -35,15 +34,7 @@ variables:
- rustc -vV
- rustup show
- bash --version
# if there is no directory for this $CI_COMMIT_REF_NAME/$CI_JOB_NAME
# create such directory and
# create hardlinks recursively of all the files from the master/$CI_JOB_NAME if it exists
- if [[ ! -d $CARGO_TARGET_DIR ]]; then
mkdir -p /ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME};
cp -al /ci-cache/${CI_PROJECT_NAME}/targets/${CI_DEFAULT_BRANCH}/${CI_JOB_NAME}
/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME} ||
echo "_____No such target dir, proceeding from scratch_____";
fi
- ./scripts/pre_cache.sh
- sccache -s
only:
- master
......
#!/bin/bash
set -u
# if there is no directory for this $CI_COMMIT_REF_NAME/$CI_JOB_NAME
# create such directory and
# copy recursively all the files from the newest dir which has $CI_JOB_NAME, if it exists
if [[ ! -d $CARGO_TARGET_DIR ]]; then
mkdir -p "/ci-cache/$CI_PROJECT_NAME/targets/$CI_COMMIT_REF_NAME";
FRESH_CACHE=$(find "/ci-cache/$CI_PROJECT_NAME/targets" -mindepth 2 -maxdepth 2 \
-type d -name "$CI_JOB_NAME" -exec stat --printf="%Y\t%n\n" {} \; |sort -n -r |head -1 |cut -f2);
if [[ -d $FRESH_CACHE ]]; then
echo "____Using" "$FRESH_CACHE" "to prepopulate the cache____";
time cp -r "$FRESH_CACHE" "$CARGO_TARGET_DIR";
else
echo "_____No such targets dir, proceeding from scratch_____";
fi
else
echo "____No need to prepopulate CARGO_TARGET_DIR cache____";
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment