Skip to content

Commit bda4695

Browse files
authored
Update the directories required for cache so it works on windows (#125)
* 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
1 parent 95cea11 commit bda4695

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

.circleci/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,4 @@ workflows:
303303
branches:
304304
ignore: /.*/
305305
tags:
306-
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
306+
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/

src/commands/install-packages.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ steps:
9595
working_directory: << parameters.app-dir >>
9696
- run:
9797
name: Save python version
98-
command: python --version | cut -d ' ' -f2 > /tmp/python-version
98+
command: python --version | cut -d ' ' -f2 > .temp-python-version && cat .temp-python-version
9999
- restore_cache:
100100
keys:
101-
- <<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" }}
102-
- <<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>>
101+
- <<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" }}
102+
- <<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>>
103103
- run:
104104
name: Move restored cache
105105
working_directory: << parameters.app-dir >>
@@ -187,6 +187,6 @@ steps:
187187
PARAM_VENV_PATH: << parameters.venv-path >>
188188
command: <<include(scripts/cache-save.sh)>>
189189
- save_cache:
190-
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" }}
190+
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" }}
191191
paths:
192-
- /tmp/cci_pycache
192+
- <<parameters.app-dir>>/.cci_pycache

src/scripts/cache-link-lockfile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# shellcheck source=detect-env.sh
22
source "$AUTO_DETECT_ENV_SCRIPT"
33

4-
CACHE_DIR="/tmp/cci_pycache"
4+
CACHE_DIR=".cci_pycache"
55
LOCKFILE_PATH="${CACHE_DIR}/lockfile"
66

77
mkdir -p "${CACHE_DIR}"

src/scripts/cache-restore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ restore_paths() {
2828
fi
2929
}
3030

31-
CACHE_DIR="/tmp/cci_pycache"
31+
CACHE_DIR=".cci_pycache"
3232

3333
if [ "${PARAM_VENV_CACHE}" = "1" ]; then
3434
restore_paths "${CACHE_DIR}/venv"

src/scripts/cache-save.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if [ -n "${PARAM_VENV_PATH}" ]; then
2929
VENV_PATHS="${PARAM_VENV_PATH}"
3030
fi
3131

32-
CACHE_DIR="/tmp/cci_pycache"
32+
CACHE_DIR=".cci_pycache"
3333
mkdir -p "${CACHE_DIR}"
3434

3535
link_paths() {

0 commit comments

Comments
 (0)