-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTaskfile.yaml
67 lines (57 loc) · 1.7 KB
/
Taskfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
## Make sure you have `pyenv` and `pyenv-virtualenv` installed beforehand
##
## https://github.com/pyenv/pyenv
## https://github.com/pyenv/pyenv-virtualenv
##
## Configure your shell with $ eval "$(pyenv virtualenv-init -)"
version: '3'
vars:
PYTHON_VERSION: '3.10.7'
PYTHON_VENV_NAME:
sh: basename "{{.PWD}}"
PYTHON_VENV_ROOT:
sh: pyenv root
PYTHON_VENV_PYTHON: '{{.PYTHON_VENV_ROOT}}/versions/{{.PYTHON_VENV_NAME}}/bin/python'
tasks:
setup:
desc: Setup the Python environment
deps:
- setup-python-version
- setup-virtualenv
cmds:
- echo "{{.PYTHON_VENV_NAME}}" > .python-version
- '{{.PYTHON_VENV_PYTHON}} -m pip install --upgrade pip'
- '{{.PYTHON_VENV_PYTHON}} -m pip install -r {{.PWD}}/requirements.txt'
- pyenv rehash
setup-python-version:
cmds:
- pyenv install {{.PYTHON_VERSION}}
status:
- test -d {{.PYTHON_VENV_ROOT}}/versions/{{.PYTHON_VERSION}}
setup-virtualenv:
cmds:
- pyenv virtualenv {{.PYTHON_VERSION}} {{.PYTHON_VENV_NAME}}
status:
- test -f {{.PYTHON_VENV_PYTHON}}
clean:
desc: Cleanup the Python environment
deps:
- task clean-virtualenv
- task clean-python-version
clean-virtualenv:
cmds:
- pyenv virtualenv-delete --force {{.PYTHON_VENV_NAME}}
status:
- test ! -f {{.PYTHON_VENV_PYTHON}}
clean-python-version:
cmds:
- rm {{.PWD}}/.python-version
status:
- test ! -f {{.PWD}}/.python-version
linter-setup:
cmds:
- docker pull github/super-linter:latest
linter-run:
cmds:
- docker run -e RUN_LOCAL=true -e USE_FIND_ALGORITHM=true -e IGNORE_GITIGNORED_FILES=true -v $(pwd):/tmp/lint/file github/super-linter