Skip to content

Commit

Permalink
fix: clean up environment cache
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed May 17, 2024
1 parent 7cef99c commit 5ad8c95
Show file tree
Hide file tree
Showing 5 changed files with 1,096 additions and 209 deletions.
42 changes: 15 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
- checkout
- restore_cache:
keys:
- env-v3-{{ .Branch }}-
- env-v3-master-
- env-v3-
- env-v6-{{ .Branch }}-
- env-v6-master-
- env-v6-
- run:
name: Setup git-annex
command: |
Expand All @@ -29,17 +29,14 @@ jobs:
- run:
name: Setup DataLad
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
python -m pip install --no-cache-dir -U pip "setuptools >= 45.0" "setuptools_scm[toml] >= 3.4"
python -m pip install --no-cache-dir -U datalad datalad-osf
python3 -m pip install --no-cache-dir -U pip "setuptools >= 45.0" "setuptools_scm[toml] >= 6.2"
python3 -m pip install --no-cache-dir -U datalad datalad-osf
- save_cache:
key: env-v3-{{ .Branch }}-{{ .BuildNum }}
key: env-v6-{{ .Branch }}-{{ .BuildNum }}
paths:
- /opt/circleci/git-annex.linux
- /opt/circleci/.pyenv/versions/3.9.4
- /opt/circleci/.pyenv/versions

- restore_cache:
keys:
Expand All @@ -49,10 +46,7 @@ jobs:
- run:
name: Install test data from GIN
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
export PATH=/opt/circleci/git-annex.linux:$PATH
export PATH=/opt/circleci/.pyenv/versions/3.12.2/bin/:/opt/circleci/git-annex.linux:$PATH
mkdir -p /tmp/data
cd /tmp/data
datalad install -r https://gin.g-node.org/oesteban/nitransforms-tests
Expand Down Expand Up @@ -98,15 +92,12 @@ jobs:
name: Build Docker image & push to registry
no_output_timeout: 60m
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
e=1 && for i in {1..5}; do
docker build --rm --cache-from=nitransforms:latest \
-t nitransforms:latest \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VERSION=$( python3 setup.py --version ) . \
--build-arg VERSION=$( python3 -m setuptools_scm ) . \
&& e=0 && break || sleep 15
done && [ "$e" -eq "0" ]
docker tag nitransforms:latest localhost:5000/nitransforms
Expand All @@ -123,10 +114,7 @@ jobs:
- run:
name: Check version packaged in Docker image
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
THISVERSION=${CIRCLE_TAG:-$(python3 setup.py --version)}
THISVERSION=${CIRCLE_TAG:-$(python3 -m setuptools_scm)}
INSTALLED_VERSION=$(\
docker run -it --rm --entrypoint=python nitransforms \
-c 'import nitransforms as nit; print(nit.__version__, end="")' )
Expand Down Expand Up @@ -186,7 +174,7 @@ jobs:
command: |
python3 -m venv /tmp/buildenv
source /tmp/buildenv/bin/activate
python3 -m pip install "setuptools >= 45.0" wheel "setuptools_scm[toml] >= 3.4" \
python3 -m pip install "setuptools >= 45.0" wheel "setuptools_scm[toml] >= 6.2" \
"pip>=10.0.1" twine docutils
python setup.py sdist bdist_wheel
twine check dist/nitransforms*
Expand All @@ -200,9 +188,9 @@ jobs:
command: |
python3 -m venv /tmp/install_sdist
source /tmp/install_sdist/bin/activate
python3 -m pip install "setuptools >= 45.0" "pip>=10.0.1"
python3 -m pip install "setuptools >= 45.0" "pip>=10.0.1" "setuptools_scm[toml] >= 6.2"
THISVERSION=$( python3 setup.py --version )
THISVERSION=$( python3 -m setuptools_scm )
THISVERSION=${CIRCLE_TAG:-$THISVERSION}
python3 -m pip install dist/nitransforms*.tar.gz
INSTALLED_VERSION=$(python3 -c 'import nitransforms as nit; print(nit.__version__, end="")')
Expand All @@ -214,9 +202,9 @@ jobs:
command: |
python3 -m venv /tmp/install_wheel
source /tmp/install_wheel/bin/activate
python3 -m pip install "setuptools >= 45.0" "pip>=10.0.1"
python3 -m pip install "setuptools >= 45.0" "pip>=10.0.1" "setuptools_scm[toml] >= 6.2"
THISVERSION=$( python3 setup.py --version )
THISVERSION=$( python3 -m setuptools_scm )
THISVERSION=${CIRCLE_TAG:-$THISVERSION}
python3 -m pip install dist/nitransforms*.whl
INSTALLED_VERSION=$(python3 -c 'import nitransforms as nit; print(nit.__version__, end="")')
Expand Down
Loading

0 comments on commit 5ad8c95

Please sign in to comment.