[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:
@ -115,7 +115,7 @@ cd pmd
|
|||||||
git init
|
git init
|
||||||
git remote add origin https://github.com/pmd/pmd
|
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 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
|
.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 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
|
export PMD_CI_PULL_REQUEST_NUMBER=2913
|
||||||
|
|
||||||
|
unset PMD_CI_SECRET_PASSPHRASE
|
||||||
|
|
||||||
# these are used by danger
|
# these are used by danger
|
||||||
export GITHUB_EVENT_PATH=/workspaces/event.json
|
export GITHUB_EVENT_PATH=/workspaces/event.json
|
||||||
export GITHUB_REPOSITORY=pmd/pmd
|
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/check-environment.sh
|
||||||
|
|
||||||
.ci/build-pr.sh
|
.ci/build-pr-win-macos.sh
|
||||||
```
|
```
|
||||||
|
@ -61,12 +61,13 @@ function regression_tester_uploadBaseline() {
|
|||||||
log_info "Generating and uploading baseline for pmdtester..."
|
log_info "Generating and uploading baseline for pmdtester..."
|
||||||
cd ..
|
cd ..
|
||||||
bundle config --local gemfile pmd/Gemfile
|
bundle config --local gemfile pmd/Gemfile
|
||||||
pmd/.ci/travis_wait "bundle exec pmdtester
|
bundle exec pmdtester \
|
||||||
--mode single
|
--mode single \
|
||||||
--local-git-repo ./pmd
|
--local-git-repo ./pmd \
|
||||||
--patch-branch ${PMD_CI_BRANCH}
|
--patch-branch ${PMD_CI_BRANCH} \
|
||||||
--patch-config ./pmd/.ci/files/all-java.xml
|
--patch-config ./pmd/.ci/files/all-java.xml \
|
||||||
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag"
|
--list-of-project ./pmd/.ci/files/project-list.xml --html-flag \
|
||||||
|
--error-recovery
|
||||||
cd target/reports
|
cd target/reports
|
||||||
BRANCH_FILENAME="${PMD_CI_BRANCH/\//_}"
|
BRANCH_FILENAME="${PMD_CI_BRANCH/\//_}"
|
||||||
zip -q -r ${BRANCH_FILENAME}-baseline.zip ${BRANCH_FILENAME}/
|
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}
|
git branch ${PMD_CI_BRANCH} origin/${PMD_CI_BRANCH}
|
||||||
log_debug "Created local branch ${PMD_CI_BRANCH}"
|
log_debug "Created local branch ${PMD_CI_BRANCH}"
|
||||||
fi
|
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):
|
git fetch --no-tags --depth=50 origin +$(git rev-parse HEAD^2):
|
||||||
|
|
||||||
log_info "Running danger on branch ${PMD_CI_BRANCH}"
|
log_info "Running danger on branch ${PMD_CI_BRANCH}"
|
||||||
|
28
Dangerfile
28
Dangerfile
@ -14,12 +14,12 @@ def run_pmdtester
|
|||||||
'--patch-config', './pmd/.ci/files/all-java.xml',
|
'--patch-config', './pmd/.ci/files/all-java.xml',
|
||||||
'--mode', 'online',
|
'--mode', 'online',
|
||||||
'--auto-gen-config',
|
'--auto-gen-config',
|
||||||
|
'--error-recovery',
|
||||||
|
'--baseline-download-url', 'https://pmd-code.org/pmd-regression-tester/',
|
||||||
# '--debug',
|
# '--debug',
|
||||||
]
|
]
|
||||||
begin
|
begin
|
||||||
download_baseline(branch_name)
|
@summary = PmdTester::Runner.new(argv).run
|
||||||
runner = PmdTester::Runner.new(argv)
|
|
||||||
@new_errors, @removed_errors, @new_violations, @removed_violations, @new_configerrors, @removed_configerrors = runner.run
|
|
||||||
upload_report
|
upload_report
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
|
warn("Running pmdtester failed, this message is mainly used to remind the maintainers of PMD.")
|
||||||
@ -28,14 +28,6 @@ def run_pmdtester
|
|||||||
end
|
end
|
||||||
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
|
def upload_report
|
||||||
Dir.chdir('target/reports') do
|
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"
|
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?
|
if $?.success?
|
||||||
@logger.info "Successfully uploaded #{tar_filename} to chunk.io"
|
@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
|
# set value of sticky to true and the message is kept after new commits are submitted to the PR
|
||||||
message("This changeset introduces #{@new_violations} new violations, #{@new_errors} new errors and " +
|
message("This changeset " \
|
||||||
"#{@new_configerrors} new configuration errors,\n" +
|
"changes #{@summary[:violations][:changed]} violations,\n" \
|
||||||
"removes #{@removed_violations} violations, #{@removed_errors} errors and " +
|
"introduces #{@summary[:violations][:new]} new violations, " \
|
||||||
"#{@removed_configerrors} configuration errors.\n" +
|
"#{@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)
|
"[Full report](#{report_url.chomp}/diff/index.html)", sticky: true)
|
||||||
else
|
else
|
||||||
@logger.error "Error while uploading #{tar_filename} to chunk.io: #{report_url}"
|
@logger.error "Error while uploading #{tar_filename} to chunk.io: #{report_url}"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: https://github.com/pmd/pmd-regression-tester.git
|
remote: https://github.com/pmd/pmd-regression-tester.git
|
||||||
revision: 6875868e8be772807498ab46411e44d163633d64
|
revision: ab54e3494917c9adf7cc236dddfee58094c2ed8a
|
||||||
specs:
|
specs:
|
||||||
pmdtester (1.1.0.pre.SNAPSHOT)
|
pmdtester (1.1.0.pre.SNAPSHOT)
|
||||||
differ (~> 0.1)
|
differ (~> 0.1)
|
||||||
@ -41,7 +41,7 @@ GEM
|
|||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
faraday-http-cache (1.3.1)
|
faraday-http-cache (1.3.1)
|
||||||
faraday (~> 0.8)
|
faraday (~> 0.8)
|
||||||
fugit (1.4.0)
|
fugit (1.4.1)
|
||||||
et-orbi (~> 1.1, >= 1.1.8)
|
et-orbi (~> 1.1, >= 1.1.8)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
git (1.7.0)
|
git (1.7.0)
|
||||||
@ -61,7 +61,7 @@ GEM
|
|||||||
public_suffix (4.0.6)
|
public_suffix (4.0.6)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
rchardet (1.8.0)
|
rchardet (1.8.0)
|
||||||
rouge (3.24.0)
|
rouge (3.25.0)
|
||||||
rufus-scheduler (3.6.0)
|
rufus-scheduler (3.6.0)
|
||||||
fugit (~> 1.1, >= 1.1.6)
|
fugit (~> 1.1, >= 1.1.6)
|
||||||
safe_yaml (1.0.5)
|
safe_yaml (1.0.5)
|
||||||
@ -71,7 +71,7 @@ GEM
|
|||||||
slop (4.8.2)
|
slop (4.8.2)
|
||||||
terminal-table (1.8.0)
|
terminal-table (1.8.0)
|
||||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||||
tzinfo (2.0.2)
|
tzinfo (2.0.3)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
unicode-display_width (1.7.0)
|
unicode-display_width (1.7.0)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user