Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Update CircleCI's infrastructure (machine image and Python version in Docker image) #206

Merged
merged 5 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 22 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build_pytest:
machine:
image: ubuntu-2004:202107-02
image: default
working_directory: /tmp/src/nitransforms
environment:
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
Expand All @@ -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,9 @@ 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
pyenv local 3
eval "$(pyenv init --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 +94,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 +116,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 All @@ -141,13 +131,14 @@ jobs:
echo "cHJpbnRmICJrcnp5c3p0b2YuZ29yZ29sZXdza2lAZ21haWwuY29tXG41MTcyXG4gKkN2dW12RVYzelRmZ1xuRlM1Si8yYzFhZ2c0RVxuIiA+IGxpY2Vuc2UudHh0Cg==" | base64 -d | sh
- run:
name: Get codecov
command: python -m pip install codecov
command: python3 -m pip install codecov
- run:
name: Run unit tests
no_output_timeout: 2h
command: |
mkdir -p /tmp/tests/{artifacts,summaries}
docker run -u $( id -u ) -it --rm -w /src/nitransforms \
docker run -u $( id -u ) -it --rm \
-w /src/nitransforms -v $PWD:/src/nitransforms \
-v /tmp/data/nitransforms-tests:/data -e TEST_DATA_HOME=/data \
-e COVERAGE_FILE=/tmp/summaries/.pytest.coverage \
-v /tmp/fslicense/license.txt:/opt/freesurfer/license.txt:ro \
Expand All @@ -159,7 +150,7 @@ jobs:
name: Submit unit test coverage
command: |
cd /tmp/src/nitransforms
python -m codecov --file /tmp/tests/summaries/unittests.xml \
python3 -m codecov --file /tmp/tests/summaries/unittests.xml \
--flags unittests -e CIRCLE_JOB
- run:
name: Clean up tests directory
Expand All @@ -186,9 +177,9 @@ 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" build wheel "setuptools_scm[toml] >= 6.2" \
"pip>=10.0.1" twine docutils
python setup.py sdist bdist_wheel
python3 -m build
twine check dist/nitransforms*
- store_artifacts:
path: /tmp/src/nitransforms/dist
Expand All @@ -200,9 +191,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 +205,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
Loading