This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch optimize_cov in repository https://gitbox.apache.org/repos/asf/tsfile.git
commit e49c1a63cfe3f385a3e6ffee8440f68d9894ebc0 Author: HTHou <[email protected]> AuthorDate: Fri Aug 2 15:03:10 2024 +0800 Optimize code coverage structure --- .github/workflows/code-coverage.yml | 2 +- code-coverage/copy-code-coverage-sources.sh | 31 ------- code-coverage/pom.xml | 132 ---------------------------- java/pom.xml | 105 ++++++++++++++++++++++ pom.xml | 3 - 5 files changed, 106 insertions(+), 167 deletions(-) diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 3240ee0d..452c935d 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -37,4 +37,4 @@ jobs: uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} - files: code-coverage/target/jacoco-merged-reports/jacoco.xml,cpp/target/build/test/coverage_report/index.html + files: java/target/jacoco-merged-reports/jacoco.xml,cpp/target/build/test/coverage_report/index.html diff --git a/code-coverage/copy-code-coverage-sources.sh b/code-coverage/copy-code-coverage-sources.sh deleted file mode 100755 index 19c24fd1..00000000 --- a/code-coverage/copy-code-coverage-sources.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -# -# 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. -# - -for file in ../java/*/target/*.exec -do - cp $file ./target/ -done - -for file in ../java/*/target/classes -do - echo "copy from" ${file} - cp -r $file ./target/ -done - diff --git a/code-coverage/pom.xml b/code-coverage/pom.xml deleted file mode 100644 index b75bee1e..00000000 --- a/code-coverage/pom.xml +++ /dev/null @@ -1,132 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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. - ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tsfile</groupId> - <artifactId>tsfile-parent</artifactId> - <version>1.0.1-SNAPSHOT</version> - </parent> - <artifactId>tsfile-code-coverage</artifactId> - <packaging>pom</packaging> - <name>TsFile: Code-Coverage</name> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <executions> - <execution> - <id>make-cmake-executable</id> - <goals> - <goal>exec</goal> - </goals> - <phase>process-resources</phase> - <configuration> - <basedir>${project.basedir}</basedir> - <executable>chmod</executable> - <arguments> - <argument>+x</argument> - <argument>copy-code-coverage-sources.sh</argument> - </arguments> - </configuration> - </execution> - <execution> - <id>collect-code-coverage-results</id> - <goals> - <goal>exec</goal> - </goals> - <phase>post-integration-test</phase> - <configuration> - <executable>${project.basedir}/copy-code-coverage-sources.sh</executable> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <configuration> - <rules> - <rule implementation="org.jacoco.maven.RuleConfiguration"> - <element>BUNDLE</element> - <limits> - <!-- Cover methodes >=30%. (the plugin does not support - ignore getter and setter and toString etc..) --> - <limit implementation="org.jacoco.report.check.Limit"> - <counter>METHOD</counter> - <value>COVEREDRATIO</value> - <minimum>0.00</minimum> - </limit> - <!-- if-else, swtich etc.. >=70% --> - <limit implementation="org.jacoco.report.check.Limit"> - <counter>BRANCH</counter> - <value>COVEREDRATIO</value> - <minimum>0.00</minimum> - </limit> - <!-- class files >=95% --> - <limit implementation="org.jacoco.report.check.Limit"> - <counter>CLASS</counter> - <value>COVEREDRATIO</value> - <minimum>0.00</minimum> - </limit> - </limits> - </rule> - </rules> - </configuration> - <executions> - <!-- see https://natritmeyer.com/howto/reporting-aggregated-unit-and-integration-test-coverage-with-jacoco/--> - <execution> - <id>merge-unit-and-integration-final</id> - <goals> - <goal>merge</goal> - </goals> - <phase>post-integration-test</phase> - <configuration> - <fileSets> - <fileSet> - <directory>${project.build.directory}/</directory> - <includes> - <include>*.exec</include> - </includes> - </fileSet> - </fileSets> - <destFile>${project.build.directory}/merged.exec</destFile> - </configuration> - </execution> - <execution> - <id>create-merged-report-final</id> - <goals> - <goal>report</goal> - <goal>check</goal> - </goals> - <phase>post-integration-test</phase> - <configuration> - <dataFile>${project.build.directory}/merged.exec</dataFile> - <outputDirectory>${project.build.directory}/jacoco-merged-reports</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/java/pom.xml b/java/pom.xml index 9f207cd7..f267e3f4 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -102,4 +102,109 @@ </dependency> </dependencies> </dependencyManagement> + <profiles> + <profile> + <id>with-code-coverage</id> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>make-cmake-executable</id> + <goals> + <goal>exec</goal> + </goals> + <phase>process-resources</phase> + <configuration> + <basedir>${project.basedir}</basedir> + <executable>chmod</executable> + <arguments> + <argument>+x</argument> + <argument>copy-code-coverage-sources.sh</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>collect-code-coverage-results</id> + <goals> + <goal>exec</goal> + </goals> + <phase>post-integration-test</phase> + <configuration> + <executable>${project.basedir}/copy-code-coverage-sources.sh</executable> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <configuration> + <rules> + <rule implementation="org.jacoco.maven.RuleConfiguration"> + <element>BUNDLE</element> + <limits> + <!-- Cover methodes >=30%. (the plugin does not support + ignore getter and setter and toString etc..) --> + <limit implementation="org.jacoco.report.check.Limit"> + <counter>METHOD</counter> + <value>COVEREDRATIO</value> + <minimum>0.00</minimum> + </limit> + <!-- if-else, swtich etc.. >=70% --> + <limit implementation="org.jacoco.report.check.Limit"> + <counter>BRANCH</counter> + <value>COVEREDRATIO</value> + <minimum>0.00</minimum> + </limit> + <!-- class files >=95% --> + <limit implementation="org.jacoco.report.check.Limit"> + <counter>CLASS</counter> + <value>COVEREDRATIO</value> + <minimum>0.00</minimum> + </limit> + </limits> + </rule> + </rules> + </configuration> + <executions> + <!-- see https://natritmeyer.com/howto/reporting-aggregated-unit-and-integration-test-coverage-with-jacoco/--> + <execution> + <id>merge-unit-and-integration-final</id> + <goals> + <goal>merge</goal> + </goals> + <phase>post-integration-test</phase> + <configuration> + <fileSets> + <fileSet> + <directory>${project.build.directory}/</directory> + <includes> + <include>*.exec</include> + </includes> + </fileSet> + </fileSets> + <destFile>${project.build.directory}/merged.exec</destFile> + </configuration> + </execution> + <execution> + <id>create-merged-report-final</id> + <goals> + <goal>report</goal> + <goal>check</goal> + </goals> + <phase>post-integration-test</phase> + <configuration> + <dataFile>${project.build.directory}/merged.exec</dataFile> + <outputDirectory>${project.build.directory}/jacoco-merged-reports</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project> diff --git a/pom.xml b/pom.xml index 995c32e3..fbec22c8 100644 --- a/pom.xml +++ b/pom.xml @@ -889,9 +889,6 @@ </profile> <profile> <id>with-code-coverage</id> - <modules> - <module>code-coverage</module> - </modules> <build> <plugins> <!--
