-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathTaskfile.yml
87 lines (78 loc) · 2.07 KB
/
Taskfile.yml
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
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: CC-BY-4.0
version: "3"
interval: '500ms'
dotenv: ['.env']
env:
BUILD_DIR: "{{.ROOT_DIR}}/.build"
DEPS_DIR: "{{.ROOT_DIR}}/.dep"
VENV_DIR: "{{.ROOT_DIR}}/.dep/.venv"
# Taskfile env does not override the actual shell env, see:
# https://github.com/go-task/task/issues/202
PATH: "{{.DEPS_DIR}}:{{.VENV_DIR}}/bin:$PATH"
tasks:
default:
cmds:
- task -l
##
## Website
##
build:
desc: Build documentation website
deps:
- deps/venv
- deps/proto-diagrams
preconditions:
- which go
- which python
env:
SOURCE_DIR: "{{.ROOT_DIR}}/docs"
SCHEMA_DIR: "{{.ROOT_DIR}}/schema"
BUILD_DOCS_DIR: "{{.BUILD_DIR}}/docs"
vars:
BUILD_SITE_DIR: "{{.BUILD_DIR}}/docs/html"
cmds:
- PATH={{.PATH}} ./docs/build-docs.sh
- |
echo "Docs available at: file://{{.BUILD_SITE_DIR}}/index.html"
# TODO(ramizpolic): This usually works well to regenerate context, but it's not a real hot-reload.
# Note that sometimes it crashes and goes into reload loop. Investigate or find alternative.
run:
desc: Run documentation website in live editing mode
preconditions:
- which go
- which python
watch: true
sources:
- 'docs/**/*'
- 'schema/**/*'
vars:
BUILD_SITE_DIR: "{{.BUILD_DIR}}/docs/html"
cmds:
- task: build
- |
echo "Docs available at: file://{{.BUILD_SITE_DIR}}/index.html"
##
## Dependencies
##
deps/venv:
internal: true
cmds:
- python3 -m venv {{.VENV_DIR}}
status:
- test -f {{.VENV_DIR}}
deps/proto-diagrams:
internal: true
vars:
GIT: "https://github.com/GoogleCloudPlatform/proto-gen-md-diagrams"
DIR: "{{.DEPS_DIR}}/git-proto-diagrams"
BIN: "{{.DEPS_DIR}}/proto-gen-md-diagrams"
cmds:
- defer: rm -rf {{.DIR}}
- |
mkdir -p {{.DIR}}
git clone {{.GIT}} {{.DIR}}
cd {{.DIR}}
go build -o {{.BIN}}
status:
- test -f {{.BIN}}