From e72d4160ee46c80dc853c4b3b81bb87ea1bce11d Mon Sep 17 00:00:00 2001 From: Jeremie Abiteboul Date: Thu, 31 Oct 2019 10:43:44 +0100 Subject: [PATCH] feat: run flake8 in CI --- .circleci/config.yml | 22 ++++++++++++++++++++++ .gitignore | 1 + Dockerfile | 5 +++-- Makefile | 9 +++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..957df0e3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,22 @@ +--- +version: 2 +jobs: + lint-code: + machine: + image: circleci/classic:latest + working_directory: ~/tabnet + resource_class: medium + steps: + - checkout + - run: + name: LintCode + command: | + make build + make install + make lint + +workflows: + version: 2 + CI-tabnet: + jobs: + - lint-code diff --git a/.gitignore b/.gitignore index c1fc4bd8..152900a8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ data/ .ipynb_checkpoints/ *.pt +*~ # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Dockerfile b/Dockerfile index be0228c9..67a0eb6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM python:3.7-slim-buster -RUN apt update && apt install curl make git -y +RUN apt update && apt install curl make git -y RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python ENV SHELL /bin/bash -l @@ -10,5 +10,6 @@ ENV JUPYTER_CONFIG_DIR /work/.cache/jupyter/config RUN $HOME/.poetry/bin/poetry config settings.virtualenvs.path $POETRY_CACHE -# ENTRYPOINT ["poetry", "run"] +ENV PATH /root/.poetry/bin:/bin:/usr/local/bin:/usr/bin + CMD ["bash", "-l"] diff --git a/Makefile b/Makefile index 5df9e523..c16e9095 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ WARN_COLOR=\\e[33m PORT=8889 .SILENT: ; default: help; # default target +DOCKER_RUN = docker run --rm -v ${FOLDER}:/work -w /work --entrypoint bash -lc python-poetry:latest -c IMAGE_NAME=python-poetry:latest @@ -23,6 +24,14 @@ start: build docker run --rm -it -v ${FOLDER}:/work -w /work -p ${PORT}:${PORT} -e "JUPYTER_PORT=${PORT}" ${IMAGE_NAME} .PHONY: start +install: build + $(DOCKER_RUN) 'poetry install' +.PHONY: install + +lint: + $(DOCKER_RUN) 'poetry run flake8' +.PHONY: lint + notebook: poetry run jupyter notebook --allow-root --ip 0.0.0.0 --port ${PORT} --no-browser --notebook-dir . .PHONY: notebook