upload baseline of pmdtester automatically

This commit is contained in:
BBG 2018-07-21 00:49:15 +08:00
parent 0f9bc63bfc
commit 3f030a2784
4 changed files with 65 additions and 2 deletions

View File

@ -29,8 +29,11 @@ before_install:
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
- bash .travis/setup-secrets.sh
- bash .travis/configure-maven.sh
- rvm install 2.4.1
# Install OracleJDK 10 - see https://sormuras.github.io/blog/2018-03-20-jdk-matrix.html
install: . ./install-jdk.sh -F 10 -L BCL
install:
- . ./install-jdk.sh -F 10 -L BCL
- gem install pmdtester --pre
before_script: true
script: source .travis/build-$BUILD.sh
after_success: true

18
.travis/all-java.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<ruleset name="All Java Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>Every Java Rule in PMD</description>
<rule ref="category/java/bestpractices.xml" />
<rule ref="category/java/codestyle.xml" />
<rule ref="category/java/design.xml" />
<rule ref="category/java/documentation.xml" />
<rule ref="category/java/errorprone.xml" />
<rule ref="category/java/multithreading.xml" />
<rule ref="category/java/performance.xml" />
<rule ref="category/java/security.xml" />
</ruleset>

View File

@ -27,8 +27,21 @@ TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}"
fi
}
function upload_baseline() {
cd ..
pmdtester -r ./pmd -p ${TRAVIS_BRANCH} -pc ./pmd/.travis/all-java.xml -l ./pmd/.travis/project-list.xml -f
cd target/reports
zip -q -r ${TRAVIS_BRANCH}-baseline.zip ${TRAVIS_BRANCH}/
rsync -avh ${TRAVIS_BRANCH}-baseline.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd-regression-tester/
if [ $? -ne 0 ]; then
log_error "Error while uploading ${TRAVIS_BRANCH}-baseline.zip to sourceforge!"
log_error "Please upload manually: https://sourceforge.net/projects/pmd/files/pmd-regression-tester/"
else
log_success "Successfully uploaded ${TRAVIS_BRANCH}-baseline.zip to sourceforge"
fi
}
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec)
log_info "Building PMD ${VERSION} on branch ${TRAVIS_BRANCH}"
MVN_BUILD_FLAGS="-B -V"
@ -80,6 +93,8 @@ elif travis_isPush; then
true
)
upload_baseline
else
log_info "This is neither a pull request nor a push. Not executing any build."
exit 1

27
.travis/project-list.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<projectlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="projectlist_1_0_0.xsd">
<description>Standard Projects</description>
<project>
<name>checkstyle</name>
<type>git</type>
<connection>https://github.com/checkstyle/checkstyle</connection>
<tag>checkstyle-8.10</tag>
</project>
<project>
<name>spring-framework</name>
<type>git</type>
<connection>https://github.com/spring-projects/spring-framework</connection>
<tag>v5.0.6.RELEASE</tag>
</project>
<!---<project>
<name>openjdk10</name>
<type>hg</type>
<connection>http://hg.openjdk.java.net/jdk10/jdk10/jdk</connection>
<webview-url>http://hg.openjdk.java.net/jdk10/jdk10/jdk/file/777356696811</webview-url>
</project> -->
</projectlist>