-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
206 lines (177 loc) · 5 KB
/
build.gradle
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'ru.vyarus.use-python' version '2.3.0'
id "com.github.node-gradle.node" version "2.2.4"
id "com.star-zero.gradle.githook" version "1.2.1"
}
allprojects {
repositories {
mavenCentral()
}
}
task install{
}
task check{
}
task build{
}
python.installVirtualenv = true
python.envPath = ".venv"
python{
pip "poetry:1.8.3"
}
githook {
hooks {
"pre-commit" {
task = "formatCheck"
}
"pre-push" {
task = "lint"
}
}
}
task poetryInstall(type: PythonTask) {
dependsOn 'pipInstall'
command = "-m poetry install"
inputs.file('pyproject.toml')
inputs.file('poetry.lock')
outputs.file('poetryInstallOutput')
}
task installOiio(type: PythonTask){
command = "-m pip install -r requirements.txt --no-dependencies"
inputs.file('requirements.txt')
outputs.dir('.venv/Lib/site-packages/oiio')
}
task pythonInstall{
dependsOn 'poetryInstall'
dependsOn 'installOiio'
}
task pythonUnitTests(type: PythonTask){
dependsOn 'pythonInstall'
command = "-m pytest tests/unittests -v --html=tests/reports/unittests.html --self-contained-html"
inputs.dir('cato')
inputs.dir('cato_server')
inputs.dir('cato_api_client')
inputs.dir('tests')
outputs.file('pytestOutput')
}
task pythonIntegrationTests(type: PythonTask){
dependsOn 'pythonInstall'
dependsOn 'pythonUnitTests'
dependsOn 'copyFrontendToBuild'
command = "-m pytest tests/integrationtests -v --html=tests/reports/integrationtests.html --self-contained-html"
inputs.dir('cato')
inputs.dir('cato_server')
inputs.dir('cato_api_client')
inputs.dir('tests')
outputs.file('pytestOutput')
}
task pythonDetectFlakySeleniumTests(type: PythonTask){
dependsOn 'pythonInstall'
dependsOn 'copyFrontendToBuild'
command = "-m pytest --flake-finder --flake-runs=100 -n auto -v tests/integrationtests/cato_server/selenium --html=tests/reports/integrationtests-flake-detect.html --self-contained-html"
inputs.dir('cato')
inputs.dir('cato_server')
inputs.dir('cato_api_client')
inputs.dir('tests')
outputs.file('pytestOutput')
}
task copyFrontendToBuild {
dependsOn(':frontend:yarnBuild')
doLast {
delete "${rootDir}/cato_server/static"
copy {
from "${rootDir}/frontend/build"
into "${rootDir}/cato_server/static"
}
}
}
task poetryBuild(type: PythonTask){
dependsOn 'pythonInstall'
dependsOn 'pythonUnitTests'
dependsOn('pythonIntegrationTests')
dependsOn 'copyFrontendToBuild'
command = '-m poetry build'
inputs.dir('cato')
inputs.dir('cato_server')
inputs.dir('cato_api_client')
inputs.file('pyproject.toml')
inputs.file('poetry.lock')
outputs.dir('dist')
}
task patchRequirementsTxtIntoWheel(type: PythonTask){
command = 'scripts/path_wheel_with_requirements_txt.py'
}
task splitWheel(type: PythonTask){
command = 'scripts/generate_wheels.py'
}
poetryBuild.finalizedBy splitWheel
task poetryUpdate(type: PythonTask){
command = '-m poetry update'
}
install.dependsOn('pythonInstall')
check.dependsOn('pythonUnitTests')
check.dependsOn('pythonIntegrationTests')
build.dependsOn('poetryBuild')
install.dependsOn(':frontend:yarnInstallDependencies')
task formatPythonCheck(type: PythonTask){
command = '-m black cato cato_server tests cato_api_client cato_common scripts --check'
inputs.dir('cato')
inputs.dir('tests')
inputs.dir('cato_server')
inputs.dir('cato_api_client')
inputs.dir('cato_common')
outputs.file('formatPythonCheck')
}
task formatPython(type:PythonTask){
command = '-m black cato cato_server tests cato_api_client cato_common scripts '
inputs.dir('cato')
inputs.dir('tests')
inputs.dir('cato_server')
inputs.dir('cato_api_client')
inputs.dir('cato_common')
outputs.file('formatPython')
}
task lintPython(type:PythonTask){
command = '-m flake8 cato cato_server cato_api_client cato_common'
inputs.dir('cato')
inputs.dir('cato_server')
inputs.dir('cato_api_client')
inputs.dir('cato_common')
outputs.file('lintPython')
}
task mypyCheck(type:PythonTask){
command = '-m mypy -p cato -p cato_common --exclude cato_common/images/image_comparators'
inputs.dir('cato')
inputs.dir('cato_common')
outputs.file('mypyCheck')
}
task formatCheck{
dependsOn 'formatPythonCheck'
dependsOn ':frontend:formatTypescriptCheck'
}
task format{
dependsOn 'formatPython'
dependsOn ':frontend:formatTypescript'
}
task lint{
dependsOn 'lintPython'
dependsOn ':frontend:lintTypescript'
dependsOn 'mypyCheck'
}
task updateDependencies{
dependsOn 'poetryUpdate'
dependsOn ':frontend:yarnUpgrade'
}
task generatePyTypescriptModel(type: PythonTask){
dependsOn 'pythonInstall'
command = 'scripts/generate_typescript_models.py'
}
task installationTest(type: PythonTask){
dependsOn 'splitWheel'
command = 'scripts/install_test.py'
}