1
0
mirror of https://github.com/life4/textdistance.git synced 2021-09-19 22:35:47 +03:00

migrate to taskfile

This commit is contained in:
gram
2021-01-27 16:03:37 +01:00
parent d4d73462ba
commit f5f794ef6f
4 changed files with 108 additions and 19 deletions

View File

@@ -9,9 +9,7 @@ def main(ctx):
kind="pipeline",
type="docker",
name="default",
trigger=dict(
branch="master",
),
trigger=dict(branch="master"),
steps=steps,
)
@@ -20,26 +18,17 @@ def step(env, python):
result = dict(
name="{} (py{})".format(env, python),
image="python:{}-alpine".format(python),
depends_on=["clone"], # run in parallel
depends_on=["install task"],
environment=dict(
# set coverage database file name
# to avoid conflicts between steps
# set coverage database file name to avoid conflicts between steps
COVERAGE_FILE=".coverage.{}.{}".format(env, python),
),
commands=[
# install DepHell
"apk add curl git gcc libc-dev",
"python3 -m pip install wheel",
"curl -L dephell.org/install > install.py",
"python3 install.py --branch=master",
"dephell inspect self",
# install deps
"export DEPHELL_ENV={}".format(env),
"dephell venv create",
"dephell deps install --silent",
"dephell project register --traceback --level=DEBUG",
# run
"dephell venv run",
"./bin/task PYTHON_BIN=python3 VENVS=/opt/py{python}/ -f {env}:run".format(
python=python,
env=env,
),
],
)
return result

2
.gitignore vendored
View File

@@ -8,3 +8,5 @@ licenses_example/choosealicense.com
.hypothesis/
.coverage
htmlcov
.task/
venvs/

97
Taskfile.yml Normal file
View File

@@ -0,0 +1,97 @@
# https://taskfile.dev/
version: "3"
vars:
PYTHON_BIN: python3.7
VENVS: ./venvs/
FLAKE8_ENV: "{{.VENVS}}flake8"
PYTEST_PURE_ENV: "{{.VENVS}}pytest-pure"
PYTEST_EXT_ENV: "{{.VENVS}}pytest-ext"
ISORT_ENV: "{{.VENVS}}isort"
TESTS_PATH: tests/
tasks:
venv:create:
status:
- "test -f {{.ENV}}/bin/activate"
cmds:
- "{{.PYTHON_BIN}} -m venv {{.ENV}}"
- "{{.ENV}}/bin/python3 -m pip install -U pip setuptools wheel"
pip:install:
sources:
- pyproject.toml
- "{{.ENV}}/bin/activate"
deps:
- task: venv:create
vars:
ENV: "{{.ENV}}"
cmds:
- "{{.ENV}}/bin/pip install '.[{{.EXTRA}}]'"
flake8:install:
status:
- "test -f {{.FLAKE8_ENV}}/bin/flake8"
deps:
- task: venv:create
vars:
ENV: "{{.FLAKE8_ENV}}"
cmds:
- "{{.FLAKE8_ENV}}/bin/python3 -m pip install -r requirements-flake.txt"
flake8:run:
sources:
- "**/*.py"
deps:
- flake8:install
cmds:
- "{{.FLAKE8_ENV}}/bin/flake8 ."
pytest-pure:run:
deps:
- task: pip:install
vars:
ENV: "{{.PYTEST_PURE_ENV}}"
EXTRA: test
cmds:
- "{{.PYTEST_PURE_ENV}}/bin/pytest -m 'not external' {{.ARGS}} {{.TESTS_PATH}}"
pytest-external:run:
deps:
- task: pip:install
vars:
ENV: "{{.PYTEST_EXT_ENV}}"
EXTRA: test,benchmark
cmds:
- "{{.PYTEST_EXT_ENV}}/bin/pytest {{.ARGS}} {{.TESTS_PATH}}"
isort:run:
sources:
- "**/*.py"
deps:
- task: pip:install
vars:
ENV: "{{.ISORT_ENV}}"
EXTRA: tests
cmds:
- "{{.ISORT_ENV}}/bin/isort ."
sphinx:run:
sources:
- deal/**/*.py
- docs/**/*.md
deps:
- task: pip:install
vars:
ENV: "{{.SPHINX_ENV}}"
EXTRA: docs
cmds:
- "{{.SPHINX_ENV}}/bin/sphinx-build -W docs docs/build"
deal:prove:
deps:
- task: pip:install
vars:
ENV: "{{.DEAL_ENV}}"
cmds:
- "{{.DEAL_ENV}}/bin/python -m deal prove {{.ARGS}}"

View File

@@ -8,9 +8,10 @@ ignore=P101,P103,E241
exclude=
.tox,
.pytest_cache
venvs/
[isort]
skip=.tox,.pytest_cache
skip=.tox,.pytest_cache,venvs
line_length=120
combine_as_imports=true
balanced_wrapping=true