forked from phoedos/pmd
[ci] Upload/download baseline for regression tester from pmd-code.org
Baseline is downloaded before executing regression tester, so that regression tester just reuses it and doesn't try to download from sourceforge. We'll only upload to pmd-code.org. Sourceforge is commented out for now.
This commit is contained in:
parent
b509e9b9a4
commit
ee2005a88c
@ -41,14 +41,17 @@ function regression_tester_setup_ci() {
|
||||
function regression_tester_uploadBaseline() {
|
||||
log_debug "$FUNCNAME branch=${PMD_CI_BRANCH}"
|
||||
local targetUrl="https://sourceforge.net/projects/pmd/files/pmd-regression-tester/"
|
||||
local pmdcodeUrl="https://pmd-code.org/pmd-regression-tester/"
|
||||
|
||||
local errexitstate="$(shopt -po errexit)"
|
||||
set +e # disable errexit
|
||||
(
|
||||
# This handler is called if any command fails
|
||||
function upload_failed() {
|
||||
log_error "Error while uploading ${BRANCH_FILENAME}-baseline.zip to sourceforge!"
|
||||
log_error "Please upload manually: ${targetUrl}"
|
||||
log_error "Error while uploading ${BRANCH_FILENAME}-baseline.zip to pmd-code.org!"
|
||||
log_error "Please upload manually: ${pmdcodeUrl}"
|
||||
#log_error "Error while uploading ${BRANCH_FILENAME}-baseline.zip to sourceforge!"
|
||||
#log_error "Please upload manually: ${targetUrl}"
|
||||
}
|
||||
|
||||
# exit subshell after trap
|
||||
@ -67,8 +70,11 @@ function regression_tester_uploadBaseline() {
|
||||
cd target/reports
|
||||
BRANCH_FILENAME="${PMD_CI_BRANCH/\//_}"
|
||||
zip -q -r ${BRANCH_FILENAME}-baseline.zip ${BRANCH_FILENAME}/
|
||||
../../pmd/.ci/travis_wait "rsync -avh ${BRANCH_FILENAME}-baseline.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd-regression-tester/"
|
||||
log_success "Successfully uploaded ${BRANCH_FILENAME}-baseline.zip to ${targetUrl}"
|
||||
# ssh-key for pmd-code.org is setup already by pmd_ci_setup_ssh
|
||||
scp ${BRANCH_FILENAME}-baseline.zip pmd@pmd-code.org:/httpdocs/pmd-regression-tester/
|
||||
log_success "Successfully uploaded ${BRANCH_FILENAME}-baseline.zip to ${pmdcodeUrl}"
|
||||
#../../pmd/.ci/travis_wait "rsync -avh ${BRANCH_FILENAME}-baseline.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd-regression-tester/"
|
||||
#log_success "Successfully uploaded ${BRANCH_FILENAME}-baseline.zip to ${targetUrl}"
|
||||
)
|
||||
# restore errexit state
|
||||
eval "$errexitstate"
|
||||
|
12
Dangerfile
12
Dangerfile
@ -6,9 +6,10 @@ require 'logger'
|
||||
|
||||
def run_pmdtester
|
||||
Dir.chdir('..') do
|
||||
branch_name = "#{ENV['PMD_CI_BRANCH']}"
|
||||
argv = ['--local-git-repo', './pmd',
|
||||
'--list-of-project', './pmd/.ci/files/project-list.xml',
|
||||
'--base-branch', "#{ENV['PMD_CI_BRANCH']}",
|
||||
'--base-branch', branch_name,
|
||||
'--patch-branch', 'HEAD',
|
||||
'--patch-config', './pmd/.ci/files/all-java.xml',
|
||||
'--mode', 'online',
|
||||
@ -16,6 +17,7 @@ def run_pmdtester
|
||||
# '--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
|
||||
upload_report
|
||||
@ -26,6 +28,14 @@ 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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user