From bf6f06c92d7bcaa34f0402ba81b2ca89d0fd1b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <amuoz@ed.ac.uk> Date: Tue, 4 Jan 2022 18:34:26 +0000 Subject: [PATCH] add ci --- .gitlab-ci.yml | 45 +++++++++++++++++++++++++++++++++++---------- pyproject.toml | 13 ++++--------- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78ea3cde..ef1e3022 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,18 +1,43 @@ image: python:3.7 +stages: + - test + - check + - deploy + before_script: - - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - - export PATH="$PATH:$HOME/.poetry/bin/" - - source $HOME/.poetry/env + - test -e $HOME/.poetry/bin/ || curl -sSL curl -sSL https://install.python-poetry.org | python3 - + - export PATH="$PATH:$HOME/.local/bin/" + - poetry config virtualenvs.create false + - rm -f poetry.lock + - pip install --upgrade pip - poetry install - - source `poetry env info --path`/bin/activate -build: - stage: build +Unit test: + stage: test script: - - echo 123 + - pytest ./tests/ -test: - stage: test +Python Code Lint: + stage: check + script: + - black . + +Static Type: + stage: check + script: + - 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 script: - - echo 123 + - 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 commit -m "Bump version" + - git remote add 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} + only: + - master diff --git a/pyproject.toml b/pyproject.toml index 880a2a12..687d9269 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,14 +6,6 @@ authors = ["Alan Munoz <alan.munoz@ed.ac.uk>"] [tool.poetry.dependencies] python = ">=3.7.1,<3.11" -# extraction = {git = "ssh://git@git.ecdf.ed.ac.uk/swain-lab/python-pipeline/extraction"} -# postprocessor = {git = "ssh://git@git.ecdf.ed.ac.uk/swain-lab/python-pipeline/post-processing"} -# baby = {git = "ssh://git@git.ecdf.ed.ac.uk/swain-lab/python-pipeline/baby"} -# logfile_parser = {git = "ssh://git@git.ecdf.ed.ac.uk/swain-lab/python-pipeline/logfile_parser"} -# extraction = {path="../extraction", develop=false} -# postprocessor = {path="../postprocessor", develop=false} -# baby = {path="../baby", develop=false} -# logfile_parser = {path="../logfile_parser", develop=false} ray = {version = "1.4.0", extras = ["tune"]} numpy = "^1.21.4" dask = "^2021.12.0" @@ -37,7 +29,10 @@ aliby-baby = "*" [tool.poetry.dev-dependencies] -black = "^21.9b0" +black = "^21.12b0" +Sphinx = "^4.3.2" +pytest = "^6.2.5" +mypy = "^0.930" [build-system] requires = ["setuptools", "poetry-core>=1.0.0"] -- GitLab