From 9b5d544b6ecb23047f88ed02e5052fe0bdbc2271 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 12 Jan 2023 13:50:25 -0500 Subject: [PATCH 1/2] Add single job to run python coverage --- .../job_PreCommit_Python_Coverage.groovy | 37 +++++++++++++++++++ sdks/python/test-suites/tox/common.gradle | 7 ++-- sdks/python/test-suites/tox/py38/build.gradle | 4 ++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .test-infra/jenkins/job_PreCommit_Python_Coverage.groovy 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..e0d43f2a97c7 --- /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', + 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" From a41b9a47bdc8acbf8325caa94a005d90b0c693a5 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 12 Jan 2023 13:54:11 -0500 Subject: [PATCH 2/2] Fix nameBase --- .test-infra/jenkins/job_PreCommit_Python_Coverage.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.test-infra/jenkins/job_PreCommit_Python_Coverage.groovy b/.test-infra/jenkins/job_PreCommit_Python_Coverage.groovy index e0d43f2a97c7..c0cb48cf6231 100644 --- a/.test-infra/jenkins/job_PreCommit_Python_Coverage.groovy +++ b/.test-infra/jenkins/job_PreCommit_Python_Coverage.groovy @@ -20,7 +20,7 @@ import PrecommitJobBuilder PrecommitJobBuilder builder = new PrecommitJobBuilder( scope: this, - nameBase: 'Python', + nameBase: 'Python_Coverage', gradleTask: ':sdks:python:test-suites:tox:py38:preCommitPyCoverage', timeoutMins: 180, triggerPathPatterns: [