message: now new branches' job hardlinks the same dir from master
diff: @@ -36,9 +36,17 @@ variables:
  - rustup show
  - bash --version
  - mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config
  - - mkdir -p ${CARGO_TARGET_DIR}
  # global RUSTFLAGS overrides the linker args so this way is better to pass the flags
  - printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' | tee ${CARGO_HOME}/config
  + # 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
  - sccache -s
  only:
  - master
  