Skip to content

Commit

Permalink
Update the directories required for cache so it works on windows (#125)
Browse files Browse the repository at this point in the history
* Update cache files names and add dummy test

* Add temp debug

* Update python version file name

* Use a good directory for test

* Specify app dir

* Use app dir only for lockfile

* Restore tests
  • Loading branch information
marboledacci authored Nov 26, 2024
1 parent 95cea11 commit bda4695
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,4 @@ workflows:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
10 changes: 5 additions & 5 deletions src/commands/install-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ steps:
working_directory: << parameters.app-dir >>
- run:
name: Save python version
command: python --version | cut -d ' ' -f2 > /tmp/python-version
command: python --version | cut -d ' ' -f2 > .temp-python-version && cat .temp-python-version
- restore_cache:
keys:
- <<parameters.cache-version>>-cci_pycache-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>><<#parameters.include-python-in-cache-key>>{{ checksum "/tmp/python-version" }}-<</parameters.include-python-in-cache-key>>{{ checksum "/tmp/cci_pycache/lockfile" }}
- <<parameters.cache-version>>-cci_pycache-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>><<#parameters.include-python-in-cache-key>>{{ checksum "/tmp/python-version" }}-<</parameters.include-python-in-cache-key>>
- <<parameters.cache-version>>-cci_pycache-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>><<#parameters.include-python-in-cache-key>>{{ checksum ".temp-python-version" }}-<</parameters.include-python-in-cache-key>>{{ checksum "<<parameters.app-dir>>/.cci_pycache/lockfile" }}
- <<parameters.cache-version>>-cci_pycache-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>><<#parameters.include-python-in-cache-key>>{{ checksum ".temp-python-version" }}-<</parameters.include-python-in-cache-key>>
- run:
name: Move restored cache
working_directory: << parameters.app-dir >>
Expand Down Expand Up @@ -187,6 +187,6 @@ steps:
PARAM_VENV_PATH: << parameters.venv-path >>
command: <<include(scripts/cache-save.sh)>>
- save_cache:
key: <<parameters.cache-version>>-cci_pycache-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>><<#parameters.include-python-in-cache-key>>{{ checksum "/tmp/python-version" }}-<</parameters.include-python-in-cache-key>>{{ checksum "/tmp/cci_pycache/lockfile" }}
key: <<parameters.cache-version>>-cci_pycache-<<#parameters.include-branch-in-cache-key>>{{ .Branch }}-<</parameters.include-branch-in-cache-key>><<#parameters.include-python-in-cache-key>>{{ checksum ".temp-python-version" }}-<</parameters.include-python-in-cache-key>>{{ checksum "<<parameters.app-dir>>/.cci_pycache/lockfile" }}
paths:
- /tmp/cci_pycache
- <<parameters.app-dir>>/.cci_pycache
2 changes: 1 addition & 1 deletion src/scripts/cache-link-lockfile.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# shellcheck source=detect-env.sh
source "$AUTO_DETECT_ENV_SCRIPT"

CACHE_DIR="/tmp/cci_pycache"
CACHE_DIR=".cci_pycache"
LOCKFILE_PATH="${CACHE_DIR}/lockfile"

mkdir -p "${CACHE_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/cache-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ restore_paths() {
fi
}

CACHE_DIR="/tmp/cci_pycache"
CACHE_DIR=".cci_pycache"

if [ "${PARAM_VENV_CACHE}" = "1" ]; then
restore_paths "${CACHE_DIR}/venv"
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/cache-save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [ -n "${PARAM_VENV_PATH}" ]; then
VENV_PATHS="${PARAM_VENV_PATH}"
fi

CACHE_DIR="/tmp/cci_pycache"
CACHE_DIR=".cci_pycache"
mkdir -p "${CACHE_DIR}"

link_paths() {
Expand Down

0 comments on commit bda4695

Please sign in to comment.