[ci] Update regression tester

* Remove workaround for pre-downloading baseline
  and add baseline-download-url option
* Remove unnecessary travis_wait
* Add error-recovery flag
This commit is contained in:
Andreas Dangel 2020-11-25 11:26:16 +01:00
parent ee2005a88c
commit ff030d1d2d
4 changed files with 29 additions and 30 deletions

View File

@ -115,7 +115,7 @@ cd pmd
git init
git remote add origin https://github.com/pmd/pmd
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/${MAIN_BRANCH}:refs/remotes/origin/${MAIN_BRANCH}
git checkout --progress --force -B master refs/remotes/origin/${MAIN_BRANCH}
git checkout --progress --force -B ${MAIN_BRANCH} refs/remotes/origin/${MAIN_BRANCH}
.ci/check-environment.sh
@ -159,9 +159,11 @@ You'll be dropped into a bash. Use the following script, to setup and start the
```
export MAVEN_OPTS="-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3"
export PMD_CI_BRANCH="master" # base branch
export PMD_CI_BRANCH="master" # base branch of the pull request
export PMD_CI_PULL_REQUEST_NUMBER=2913
unset PMD_CI_SECRET_PASSPHRASE
# these are used by danger
export GITHUB_EVENT_PATH=/workspaces/event.json
export GITHUB_REPOSITORY=pmd/pmd
@ -179,5 +181,5 @@ git checkout --progress --force refs/remotes/pull/${PMD_CI_PULL_REQUEST_NUMBER}/
.ci/check-environment.sh
.ci/build-pr.sh
.ci/build-pr-win-macos.sh
```

View File

@ -61,12 +61,13 @@ function regression_tester_uploadBaseline() {
log_info "Generating and uploading baseline for pmdtester..."
cd ..
bundle config --local gemfile pmd/Gemfile
pmd/.ci/travis_wait "bundle exec pmdtester
--mode single
--local-git-repo ./pmd
--patch-branch ${PMD_CI_BRANCH}
--patch-config ./pmd/.ci/files/all-java.xml
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag"
bundle exec pmdtester \
--mode single \
--local-git-repo ./pmd \
--patch-branch ${PMD_CI_BRANCH} \
--patch-config ./pmd/.ci/files/all-java.xml \
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag \
--error-recovery
cd target/reports
BRANCH_FILENAME="${PMD_CI_BRANCH/\//_}"
zip -q -r ${BRANCH_FILENAME}-baseline.zip ${BRANCH_FILENAME}/
@ -107,7 +108,7 @@ function regression_tester_executeDanger() {
git branch ${PMD_CI_BRANCH} origin/${PMD_CI_BRANCH}
log_debug "Created local branch ${PMD_CI_BRANCH}"
fi
# Fetch more commits of the PR for danger
# Fetch more commits of the PR for danger and regression tester
git fetch --no-tags --depth=50 origin +$(git rev-parse HEAD^2):
log_info "Running danger on branch ${PMD_CI_BRANCH}"

View File

@ -14,12 +14,12 @@ def run_pmdtester
'--patch-config', './pmd/.ci/files/all-java.xml',
'--mode', 'online',
'--auto-gen-config',
'--error-recovery',
'--baseline-download-url', 'https://pmd-code.org/pmd-regression-tester/',
# '--debug',
]
begin
download_baseline(branch_name)
runner = PmdTester::Runner.new(argv)
@new_errors, @removed_errors, @new_violations, @removed_violations, @new_configerrors, @removed_configerrors = runner.run
@summary = PmdTester::Runner.new(argv).run
upload_report
rescue StandardError => e
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
@ -28,14 +28,6 @@ def run_pmdtester
end
end
def download_baseline(branch_name)
branch_filename = branch_name&.tr('/', '_')
url = "https://pmd-code.org/pmd-regression-tester/#{branch_filename}"
cmd = "mkdir -p target/reports; cd target/reports; wget #{url}"
@logger.info "Downloading baseline for branch #{branch_name}: cmd=#{cmd}"
system(cmd)
end
def upload_report
Dir.chdir('target/reports') do
tar_filename = "pr-#{ENV['PMD_CI_PULL_REQUEST_NUMBER']}-diff-report-#{Time.now.strftime("%Y-%m-%dT%H-%M-%SZ")}.tar"
@ -49,11 +41,15 @@ def upload_report
if $?.success?
@logger.info "Successfully uploaded #{tar_filename} to chunk.io"
# set value of sticky to true and the message is kept after new commits are submited to the PR
message("This changeset introduces #{@new_violations} new violations, #{@new_errors} new errors and " +
"#{@new_configerrors} new configuration errors,\n" +
"removes #{@removed_violations} violations, #{@removed_errors} errors and " +
"#{@removed_configerrors} configuration errors.\n" +
# set value of sticky to true and the message is kept after new commits are submitted to the PR
message("This changeset " \
"changes #{@summary[:violations][:changed]} violations,\n" \
"introduces #{@summary[:violations][:new]} new violations, " \
"#{@summary[:errors][:new]} new errors and " \
"#{@summary[:configerrors][:new]} new configuration errors,\n" \
"removes #{@summary[:violations][:removed]} violations, "\
"#{@summary[:errors][:removed]} errors and " \
"#{@summary[:configerrors][:removed]} configuration errors.\n" \
"[Full report](#{report_url.chomp}/diff/index.html)", sticky: true)
else
@logger.error "Error while uploading #{tar_filename} to chunk.io: #{report_url}"

View File

@ -1,6 +1,6 @@
GIT
remote: https://github.com/pmd/pmd-regression-tester.git
revision: 6875868e8be772807498ab46411e44d163633d64
revision: ab54e3494917c9adf7cc236dddfee58094c2ed8a
specs:
pmdtester (1.1.0.pre.SNAPSHOT)
differ (~> 0.1)
@ -41,7 +41,7 @@ GEM
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
fugit (1.4.0)
fugit (1.4.1)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
git (1.7.0)
@ -61,7 +61,7 @@ GEM
public_suffix (4.0.6)
raabro (1.4.0)
rchardet (1.8.0)
rouge (3.24.0)
rouge (3.25.0)
rufus-scheduler (3.6.0)
fugit (~> 1.1, >= 1.1.6)
safe_yaml (1.0.5)
@ -71,7 +71,7 @@ GEM
slop (4.8.2)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tzinfo (2.0.2)
tzinfo (2.0.3)
concurrent-ruby (~> 1.0)
unicode-display_width (1.7.0)