diff --git a/.ci/inc/regression-tester.inc b/.ci/inc/regression-tester.inc index 1083c81e39..ccbef27b8a 100644 --- a/.ci/inc/regression-tester.inc +++ b/.ci/inc/regression-tester.inc @@ -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" diff --git a/Dangerfile b/Dangerfile index f26f7a528e..81977b1ad0 100644 --- a/Dangerfile +++ b/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"