github.com/apache/beam/sdks/v2@v2.48.2/python/test-suites/tox/py38/build.gradle (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one
     3   * or more contributor license agreements.  See the NOTICE file
     4   * distributed with this work for additional information
     5   * regarding copyright ownership.  The ASF licenses this file
     6   * to you under the Apache License, Version 2.0 (the
     7   * License); you may not use this file except in compliance
     8   * with the License.  You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an AS IS BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  /**
    20   * Unit tests for Python 3.8
    21   */
    22  
    23  plugins { id 'org.apache.beam.module' }
    24  applyPythonNature()
    25  
    26  // Required to setup a Python 3 virtualenv and task names.
    27  pythonVersion = '3.8'
    28  
    29  toxTask "formatter", "py3-yapf-check"
    30  check.dependsOn formatter
    31  
    32  apply from: "../common.gradle"
    33  
    34  // TODO(https://github.com/apache/beam/issues/20051): Remove this once tox uses isolated builds.
    35  testPy38Cython.mustRunAfter testPython38, testPy38CloudCoverage
    36  
    37  // TODO(BEAM-12000): Move tasks that aren't specific to 3.8 to Py 3.9.
    38  def posargs = project.findProperty("posargs") ?: ""
    39  
    40  // PyCoverage Precommit runs test suites that evaluate test coverage and compatibility of
    41  // particular dependencies. It is exercised on a single Python version.
    42  project.tasks.register("preCommitPyCoverage") {
    43        dependsOn = ["testPy38CloudCoverage"]
    44  }
    45  
    46  // Create a test task for each supported major version of pyarrow
    47  toxTask "testPy38pyarrow-3", "py38-pyarrow-3", "${posargs}"
    48  test.dependsOn "testPy38pyarrow-3"
    49  preCommitPyCoverage.dependsOn "testPy38pyarrow-3"
    50  
    51  toxTask "testPy38pyarrow-4", "py38-pyarrow-4", "${posargs}"
    52  test.dependsOn "testPy38pyarrow-4"
    53  preCommitPyCoverage.dependsOn "testPy38pyarrow-4"
    54  
    55  toxTask "testPy38pyarrow-5", "py38-pyarrow-5", "${posargs}"
    56  test.dependsOn "testPy38pyarrow-5"
    57  preCommitPyCoverage.dependsOn "testPy38pyarrow-5"
    58  
    59  toxTask "testPy38pyarrow-6", "py38-pyarrow-6", "${posargs}"
    60  test.dependsOn "testPy38pyarrow-6"
    61  preCommitPyCoverage.dependsOn "testPy38pyarrow-6"
    62  
    63  toxTask "testPy38pyarrow-7", "py38-pyarrow-7", "${posargs}"
    64  test.dependsOn "testPy38pyarrow-7"
    65  preCommitPyCoverage.dependsOn "testPy38pyarrow-7"
    66  
    67  toxTask "testPy38pyarrow-8", "py38-pyarrow-8", "${posargs}"
    68  test.dependsOn "testPy38pyarrow-8"
    69  preCommitPyCoverage.dependsOn "testPy38pyarrow-8"
    70  
    71  toxTask "testPy38pyarrow-9", "py38-pyarrow-9", "${posargs}"
    72  test.dependsOn "testPy38pyarrow-9"
    73  preCommitPyCoverage.dependsOn "testPy38pyarrow-9"
    74  
    75  // Create a test task for each minor version of pandas
    76  toxTask "testPy38pandas-14", "py38-pandas-14", "${posargs}"
    77  test.dependsOn "testPy38pandas-14"
    78  preCommitPyCoverage.dependsOn "testPy38pandas-14"
    79  
    80  toxTask "testPy38pandas-15", "py38-pandas-15", "${posargs}"
    81  test.dependsOn "testPy38pandas-15"
    82  preCommitPyCoverage.dependsOn "testPy38pandas-15"
    83  
    84  // Create a test task for each minor version of pytorch
    85  toxTask "testPy38pytorch-19", "py38-pytorch-19", "${posargs}"
    86  test.dependsOn "testPy38pytorch-19"
    87  preCommitPyCoverage.dependsOn "testPy38pytorch-19"
    88  
    89  toxTask "testPy38pytorch-110", "py38-pytorch-110", "${posargs}"
    90  test.dependsOn "testPy38pytorch-110"
    91  preCommitPyCoverage.dependsOn "testPy38pytorch-110"
    92  
    93  toxTask "testPy38pytorch-111", "py38-pytorch-111", "${posargs}"
    94  test.dependsOn "testPy38pytorch-111"
    95  preCommitPyCoverage.dependsOn "testPy38pytorch-111"
    96  
    97  toxTask "testPy38pytorch-112", "py38-pytorch-112", "${posargs}"
    98  test.dependsOn "testPy38pytorch-112"
    99  preCommitPyCoverage.dependsOn "testPy38pytorch-112"
   100  
   101  toxTask "testPy38pytorch-113", "py38-pytorch-113", "${posargs}"
   102  test.dependsOn "testPy38pytorch-113"
   103  preCommitPyCoverage.dependsOn "testPy38pytorch-113"
   104  
   105  toxTask "testPy38pytorch-200", "py38-pytorch-200", "${posargs}"
   106  test.dependsOn "testPy38pytorch-200"
   107  preCommitPyCoverage.dependsOn "testPy38pytorch-200"
   108  
   109  // TODO(https://github.com/apache/beam/issues/25796) - uncomment onnx tox task once onnx supports protobuf 4.x.x
   110  // Create a test task for each minor version of onnx
   111  // toxTask "testPy38onnx-113", "py38-onnx-113", "${posargs}"
   112  // test.dependsOn "testPy38onnx-113"
   113  // preCommitPyCoverage.dependsOn "testPy38onnx-113"
   114  // Create a test task for each minor version of tensorflow
   115  toxTask "testPy38tensorflow-212", "py38-tensorflow-212", "${posargs}"
   116  test.dependsOn "testPy38tensorflow-212"
   117  preCommitPyCoverage.dependsOn "testPy38tensorflow-212"
   118  
   119  toxTask "whitespacelint", "whitespacelint", "${posargs}"
   120  
   121  task archiveFilesToLint(type: Zip) {
   122    archiveFileName = "files-to-whitespacelint.zip"
   123    destinationDirectory = file("$buildDir/dist")
   124  
   125    from ("$rootProject.projectDir") {
   126      include "**/*.md"
   127      include "**/build.gradle"
   128      exclude "**/node_modules/*"
   129    }
   130  }
   131  
   132  task unpackFilesToLint(type: Copy) {
   133    from zipTree("$buildDir/dist/files-to-whitespacelint.zip")
   134    into "$buildDir/files-to-whitespacelint"
   135  }
   136  
   137  whitespacelint.dependsOn archiveFilesToLint, unpackFilesToLint
   138  unpackFilesToLint.dependsOn archiveFilesToLint
   139  archiveFilesToLint.dependsOn cleanPython
   140  
   141  toxTask "jest", "jest", "${posargs}"
   142  
   143  toxTask "eslint", "eslint", "${posargs}"
   144  
   145  task copyTsSource(type: Copy) {
   146    from ("$rootProject.projectDir") {
   147      include "sdks/python/apache_beam/runners/interactive/extensions/**/*"
   148      exclude "sdks/python/apache_beam/runners/interactive/extensions/**/lib/*"
   149      exclude "sdks/python/apache_beam/runners/interactive/extensions/**/node_modules/*"
   150    }
   151    into "$buildDir/ts"
   152  }
   153  
   154  jest.dependsOn copyTsSource
   155  eslint.dependsOn copyTsSource
   156  copyTsSource.dependsOn cleanPython