2022-07-14 22:04:06 +05:30
|
|
|
apply plugin: 'com.github.node-gradle.node'
|
|
|
|
|
|
2024-01-31 14:42:40 +05:30
|
|
|
ext {
|
|
|
|
|
python_executable = 'python3'
|
|
|
|
|
venv_name = 'venv'
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-14 22:04:06 +05:30
|
|
|
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.
|
2023-12-15 13:28:33 -06:00
|
|
|
version = '21.2.0'
|
2022-07-14 22:04:06 +05:30
|
|
|
|
|
|
|
|
// Version of Yarn to use.
|
2024-09-23 19:29:50 -05:00
|
|
|
yarnVersion = '1.22.22'
|
2022-07-14 22:04:06 +05:30
|
|
|
|
|
|
|
|
// 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
|
2023-12-15 13:28:33 -06:00
|
|
|
nodeProjectDir = file("${project.projectDir}")
|
2022-07-14 22:04:06 +05:30
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
task yarnInstall(type: YarnTask) {
|
|
|
|
|
println "Root directory: ${project.rootDir}";
|
2023-12-15 13:28:33 -06:00
|
|
|
environment = ['NODE_OPTIONS': '--openssl-legacy-provider']
|
2024-09-23 19:29:50 -05:00
|
|
|
args = ['install', '--network-timeout', '300000', '--cwd', "${project.rootDir}/smoke-test/tests/cypress"]
|
2024-01-31 14:42:40 +05:30
|
|
|
}
|
2024-08-13 15:53:23 -05:00
|
|
|
|
2024-05-07 14:16:22 +05:30
|
|
|
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']
|
|
|
|
|
}
|
2024-01-31 14:42:40 +05:30
|
|
|
|
2024-08-13 15:53:23 -05:00
|
|
|
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']
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 14:42:40 +05:30
|
|
|
task installDev(type: Exec) {
|
|
|
|
|
inputs.file file('pyproject.toml')
|
|
|
|
|
inputs.file file('requirements.txt')
|
|
|
|
|
outputs.file("${venv_name}/.build_install_dev_sentinel")
|
2024-02-26 15:02:47 -08:00
|
|
|
commandLine 'bash', '-c',
|
|
|
|
|
"set -x && " +
|
2024-01-31 14:42:40 +05:30
|
|
|
"${python_executable} -m venv ${venv_name} && " +
|
2024-09-08 04:59:58 -07:00
|
|
|
"${venv_name}/bin/python -m pip install --upgrade uv && " +
|
2024-02-26 15:02:47 -08:00
|
|
|
"set +x && source ${venv_name}/bin/activate && set -x && " +
|
|
|
|
|
"uv pip install -r requirements.txt && " +
|
2024-01-31 14:42:40 +05:30
|
|
|
"touch ${venv_name}/.build_install_dev_sentinel"
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-07 14:16:22 +05:30
|
|
|
task pythonLint(type: Exec, dependsOn: installDev) {
|
2024-01-31 14:42:40 +05:30
|
|
|
commandLine 'bash', '-c',
|
|
|
|
|
"source ${venv_name}/bin/activate && set -x && " +
|
|
|
|
|
"black --check --diff tests/ && " +
|
|
|
|
|
"isort --check --diff tests/ && " +
|
|
|
|
|
"ruff --statistics tests/ && " +
|
|
|
|
|
"mypy tests/"
|
|
|
|
|
}
|
2024-05-07 14:16:22 +05:30
|
|
|
task pythonLintFix(type: Exec, dependsOn: installDev) {
|
2024-01-31 14:42:40 +05:30
|
|
|
commandLine 'bash', '-c',
|
|
|
|
|
"source ${venv_name}/bin/activate && set -x && " +
|
|
|
|
|
"black tests/ && " +
|
|
|
|
|
"isort tests/ && " +
|
|
|
|
|
"ruff --fix tests/ && " +
|
|
|
|
|
"mypy tests/"
|
|
|
|
|
}
|
2024-02-21 18:16:42 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The following tasks assume an already running quickstart.
|
2024-04-04 15:21:44 -05:00
|
|
|
* ./gradlew quickstart (or another variation `quickstartDebug`)
|
2024-02-21 18:16:42 -06:00
|
|
|
*/
|
2024-04-04 15:21:44 -05:00
|
|
|
task noCypressSuite0(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
|
2024-02-21 18:16:42 -06:00
|
|
|
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"
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-04 15:21:44 -05:00
|
|
|
task noCypressSuite1(type: Exec, dependsOn: [installDev, ':metadata-ingestion:installDev']) {
|
2024-02-21 18:16:42 -06:00
|
|
|
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"
|
|
|
|
|
}
|
2024-04-04 15:21:44 -05:00
|
|
|
|
|
|
|
|
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'
|
|
|
|
|
|
2024-05-03 16:13:09 -05:00
|
|
|
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'
|
|
|
|
|
|
2024-04-04 15:21:44 -05:00
|
|
|
workingDir = project.projectDir
|
|
|
|
|
commandLine 'bash', '-c',
|
|
|
|
|
"source ${venv_name}/bin/activate && set -x && " +
|
|
|
|
|
"./cypress-dev.sh"
|
2024-08-13 15:53:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
task lint {
|
|
|
|
|
dependsOn pythonLint, cypressLint
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
task lintFix {
|
|
|
|
|
dependsOn pythonLintFix
|
|
|
|
|
}
|