forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
165 lines (136 loc) · 5.27 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
apply plugin: 'com.github.node-gradle.node'
ext {
python_executable = 'python3'
venv_name = 'venv'
}
node {
// If true, it will download node using above parameters.
// If false, it will try to use globally installed node.
if (project.hasProperty('useSystemNode') && project.getProperty('useSystemNode').toBoolean()) {
download = false
} else {
download = true
}
// Version of node to use.
version = '22.12.0'
// Version of Yarn to use.
yarnVersion = '1.22.22'
// Base URL for fetching node distributions (set nodeDistBaseUrl if you have a mirror).
if (project.hasProperty('nodeDistBaseUrl')) {
distBaseUrl = project.getProperty('nodeDistBaseUrl')
} else {
distBaseUrl = 'https://nodejs.org/dist'
}
// Set the work directory for unpacking node
workDir = file("${project.projectDir}/.gradle/nodejs")
// Set the work directory for NPM
yarnWorkDir = file("${project.projectDir}/.gradle/yarn")
// Set the work directory where node_modules should be located
nodeProjectDir = file("${project.projectDir}")
}
task yarnInstall(type: YarnTask) {
println "Root directory: ${project.rootDir}";
environment = ['NODE_OPTIONS': '--openssl-legacy-provider']
args = ['install', '--network-timeout', '300000', '--cwd', "${project.rootDir}/smoke-test/tests/cypress"]
}
task cypressLint(type: YarnTask, dependsOn: yarnInstall) {
environment = ['NODE_OPTIONS': '--openssl-legacy-provider']
// TODO: Run a full lint instead of just format.
args = ['--cwd', "${project.rootDir}/smoke-test/tests/cypress", 'run', 'format']
}
task cypressLintFix(type: YarnTask, dependsOn: yarnInstall) {
environment = ['NODE_OPTIONS': '--openssl-legacy-provider']
// TODO: Run a full lint instead of just format.
args = ['--cwd', "${project.rootDir}/smoke-test/tests/cypress", 'run', 'format', '--write']
}
task installDev(type: Exec) {
inputs.file file('pyproject.toml')
inputs.file file('requirements.txt')
outputs.file("${venv_name}/.build_install_dev_sentinel")
commandLine 'bash', '-c',
"set -x && " +
"${python_executable} -m venv ${venv_name} && " +
"${venv_name}/bin/python -m pip install --upgrade uv && " +
"set +x && source ${venv_name}/bin/activate && set -x && " +
"uv pip install -r requirements.txt && " +
"touch ${venv_name}/.build_install_dev_sentinel"
}
task pythonLint(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"black --check --diff tests/ && " +
"isort --check --diff tests/ && " +
"ruff --statistics tests/ && " +
"mypy tests/"
}
task pythonLintFix(type: Exec, dependsOn: installDev) {
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"black tests/ && " +
"isort tests/ && " +
"ruff --fix tests/ && " +
"mypy tests/"
}
/**
* The following tasks assume an already running quickstart.
* ./gradlew quickstart (or another variation `quickstartDebug`)
*/
task noCypressSuite0(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
environment 'RUN_QUICKSTART', 'false'
environment 'TEST_STRATEGY', 'no_cypress_suite0'
workingDir = project.projectDir
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"./smoke.sh"
}
task noCypressSuite1(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
environment 'RUN_QUICKSTART', 'false'
environment 'TEST_STRATEGY', 'no_cypress_suite1'
workingDir = project.projectDir
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"./smoke.sh"
}
task cypressSuite1(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
environment 'RUN_QUICKSTART', 'false'
environment 'TEST_STRATEGY', 'cypress_suite1'
workingDir = project.projectDir
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"./smoke.sh"
}
task cypressRest(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
environment 'RUN_QUICKSTART', 'false'
environment 'TEST_STRATEGY', 'cypress_rest'
workingDir = project.projectDir
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"./smoke.sh"
}
/**
* The following will run Cypress in interactive mode against an already running stack.
*/
task cypressDev(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
environment 'RUN_QUICKSTART', 'false'
workingDir = project.projectDir
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"./cypress-dev.sh"
}
/**
* The following will install Cypress data in an already running stack.
*/
task cypressData(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
environment 'RUN_QUICKSTART', 'false'
environment 'RUN_UI', 'false'
workingDir = project.projectDir
commandLine 'bash', '-c',
"source ${venv_name}/bin/activate && set -x && " +
"./cypress-dev.sh"
}
task lint {
dependsOn pythonLint, cypressLint
}
task lintFix {
dependsOn pythonLintFix
}