chore: (task|make)file templates

This commit is contained in:
Michele Cereda
2025-02-25 20:12:16 +03:00
parent 01aa5b159a
commit e876be0159
3 changed files with 52 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ task --completion 'bash' > '/etc/bash_completion.d/task'
- [Website]
- [Github]
- [Demystification of taskfile variables]
### Sources
@@ -109,4 +110,5 @@ task --completion 'bash' > '/etc/bash_completion.d/task'
[website]: https://taskfile.dev/
<!-- Others -->
[demystification of taskfile variables]: https://medium.com/@TianchenW/demystification-of-taskfile-variables-29b751950393
[stop using makefile (use taskfile instead)]: https://dev.to/calvinmclean/stop-using-makefile-use-taskfile-instead-4hm9

11
templates/Makefile Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env make
include .env
-include .env.local
export
REPOSITORY_ROOT = ${shell git rev-parse --show-toplevel}
debug-env:
@set | sort

39
templates/Taskfile.yml Normal file
View File

@@ -0,0 +1,39 @@
---
version: '3'
set:
- errexit # -e
- pipefail # -o pipefail
vars:
VENV_DIR: '{{.ROOT_TASKFILE}}/.venv'
tasks:
dev-tools:bootstrap:
cmds:
- task: python:venv:create
- npm install
dev-tools:update:
cmds:
- task: python:update-venv
- npm update --save
python:venv:create:
vars:
PYTHON_VERSION: '{{.PYTHON_VERSION | default 3.12}}'
REQUIREMENTS_FILE: '{{.ROOT_TASKFILE}}/requirements.txt'
cmds:
- python{{.PYTHON_VERSION}} -m 'venv' '{{.VENV_DIR}}'
- "{{.VENV_DIR}}/bin/pip --require-virtualenv install -r '{{.REQUIREMENTS_FILE}}'"
python:venv:recreate:
cmds:
- rm -rf '{{.VENV_DIR}}'
- task: python:venv:create
python:venv:update:
cmd: >-
{{.VENV_DIR}}/bin/pip freeze -l --require-virtualenv | sed 's/==/>=/'
| xargs {{.VENV_DIR}}/bin/pip --require-virtualenv install -U