diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0c51f76a06f0f5c0426998eeafbc03c670cb40bc..b9af0c25f058a2090aea7398b4a477819c1237c3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,44 +1,68 @@ image: python:3.7 +cache: + key: "project-${CI_JOB_NAME}" + paths: + - .cache/pip + - .venv + key: + files: + - poetry.lock + stages: - test - check - - deploy + - release before_script: - - test -e $HOME/.poetry/bin/ || curl -sSL curl -sSL https://install.python-poetry.org | python3 - + - test -e $HOME/.poetry/bin/ || curl -sSL https://install.python-poetry.org | python3 - - export PATH="$PATH:$HOME/.local/bin/" - - poetry config virtualenvs.create false - - rm -f poetry.lock + - poetry --version + - poetry config virtualenvs.in-project true - pip install --upgrade pip - - poetry install + - git remote rm origin && git remote add origin https://${ACCESS_TOKEN_NAME}:${ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git + - git pull + - if [ ${var+TRIGGER_PYPI_NAME} ]; then echo "Pipeline triggered by ${TRIGGER_PYPI_NAME}"; poetry update ${TRIGGER_PYPI_NAME}; fi + - poetry install -vv Unit test: stage: test + allow_failure: true script: - - pytest ./tests/ + - poetry run pytest ./tests/ Python Code Lint: stage: check script: - - black . + - poetry run black . Static Type: stage: check allow_failure: true script: - - mypy . --exclude 'setup\.py$' + - poetry run mypy . --exclude 'setup\.py$' # We can remove the flag once this is resolved https://github.com/pypa/setuptools/issues/2345 -Publish to pypi and update repository: - stage: deploy +Bump version and release: + stage: release script: - poetry version ${BUMP_RULE} - git config --global user.email ${GITLAB_USER_EMAIL} - git config --global user.name ${GITLAB_USER_NAME} - - git add pyproject.toml + - git add pyproject.toml poetry.lock - git commit -m "Bump version" - - git remote set-url origin https://${ACCESS_TOKEN_NAME}:${ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git - - git push -o ci.skip origin HEAD:master && poetry publish --build --username ${PYPI_USER} --password ${PYPI_PASSWORD} + # - git pull && git push -o ci.skip origin HEAD:master && poetry publish --build --username ${PYPI_USER} --password ${PYPI_PASSWORD} + - git pull && git push -o ci.skip origin HEAD:master + - echo "TRIGGER_PYPI_NAME=$(cat pyproject.toml | grep '^name =' | head -n 1 | cut -f3 -d' ' | tr -d \")" >> build.env + artifacts: + reports: + dotenv: build.env only: - master + except: + changes: + - tests/* + needs: + job: Unit test + +## Custom stages ## diff --git a/aliby/segment.py b/aliby/segment.py index 6550bd404f1d042b99f24105677900e6e29c60e2..a48d65a5a6ff822c896aa176eeb55f4fa0ab797e 100644 --- a/aliby/segment.py +++ b/aliby/segment.py @@ -13,19 +13,8 @@ from skimage.registration import phase_cross_correlation from agora.base import ParametersABC, ProcessABC from aliby.traps import segment_traps -from aliby.timelapse import TimelapseOMERO -from aliby.io.matlab import matObject -from aliby.traps import ( - identify_trap_locations, - get_trap_timelapse, - get_traps_timepoint, - centre, - get_trap_timelapse_omero, -) -from aliby.utils import accumulate, get_store_path - -from aliby.io.writer import Writer, load_attributes -from aliby.io.metadata_parser import parse_logfiles + +from aliby.io.writer import load_attributes trap_template_directory = Path(__file__).parent / "trap_templates" # TODO do we need multiple templates, one for each setup?