| /* | |
| * Licensed to the Apache Software Foundation (ASF) under one | |
| * or more contributor license agreements. See the NOTICE file | |
| * distributed with this work for additional information | |
| * regarding copyright ownership. The ASF licenses this file | |
| * to you under the Apache License, Version 2.0 (the | |
| * License); you may not use this file except in compliance | |
| * with the License. You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an AS IS BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| /** | |
| * Unit tests for Python 3.10 | |
| */ | |
| plugins { id 'org.apache.beam.module' } | |
| applyPythonNature() | |
| // Required to setup a Python 3 virtualenv and task names. | |
| pythonVersion = '3.10' | |
| def posargs = project.findProperty("posargs") ?: "" | |
| apply from: "../common.gradle" | |
| toxTask "testPy310CloudCoverage", "py310-cloudcoverage", "${posargs}" | |
| test.dependsOn "testPy310CloudCoverage" | |
| project.tasks.register("preCommitPyCoverage") { | |
| dependsOn = ["testPy310CloudCoverage"] | |
| } | |
| // Dep Postcommit runs test suites that evaluate compatibility of particular | |
| // dependencies. Each suite is exercised on at most one python version. | |
| // | |
| // Should still leave at least one version in PreCommit unless the marked tests | |
| // are also exercised by existing PreCommit | |
| // e.g. pyarrow and pandas also run on PreCommit Dataframe and Coverage | |
| project.tasks.register("postCommitPyDep") {} | |
| // Create a test task for supported major versions of pyarrow. | |
| // Keep in sync with [testenv:py{310,311}-pyarrow-...] in tox.ini | |
| // (versions released in roughly the last 1-2 years). | |
| toxTask "testPy310pyarrow-17", "py310-pyarrow-17", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-17" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-17" | |
| toxTask "testPy310pyarrow-18", "py310-pyarrow-18", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-18" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-18" | |
| toxTask "testPy310pyarrow-19", "py310-pyarrow-19", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-19" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-19" | |
| toxTask "testPy310pyarrow-20", "py310-pyarrow-20", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-20" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-20" | |
| toxTask "testPy310pyarrow-21", "py310-pyarrow-21", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-21" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-21" | |
| toxTask "testPy310pyarrow-22", "py310-pyarrow-22", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-22" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-22" | |
| toxTask "testPy310pyarrow-23", "py310-pyarrow-23", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-23" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-23" | |
| toxTask "testPy310pyarrow-24", "py310-pyarrow-24", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-24" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-24" | |
| toxTask "testPy310pyarrow-25", "py310-pyarrow-25", "${posargs}" | |
| test.dependsOn "testPy310pyarrow-25" | |
| postCommitPyDep.dependsOn "testPy310pyarrow-25" | |
| // Create a test task for each supported minor version of pandas | |
| toxTask "testPy310pandas-14", "py310-pandas-14", "${posargs}" | |
| test.dependsOn "testPy310pandas-14" | |
| postCommitPyDep.dependsOn "testPy310pandas-14" | |
| toxTask "testPy310pandas-15", "py310-pandas-15", "${posargs}" | |
| test.dependsOn "testPy310pandas-15" | |
| postCommitPyDep.dependsOn "testPy310pandas-15" | |
| toxTask "testPy310pandas-20", "py310-pandas-20", "${posargs}" | |
| test.dependsOn "testPy310pandas-20" | |
| postCommitPyDep.dependsOn "testPy310pandas-20" | |
| // TODO(https://github.com/apache/beam/issues/31192): Add below suites | |
| // after dependency compat tests suite switches to Python 3.9 or we add | |
| // Python 2.2 support. | |
| // toxTask "testPy310pandas-21", "py310-pandas-21", "${posargs}" | |
| // test.dependsOn "testPy310pandas-21" | |
| // postCommitPyDep.dependsOn "testPy310pandas-21" | |
| // toxTask "testPy310pandas-22", "py310-pandas-22", "${posargs}" | |
| // test.dependsOn "testPy310pandas-22" | |
| // postCommitPyDep.dependsOn "testPy310pandas-22" | |
| // TODO(https://github.com/apache/beam/issues/30908): Revise what are we testing | |
| // Create a test task for each minor version of pytorch | |
| toxTask "testPy310pytorch-111", "py310-pytorch-111", "${posargs}" | |
| test.dependsOn "testPy310pytorch-111" | |
| postCommitPyDep.dependsOn "testPy310pytorch-111" | |
| toxTask "testPy310pytorch-112", "py310-pytorch-112", "${posargs}" | |
| test.dependsOn "testPy310pytorch-112" | |
| postCommitPyDep.dependsOn "testPy310pytorch-112" | |
| toxTask "testPy310pytorch-113", "py310-pytorch-113", "${posargs}" | |
| test.dependsOn "testPy310pytorch-113" | |
| postCommitPyDep.dependsOn "testPy310pytorch-113" | |
| // run on precommit | |
| toxTask "testPy310pytorch-200", "py310-pytorch-200", "${posargs}" | |
| test.dependsOn "testPy310pytorch-200" | |
| postCommitPyDep.dependsOn "testPy310pytorch-200" | |
| toxTask "testPy310tft-113", "py310-tft-113", "${posargs}" | |
| test.dependsOn "testPy310tft-113" | |
| postCommitPyDep.dependsOn "testPy310tft-113" | |
| // TODO(https://github.com/apache/beam/issues/25796) - uncomment onnx tox task once onnx supports protobuf 4.x.x | |
| // Create a test task for each minor version of onnx | |
| // toxTask "testPy310onnx-113", "py310-onnx-113", "${posargs}" | |
| // test.dependsOn "testPy310onnx-113" | |
| // postCommitPyDep.dependsOn "testPy310onnx-113" | |
| // Create a test task for each minor version of tensorflow | |
| toxTask "testPy310tensorflow-212", "py310-tensorflow-212", "${posargs}" | |
| test.dependsOn "testPy310tensorflow-212" | |
| postCommitPyDep.dependsOn "testPy310tensorflow-212" | |
| // Create a test task for each minor version of transformers | |
| toxTask "testPy310transformers-428", "py310-transformers-428", "${posargs}" | |
| test.dependsOn "testPy310transformers-428" | |
| postCommitPyDep.dependsOn "testPy310transformers-428" | |
| toxTask "testPy310transformers-447", "py310-transformers-447", "${posargs}" | |
| test.dependsOn "testPy310transformers-447" | |
| postCommitPyDep.dependsOn "testPy310transformers-447" | |
| toxTask "testPy310transformers-latest", "py310-transformers-latest", "${posargs}" | |
| test.dependsOn "testPy310transformers-latest" | |
| postCommitPyDep.dependsOn "testPy310transformers-latest" | |
| toxTask "testPy310embeddingsMLTransform", "py310-embeddings", "${posargs}" | |
| test.dependsOn "testPy310embeddingsMLTransform" | |
| postCommitPyDep.dependsOn "testPy310embeddingsMLTransform" | |
| // Part of MLTransform embeddings test suite but requires tensorflow hub, which we need to test on | |
| // mutliple versions so keeping this suite separate. | |
| toxTask "testPy310TensorflowHubEmbeddings-014", "py310-TFHubEmbeddings-014", "${posargs}" | |
| test.dependsOn "testPy310TensorflowHubEmbeddings-014" | |
| postCommitPyDep.dependsOn "testPy310TensorflowHubEmbeddings-014" | |
| toxTask "testPy310TensorflowHubEmbeddings-015", "py310-TFHubEmbeddings-015", "${posargs}" | |
| test.dependsOn "testPy310TensorflowHubEmbeddings-015" | |
| postCommitPyDep.dependsOn "testPy310TensorflowHubEmbeddings-015" | |
| toxTask "whitespacelint", "whitespacelint", "${posargs}" | |
| task archiveFilesToLint(type: Zip) { | |
| archiveFileName = "files-to-whitespacelint.zip" | |
| destinationDirectory = file("$buildDir/dist") | |
| from ("$rootProject.projectDir") { | |
| include "**/*.md" | |
| include "**/build.gradle" | |
| include '**/build.gradle.kts' | |
| exclude '**/build/**' // intermediate build directory | |
| exclude 'website/www/site/themes/docsy/**' // fork to google/docsy | |
| exclude "**/node_modules/*" | |
| exclude "**/.gogradle/*" | |
| } | |
| } | |
| task unpackFilesToLint(type: Copy) { | |
| from zipTree("$buildDir/dist/files-to-whitespacelint.zip") | |
| into "$buildDir/files-to-whitespacelint" | |
| } | |
| whitespacelint.dependsOn archiveFilesToLint, unpackFilesToLint | |
| unpackFilesToLint.dependsOn archiveFilesToLint | |
| archiveFilesToLint.dependsOn cleanPython | |
| toxTask "jest", "jest", "${posargs}" | |
| toxTask "eslint", "eslint", "${posargs}" | |
| task copyTsSource(type: Copy) { | |
| from ("$rootProject.projectDir") { | |
| include "sdks/python/apache_beam/runners/interactive/extensions/**/*" | |
| exclude "sdks/python/apache_beam/runners/interactive/extensions/**/lib/*" | |
| exclude "sdks/python/apache_beam/runners/interactive/extensions/**/node_modules/*" | |
| } | |
| into "$buildDir/ts" | |
| } | |
| jest.dependsOn copyTsSource | |
| eslint.dependsOn copyTsSource | |
| copyTsSource.dependsOn cleanPython |