diff --git a/.test-infra/jenkins/job_PreCommit_Python_Coverage.groovy b/.test-infra/jenkins/job_PreCommit_Python_Coverage.groovy new file mode 100644 index 000000000000..c0cb48cf6231 --- /dev/null +++ b/.test-infra/jenkins/job_PreCommit_Python_Coverage.groovy @@ -0,0 +1,37 @@ +/* + * 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. + */ + +import PrecommitJobBuilder + +PrecommitJobBuilder builder = new PrecommitJobBuilder( + scope: this, + nameBase: 'Python_Coverage', + gradleTask: ':sdks:python:test-suites:tox:py38:preCommitPyCoverage', + timeoutMins: 180, + triggerPathPatterns: [ + '^model/.*$', + '^sdks/python/.*$', + '^release/.*$', + ] + ) +builder.build { + // Publish all test results to Jenkins. + publishers { + archiveJunit('**/pytest*.xml') + } +} diff --git a/sdks/python/test-suites/tox/common.gradle b/sdks/python/test-suites/tox/common.gradle index 5f5a1012f563..596738178ed1 100644 --- a/sdks/python/test-suites/tox/common.gradle +++ b/sdks/python/test-suites/tox/common.gradle @@ -36,10 +36,11 @@ toxTask "testPy38CloudCoverage", "py38-cloudcoverage", "${posargs}" test.dependsOn "testPy38CloudCoverage" project.tasks.register("preCommitPy${pythonVersionSuffix}") { - // Generates coverage reports only once, in Py38, to remove duplicated work + // Since codecoverage reports will always be generated for py38, + // all tests will be exercised. if (pythonVersionSuffix.equals('38')) { - dependsOn = ["testPy38CloudCoverage", "testPy38Cython"] + dependsOn = ["testPy38Cython"] } else { dependsOn = ["testPy${pythonVersionSuffix}Cloud", "testPy${pythonVersionSuffix}Cython"] } -} +} \ No newline at end of file diff --git a/sdks/python/test-suites/tox/py38/build.gradle b/sdks/python/test-suites/tox/py38/build.gradle index aa52e3736d48..072beb172cfd 100644 --- a/sdks/python/test-suites/tox/py38/build.gradle +++ b/sdks/python/test-suites/tox/py38/build.gradle @@ -126,6 +126,10 @@ task archiveFilesToLint(type: Zip) { } } +project.tasks.register("preCommitPyCoverage") { + dependsOn = ["testPy38CloudCoverage"] +} + task unpackFilesToLint(type: Copy) { from zipTree("$buildDir/dist/files-to-whitespacelint.zip") into "$buildDir/files-to-whitespacelint"