-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
108 lines (106 loc) · 3.29 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
SOURCE_CODE: uv_example
DOCKER_ORG: 166979434163.dkr.ecr.us-east-1.amazonaws.com
DOCKER_REPO: uv-example
tasks:
sync:
desc: Install Project Dependencies
cmds:
- uv sync --all-extras --frozen
env:
UV_INDEX_PYTHON_PACKAGES_PASSWORD:
ref: .CODEARTIFACT_TOKEN
requires:
vars: [CODEARTIFACT_TOKEN]
install:
desc: Install Project + Dev Dependencies
cmds:
- task: pre-commit-install
deps: [sync]
default:
desc: Install Project, List Tasks
cmds:
- task --list-all
deps: [sync]
test:
desc: Run Tests
cmds:
- uv run --all-extras --frozen -- pytest {{.CLI_ARGS | default "tests"}}
deps: [sync]
fmt:
desc: Run Code Formatters
cmds:
- uv run --frozen -- ruff format {{.CLI_ARGS | default .ROOT_DIR}}
deps: [sync]
fix:
desc: Fix Code with Linters and Formatters
cmds:
- task: fmt
- uv run --frozen -- ruff check --fix {{.CLI_ARGS | default .ROOT_DIR}}
deps: [sync]
lint:
desc: Run Code Linters
cmds:
- uv run --frozen -- ruff check {{.CLI_ARGS | default .ROOT_DIR}}
deps: [sync]
check:
desc: Run Static Type Checkers
cmds:
- |
uv run --frozen -- \
mypy \
--install-types \
--ignore-missing-imports \
--non-interactive \
{{.CLI_ARGS | default .SOURCE_CODE}}
deps: [sync]
build:
desc: Build the Project Artifacts
cmds:
- uv build
run:
desc: Run Command within Project (requires "--")
cmds:
- uv run --frozen -- {{.CLI_ARGS}}
deps: [sync]
docker:
desc: Build Docker Image
cmds:
- |
docker build \
--secret id=CODEARTIFACT_TOKEN,env=CODEARTIFACT_TOKEN \
--tag {{.DOCKER_ORG}}/{{.DOCKER_REPO}}:latest \
--tag {{.DOCKER_ORG}}/{{.DOCKER_REPO}}:{{.PACKAGE_VERSION}} \
{{.CLI_ARGS}} \
{{.ROOT_DIR}}
status:
- test ! -f {{.ROOT_DIR}}/{{.DOCKERFILE | default "Dockerfile"}}
vars:
PACKAGE_VERSION:
sh: uv tool run --isolated hatch project metadata version
requires:
vars: [CODEARTIFACT_TOKEN]
version:
desc: View / Set Project Version
cmd: uv tool run --isolated hatch version {{.CLI_ARGS}}
silent: true
pre-commit:
desc: Run Pre-Commit Hooks
cmds:
- uv tool run --isolated pre-commit run
status:
- test ! -f {{.ROOT_DIR}}/.pre-commit-config.yaml
deps: [pre-commit-install]
########################
# INTERNAL TASKS
########################
pre-commit-install:
desc: Install Pre-Commit Hooks
internal: true
cmds:
- cmd: uv tool run --isolated pre-commit install --install-hooks
silent: true
status:
- test ! -f {{.ROOT_DIR}}/.pre-commit-config.yaml