Skip to content
Snippets Groups Projects
Commit 03d49872 authored by Alán Muñoz's avatar Alán Muñoz
Browse files

add automated ci and clean up unused imports

parent c529de9c
No related branches found
No related tags found
No related merge requests found
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 ##
......@@ -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?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment