From 821ce0576fb31038aa59daed9a3a8e4b06e17d70 Mon Sep 17 00:00:00 2001 From: Vasek Sraier <git@vakabus.cz> Date: Tue, 9 Feb 2021 13:52:20 +0100 Subject: [PATCH] updated README.md with minimal setup, configured CI for linting --- manager/.gitlab-ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++++ manager/README.md | 12 ++++++--- 2 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 manager/.gitlab-ci.yml diff --git a/manager/.gitlab-ci.yml b/manager/.gitlab-ci.yml new file mode 100644 index 000000000..85d31d233 --- /dev/null +++ b/manager/.gitlab-ci.yml @@ -0,0 +1,56 @@ +stages: + - check + +image: debian:latest + +# FIXME - use custom Docker image, so that we don't rebuild it all every single time +lint: + image: debian:latest + stage: check + variables: + # Python by default uses ascii encoding, which does not work, because source files are in UTF-8. Here is a potential solution, but for newer Python https://www.python.org/dev/peps/pep-0540/ + LC_ALL: C.UTF-8 + + # this job uses messy tricks to install dependencies quickly, if something goes wrong, it should kill itself reasonably fast + timeout: 5 minutes + + # FIXME cache does not seem to have any effect when running locally, it might be the same in CI + cache: + key: "always-the-same-cache" + paths: + - node_modules/ + # FIXME caching these would help, but gitlab refuses to cache anything outside of project's directory + #- /root/.pyenv/ + #- /root/.poetry/ + #- /root/.nvm/ + #- /var/cache/ + policy: pull-push + script: + # pyenv setup deps + - apt-get update && apt-get install --no-install-recommends --no-install-suggests -y build-essential git ca-certificates + # python build deps + - apt-get update && apt-get install --no-install-recommends --no-install-suggests -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev + # Yarn and NodeJS + - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash + - export NVM_DIR="$HOME/.nvm" + - \[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + - \[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + - nvm install --lts node + - nvm use node + - nvm install-latest-npm + # install pyenv + - unset PYENV_ROOT + - curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash + - export PATH="$HOME/.pyenv/bin:$PATH" + - eval "$(pyenv init -)" + - eval "$(pyenv virtualenv-init -)" + # install python via pyenv + - pyenv install + - pyenv global 3.6.12 + # install poetry + - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - + - export PATH="$HOME/.poetry/bin:$PATH" + # run the actual tests + - poetry install + - npm install + - ./poe check \ No newline at end of file diff --git a/manager/README.md b/manager/README.md index 34a716801..c5dd382d3 100644 --- a/manager/README.md +++ b/manager/README.md @@ -11,15 +11,21 @@ Install these tools: * [Poetry](https://python-poetry.org/docs/#installation) * [Yarn](https://yarnpkg.com/) (See FAQ for why do we need JS in Python project) or NPM -The actual development environment can be setup using these commands: +The actual fully-featured development environment can be setup using these commands: ```sh -pyenv install +pyenv install 3.6.12 3.7.9 3.8.7 3.9.1 poetry env use $(pyenv which python) poetry install -yarn install # or npm install +yarn install # or "npm install" ``` +With this environment, everything else should just work. You can run the same checks the CI runs, all commands listed bellow should pass. + +### Minimal development environment + +The only global tools that are strictly required are `Python` and `pip` (or other way to install PyPI packages). You can have a look at the `pyproject.toml` file, manually install all other dependencies that you need and be done with that. All `poe` commands (see bellow) can be run manually too, see their definition in `pyproject.toml`. We can't however guarantee, that there won't be any errors. + ### Common tasks and interactions with the project After setting up the environment, you should be able to interract with the project by using the `./poe` script. Common actions are: -- GitLab