-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
121 lines (104 loc) · 3.29 KB
/
Taskfile.yml
File metadata and controls
121 lines (104 loc) · 3.29 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
version: "3"
dotenv: [".env"]
env:
OS_TYPE:
sh: uname
BUILD:
sh: LC_TIME=en_US.UTF-8 date
VERSION:
sh: grep 'version =' pyproject.toml | cut -d '"' -f 2
RSBUILD:
sh: if command -v rsbuild > /dev/null; then echo "true"; else echo "false"; fi
JMDICT: "https://drive.usercontent.google.com/download?id=1dlvguHuMjDmtpA4beu1WaVbDte5j4SLk&confirm=yy"
XLWSD: "https://drive.usercontent.google.com/download?id=1d75OUrM3dyAvYUsnBXle-Z1W0NHyKIBD&confirm=yy"
VANILLA: docker run --rm
-v ${PJ_DIR}:/workspace
--workdir /workspace
--entrypoint bash
-i asia.gcr.io/linalgo/${PKG_NAME}:vanilla-py310 -c
DEV: docker run --rm
-v ${PJ_DIR}:/workspace
--workdir /workspace
--entrypoint bash
-i asia.gcr.io/linalgo/${PKG_NAME}:dev
tasks:
# Utility Tasks
help:
desc: "Display help information for available tasks"
cmds:
- 'echo "Usage: task {build, push, clean, ...}"'
- 'echo "Please check README.md for instructions."'
silent: true
default:
desc: "Display the help message by default if no task specified"
cmds:
- task help
clean:
desc: "Clean the repository based on the availability of rsbuild"
cmds:
- 'if [ "{{.RSBUILD}}" = "true" ]; then task rsbuild_clean; else task missing; fi'
rsbuild_clean:
desc: "Run rsbuild clean and display a message indicating repository is cleaned"
cmds:
- rsbuild clean
- 'echo "repo cleaned"'
missing:
desc: "Display a message if rsbuild is not available"
cmds:
- 'echo "rsbuild is missing"'
add_build.mac:
cmds:
- sed -i '' 's/__version__ = ".*"/__version__ = "{{.VERSION}}"/' "${PKG_NAME}/__init__.py";
- sed -i '' 's/__build__ = ".*"/__build__ = "{{.BUILD}}"/' "${PKG_NAME}/__init__.py";
add_build.linux:
cmds:
- sed -i "s/__version__ = \".*\"/__version__ = \"{{.VERSION}}\"/" "${PKG_NAME}/__init__.py";
- sed -i "s/__build__ = \".*\"/__build__ = \"{{.BUILD}}\"/" "${PKG_NAME}/__init__.py";
add_build:
desc: "Update the version and build information in project files"
cmds:
- echo {{.OS_TYPE}}
- |
case "{{.OS_TYPE}}" in
Darwin*)
task add_build.mac
;;
Linux*)
task add_build.linux
;;
esac
# Build Tasks
build:
desc: "Tasks related to building the project"
deps: [add_build]
cmds:
- if [ "{{.FORCE_DOWNLOAD}}" = "true" ]; then task download; fi
- task build.docker
build.docker:
desc: "Build the Docker image for the project"
cmds:
- docker compose build vanilla
- docker compose build
install:
cmds:
- sudo python -m unidic download
- cd wsd/annotate/lit && npm install
npm-build:
cmds:
- cd wsd/annotate/lit && npm run build
annotate:
deps: [npm-build]
cmds:
- mesop wsd/annotate/app.py
download:
cmds:
- curl -L "{{.JMDICT}}" -o {{.PJ_DIR}}/data/JMdict_en.gz
- curl -L "{{.XLWSD}}" -o {{.PJ_DIR}}/data/xl-wsd-data.zip
dataset:
cmds:
- gcloud auth application-default login
install.package:
cmds:
- pip install -U pre-commit --break-system-packages # Install pre-commit
- pre-commit install
- pip install -U wsd[all] --break-system-packages # Install the package