pmdtester 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d45c31e2cf8ad4eaba391c13fa0523ade4a84394bc07a908e6a49806a12ebf6
4
- data.tar.gz: fdf6c23a45dc0fd6738e272e564c3c29322dea2285269c1a869608bd77494d8a
3
+ metadata.gz: db98cbb787ccaa595c939ddee83316347edbf0daf746ca38daea53d3dab3fb77
4
+ data.tar.gz: 158cc9f948c7e680725dc2596e4d65dabac35f9f06188c8c4670d060f9889dff
5
5
  SHA512:
6
- metadata.gz: 249c6a07412a2b74405e84fe1780d5cdb8fe4173d32438c7c0fab4f78b5852ec1a63654e3a1219b4889c43e931d00451a361d27924dc0978061035abd7d03322
7
- data.tar.gz: 3f4f7e4bf61f827ff475d9f302f1b73cf1e43c9807ac5b6aaf364d27bbb774db066f7a7af28586aa29ea2365e2664c915944afcedc2d0a112587f1e1cf0efb8a
6
+ metadata.gz: 28ea491ac20cddb4b51f0c418c479ce7394d5839d05dfacd04cb5c128590b7d8100b232a60d4cfafc0110249ccbe001b1e9426632679df4dcf2f6dcdc9415121
7
+ data.tar.gz: 2f12577c68058fb20bbc10e64de84ce574d45e6d7c0c766907b4e4342054bc95f992a654b620ced49130379db66aa5b21425114d327a9332021f04b6544e094a
data/.ci/build.sh CHANGED
@@ -1,67 +1,99 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- source $(dirname $0)/inc/install-openjdk.inc
4
-
3
+ # Exit this script immediately if a command/function exits with a non-zero status.
5
4
  set -e
6
5
 
7
-
8
- function build_regression_tester() {
9
- echo "::group::Install OpenJDK 8+11"
10
- install_openjdk 8
11
- install_openjdk 11 # last one is the default
12
- echo "::endgroup::"
13
-
14
- echo "::group::Install dependencies"
15
- gem install bundler
16
- bundle config set --local path vendor/bundle
17
- bundle install
18
- echo "::endgroup::"
19
-
20
- echo "::group::Build with rake"
21
- bundle exec rake check_manifest
22
- bundle exec rake rubocop
23
- bundle exec rake clean test
24
- echo "::endgroup::"
25
-
26
- echo "::group::Run Integration Tests"
27
- bundle exec rake clean integration-test
28
- echo "::endgroup::"
29
-
30
- echo "::group::Build Package"
31
- bundle exec rake install_gem
32
- bundle exec pmdtester -h
33
- echo "::endgroup::"
34
-
35
- # builds on forks or builds for pull requests stop here
36
- if [[ "${PMD_CI_REPO}" != "pmd/pmd-regression-tester" || -n "${PMD_CI_PULL_REQUEST_NUMBER}" ]]; then
6
+ SCRIPT_INCLUDES="log.bash utils.bash setup-secrets.bash openjdk.bash github-releases-api.bash"
7
+ # shellcheck source=inc/fetch_ci_scripts.bash
8
+ source "$(dirname "$0")/inc/fetch_ci_scripts.bash" && fetch_ci_scripts
9
+
10
+ function build() {
11
+ pmd_ci_log_group_start "Install OpenJDK 8+11"
12
+ pmd_ci_openjdk_install_adoptopenjdk 11
13
+ pmd_ci_openjdk_install_adoptopenjdk 8
14
+ pmd_ci_openjdk_setdefault 11
15
+ pmd_ci_log_group_end
16
+
17
+ pmd_ci_log_group_start "Install dependencies"
18
+ gem install --user-install bundler
19
+ bundle config set --local path vendor/bundle
20
+ bundle install
21
+ pmd_ci_log_group_end
22
+
23
+ echo
24
+ local version
25
+ version="$(bundle exec ruby -I. -e 'require "lib/pmdtester"; print PmdTester::VERSION;')"
26
+ pmd_ci_log_info "======================================================================="
27
+ pmd_ci_log_info "Building pmd-regression-tester ${version}"
28
+ pmd_ci_log_info "======================================================================="
29
+ pmd_ci_utils_determine_build_env pmd/pmd-regression-tester
30
+ echo
31
+
32
+ pmd_ci_log_group_start "Build with rake"
33
+ bundle exec rake check_manifest
34
+ bundle exec rake rubocop
35
+ bundle exec rake clean test
36
+ pmd_ci_log_group_end
37
+
38
+ pmd_ci_log_group_start "Run Integration Tests"
39
+ bundle exec rake clean integration-test
40
+ pmd_ci_log_group_end
41
+
42
+ pmd_ci_log_group_start "Build Package"
43
+ bundle exec rake install_gem
44
+ bundle exec pmdtester -h
45
+ pmd_ci_log_group_end
46
+
47
+ if pmd_ci_utils_is_fork_or_pull_request; then
48
+ # builds on forks or builds for pull requests stop here
37
49
  exit 0
38
50
  fi
39
51
 
40
- # if this is a release build from a tag...
41
- if [[ "${PMD_CI_REPO}" == "pmd/pmd-regression-tester" && "${PMD_CI_GIT_REF}" == refs/tags/* ]]; then
42
- echo "::group::Publish to rubygems"
43
- setup_secrets
44
-
45
- git stash --all
46
- gem build pmdtester.gemspec
47
- gem push pmdtester-*.gem
48
- echo "::endgroup::"
52
+ # only builds on pmd/pmd-regression-tester continue here
53
+ pmd_ci_log_group_start "Setup environment"
54
+ pmd_ci_setup_secrets_private_env
55
+ pmd_ci_log_group_end
56
+
57
+ if isReleaseBuild "$version"; then
58
+ pmd_ci_log_group_start "Publish to rubygems"
59
+ gem build pmdtester.gemspec
60
+ local gempkgfile
61
+ gempkgfile="$(echo pmdtester-*.gem)"
62
+ gem push "${gempkgfile}"
63
+ pmd_ci_log_group_end
64
+
65
+ pmd_ci_log_group_start "Update Github Releases"
66
+ # create a draft github release
67
+ pmd_ci_gh_releases_createDraftRelease "${PMD_CI_TAG}" "$(git rev-list -n 1 "${PMD_CI_TAG}")"
68
+ GH_RELEASE="$RESULT"
69
+
70
+ # Deploy to github releases
71
+ pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "${gempkgfile}"
72
+
73
+ # extract the release notes
74
+ RELEASE_NAME="${version}"
75
+ BEGIN_LINE=$(grep -n "^# " History.md|head -1|cut -d ":" -f 1)
76
+ BEGIN_LINE=$((BEGIN_LINE + 1))
77
+ END_LINE=$(grep -n "^# " History.md|head -2|tail -1|cut -d ":" -f 1)
78
+ END_LINE=$((END_LINE - 1))
79
+ RELEASE_BODY="$(head -$END_LINE History.md | tail -$((END_LINE - BEGIN_LINE)))"
80
+
81
+ pmd_ci_gh_releases_updateRelease "$GH_RELEASE" "$RELEASE_NAME" "$RELEASE_BODY"
82
+
83
+ # Publish release - this sends out notifications on github
84
+ pmd_ci_gh_releases_publishRelease "$GH_RELEASE"
85
+ pmd_ci_log_group_end
49
86
  fi
50
-
51
87
  }
52
88
 
53
- ## helper functions
54
-
55
- function setup_secrets() {
56
- echo "Setting up secrets..."
57
- # Required secrets are: GEM_HOST_API_KEY
58
- local -r env_file=".ci/files/env"
59
- printenv PMD_CI_SECRET_PASSPHRASE | gpg --batch --yes --decrypt \
60
- --passphrase-fd 0 \
61
- --output ${env_file} ${env_file}.gpg
62
- source ${env_file} >/dev/null 2>&1
63
- rm ${env_file}
64
- }
89
+ function isReleaseBuild() {
90
+ local version="$1"
65
91
 
92
+ if [[ "${version}" != *-SNAPSHOT && "${PMD_CI_TAG}" != "" ]]; then
93
+ return 0
94
+ fi
95
+
96
+ return 1
97
+ }
66
98
 
67
- build_regression_tester
99
+ build
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+
3
+ function fetch_ci_scripts() {
4
+ local inc_dir
5
+ local inc_url
6
+ inc_dir="$(dirname "$0")/inc"
7
+ inc_url="${PMD_CI_SCRIPTS_URL:-https://raw.githubusercontent.com/pmd/build-tools/master/scripts}/inc"
8
+
9
+ mkdir -p "${inc_dir}"
10
+
11
+ for f in ${SCRIPT_INCLUDES}; do
12
+ if [ ! -e "${inc_dir}/$f" ]; then
13
+ curl -sSL "${inc_url}/$f" > "${inc_dir}/$f"
14
+ fi
15
+ [ "$PMD_CI_DEBUG" = "true" ] && echo "loading ${inc_dir}/$f in ${MODULE:-$0}"
16
+ # shellcheck source=/dev/null
17
+ source "${inc_dir}/$f" || exit 1
18
+ done
19
+ }
@@ -1,20 +1,37 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- source $(dirname $0)/inc/install-openjdk.inc
4
-
3
+ # Exit this script immediately if a command/function exits with a non-zero status.
5
4
  set -e
6
5
 
7
- echo "::group::Install OpenJDK 8+11"
8
- install_openjdk 8
9
- install_openjdk 11 # last one is the default
10
- echo "::endgroup::"
6
+ SCRIPT_INCLUDES="log.bash utils.bash openjdk.bash"
7
+ # shellcheck source=inc/fetch_ci_scripts.bash
8
+ source "$(dirname "$0")/inc/fetch_ci_scripts.bash" && fetch_ci_scripts
9
+
10
+ function build() {
11
+ pmd_ci_log_group_start "Install OpenJDK 8+11"
12
+ pmd_ci_openjdk_install_adoptopenjdk 11
13
+ pmd_ci_openjdk_install_adoptopenjdk 8
14
+ pmd_ci_openjdk_setdefault 11
15
+ pmd_ci_log_group_end
16
+
17
+ pmd_ci_log_group_start "Install dependencies"
18
+ gem install --user-install bundler
19
+ bundle config set --local path vendor/bundle
20
+ bundle install
21
+ pmd_ci_log_group_end
22
+
23
+ echo
24
+ local version
25
+ version="$(bundle exec ruby -I. -e 'require "lib/pmdtester"; print PmdTester::VERSION;')"
26
+ pmd_ci_log_info "======================================================================="
27
+ pmd_ci_log_info "Building pmd-regression-tester ${version}"
28
+ pmd_ci_log_info "======================================================================="
29
+ pmd_ci_utils_determine_build_env pmd/pmd-regression-tester
30
+ echo
11
31
 
12
- echo "::group::Install dependencies"
13
- gem install bundler
14
- bundle config set --local path vendor/bundle
15
- bundle install
16
- echo "::endgroup::"
32
+ pmd_ci_log_group_start "Run Manual Integration Tests"
33
+ bundle exec ruby -I test test/manual_integration_tests.rb
34
+ pmd_ci_log_group_end
35
+ }
17
36
 
18
- echo "::group::Run Manual Integration Tests"
19
- bundle exec ruby -I test test/manual_integration_tests.rb
20
- echo "::endgroup::"
37
+ build
@@ -2,11 +2,16 @@ name: build
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ master ]
5
+ branches:
6
+ - main
7
+ - master
6
8
  tags:
7
9
  - '**'
8
10
  pull_request:
9
- branches: [ master ]
11
+ schedule:
12
+ # build it monthly: At 04:30 on day-of-month 1.
13
+ - cron: '30 4 1 * *'
14
+ workflow_dispatch:
10
15
 
11
16
  jobs:
12
17
  build:
@@ -21,19 +26,30 @@ jobs:
21
26
  ~/.m2/repository
22
27
  ~/.cache
23
28
  vendor/bundle
29
+ target/repositories
24
30
  key: ${{ runner.os }}-${{ hashFiles('pmdtester.gemspec') }}
25
31
  restore-keys: |
26
32
  ${{ runner.os }}-
27
- - name: Set up Ruby
33
+ - name: Set up Ruby 2.7
28
34
  uses: ruby/setup-ruby@v1
29
35
  with:
30
36
  ruby-version: 2.7
37
+ - name: Setup Environment
38
+ shell: bash
39
+ run: |
40
+ echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
41
+ echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3" >> $GITHUB_ENV
42
+ echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/14/scripts" >> $GITHUB_ENV
43
+ - name: Check Environment
44
+ shell: bash
45
+ run: |
46
+ f=check-environment.sh; \
47
+ mkdir -p .ci && \
48
+ ( [ -e .ci/$f ] || curl -sSL "${PMD_CI_SCRIPTS_URL}/$f" > ".ci/$f" ) && \
49
+ chmod 755 .ci/$f && \
50
+ .ci/$f
31
51
  - name: Build
32
52
  run: .ci/build.sh
33
53
  shell: bash
34
54
  env:
35
- MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
36
55
  PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
37
- PMD_CI_REPO: ${{ github.repository }}
38
- PMD_CI_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
39
- PMD_CI_GIT_REF: ${{ github.ref }}
@@ -14,19 +14,30 @@ jobs:
14
14
  ~/.m2/repository
15
15
  ~/.cache
16
16
  vendor/bundle
17
+ target/repositories
17
18
  key: ${{ runner.os }}-${{ hashFiles('pmdtester.gemspec') }}
18
19
  restore-keys: |
19
20
  ${{ runner.os }}-
20
- - name: Set up Ruby
21
+ - name: Set up Ruby 2.7
21
22
  uses: ruby/setup-ruby@v1
22
23
  with:
23
24
  ruby-version: 2.7
25
+ - name: Setup Environment
26
+ shell: bash
27
+ run: |
28
+ echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
29
+ echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3" >> $GITHUB_ENV
30
+ echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/14/scripts" >> $GITHUB_ENV
31
+ - name: Check Environment
32
+ shell: bash
33
+ run: |
34
+ f=check-environment.sh; \
35
+ mkdir -p .ci && \
36
+ ( [ -e .ci/$f ] || curl -sSL "${PMD_CI_SCRIPTS_URL}/$f" > ".ci/$f" ) && \
37
+ chmod 755 .ci/$f && \
38
+ .ci/$f
24
39
  - name: Build
25
40
  run: .ci/manual-integration-tests.sh
26
41
  shell: bash
27
42
  env:
28
- MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
29
43
  PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }}
30
- PMD_CI_REPO: ${{ github.repository }}
31
- PMD_CI_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
32
- PMD_CI_GIT_REF: ${{ github.ref }}
data/.hoerc CHANGED
@@ -1 +1 @@
1
- exclude: !ruby/regexp /tmp$|\.(git|idea)\/|\.project|target|test\/|Gemfile\.lock|\.bundle\/|vendor\/bundle|localtests/
1
+ exclude: !ruby/regexp /tmp$|\.git\/|\.idea|\.project|target\/|test\/|Gemfile\.lock|\.bundle\/|vendor\/|localtests\/|\.ci\/inc\/(log|utils|setup-secrets|openjdk|github-releases-api)\.bash|\.ci\/files\/|\.ci\/check-environment\.sh/
data/.rubocop.yml CHANGED
@@ -27,3 +27,6 @@ Metrics/ClassLength:
27
27
  Metrics/BlockLength:
28
28
  Exclude:
29
29
  - 'lib/pmdtester/parsers/options.rb'
30
+
31
+ Metrics/ModuleLength:
32
+ CountAsOne: ['array', 'hash']
data/History.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 1.2.0 / 2021-06-20
2
+
3
+ ## New and Noteworthy
4
+
5
+ * Support for Mercurial is removed. The only SCM supported in the project-list.xml is "git".
6
+
7
+ ## Fixed Issues
8
+
9
+ * [#71](https://github.com/pmd/pmd-regression-tester/issues/71): Include full PMD report
10
+ * [#89](https://github.com/pmd/pmd-regression-tester/pull/89): Make it possible to select a subpath of cloned directory
11
+ * [#91](https://github.com/pmd/pmd-regression-tester/pull/91): Filter baseline based on patch config
12
+
1
13
  # 1.1.2 / 2021-04-20
2
14
 
3
15
  This is a bugfix release.
data/Manifest.txt CHANGED
@@ -1,6 +1,5 @@
1
1
  .ci/build.sh
2
- .ci/files/env.gpg
3
- .ci/inc/install-openjdk.inc
2
+ .ci/inc/fetch_ci_scripts.bash
4
3
  .ci/manual-integration-tests.sh
5
4
  .github/workflows/build.yml
6
5
  .github/workflows/manual-integration-tests.yml
@@ -21,6 +20,7 @@ config/design.xml
21
20
  config/project-list.xml
22
21
  config/projectlist_1_0_0.xsd
23
22
  config/projectlist_1_1_0.xsd
23
+ config/projectlist_1_2_0.xsd
24
24
  lib/pmdtester.rb
25
25
  lib/pmdtester/builders/liquid_renderer.rb
26
26
  lib/pmdtester/builders/pmd_report_builder.rb
@@ -58,3 +58,4 @@ resources/js/popper.min.js
58
58
  resources/js/project-report.js
59
59
  resources/project_diff_report.html
60
60
  resources/project_index.html
61
+ resources/project_pmd_report.html
data/README.rdoc CHANGED
@@ -20,29 +20,30 @@ on a list of standard projects(Spring Framework, Hibernate, Solr, etc.)
20
20
  == SYNOPSIS:
21
21
 
22
22
  === Options:
23
- -r, --local-git-repo path to the local PMD repository
24
- -b, --base-branch name of the base branch in local PMD repository
25
- -p, --patch-branch name of the patch branch in local PMD repository
26
- -bc, --base-config path to the base PMD configuration file default:PMDTESTER_INSTALLED_DIR/config/all-java.xml
27
- -pc, --patch-config path to the patch PMD configuration file default:PMDTESTER_INSTALLED_DIR/config/all-java.xml
28
- -c, --config path to the base and patch PMD configuration file
29
- -l, --list-of-project path to the file which contains the list of standard projects default:PMDTESTER_INSTALLED_DIR/config/project-list.xml
30
- -m, --mode the mode of the tool: 'local', 'online' or 'single'
23
+ -r, --local-git-repo path to the local PMD repository
24
+ -b, --base-branch name of the base branch in local PMD repository
25
+ -p, --patch-branch name of the patch branch in local PMD repository
26
+ -bc, --base-config path to the base PMD configuration file
27
+ -pc, --patch-config path to the patch PMD configuration file
28
+ -c, --config path to the base and patch PMD configuration file
29
+ -l, --list-of-project path to the file which contains the list of standard projects
30
+ -m, --mode the mode of the tool: 'local', 'online' or 'single'
31
31
  single: Set this option to 'single' if your patch branch contains changes
32
32
  for any option that can't work on master/base branch
33
33
  online: Set this option to 'online' if you want to download
34
34
  the PMD report of master/base branch rather than generating it locally
35
35
  local: Default option is 'local', PMD reports for the base and patch branches are generated locally.
36
36
 
37
- -t, --threads Sets the number of threads used by PMD. Set threads to 0 to disable multi-threading processing. default:1
38
- -f, --html-flag whether to not generate the html diff report in single mode
39
- -a, --auto-gen-config whether to generate configurations automatically based on branch differences,this option only works in online and local mode
40
- --keep-reports whether to keep old reports and skip running PMD again if possible
41
- -d, --debug whether change log level to DEBUG to see more information
42
- --error-recovery enable error recovery mode when executing PMD. Might help to analyze errors.
43
- --baseline-download-url download url prefix from where to download the baseline in online mode default:https://sourceforge.net/projects/pmd/files/pmd-regression-tester/
44
- -v, --version
45
- -h, --help
37
+ -t, --threads Sets the number of threads used by PMD. Set threads to 0 to disable multi-threading processing.
38
+ -f, --html-flag whether to not generate the html diff report in single mode
39
+ -a, --auto-gen-config whether to generate configurations automatically based on branch differences,this option only works in online and local mode
40
+ --filter-with-patch-config whether to use patch config to filter baseline result as if --auto-gen-config has been used. This option only works in online mode.
41
+ --keep-reports whether to keep old reports and skip running PMD again if possible
42
+ -d, --debug whether change log level to DEBUG to see more information
43
+ --error-recovery enable error recovery mode when executing PMD. Might help to analyze errors.
44
+ --baseline-download-url download url prefix from where to download the baseline in online mode
45
+ -v, --version
46
+ -h, --help
46
47
 
47
48
  === Quick start
48
49
 
@@ -153,4 +154,5 @@ The tool creates the following folders:
153
154
  * Commit ("Prepare next development version x.y.z-SNAPSHOT").
154
155
  * Push to master.
155
156
  * Push the tag. Github Actions will build and publish the new gem
156
- * Update the release notes on https://github.com/pmd/pmd-regression-tester/releases
157
+ * A github release is automatically created, verify it on https://github.com/pmd/pmd-regression-tester/releases
158
+ * To make pmd's main CI use the new version (in [pmd/pmd](https://github.com/pmd/pmd/)), go to the root directory and run `bundle lock --update`. Commit these changes.
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
 
3
3
  <projectlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
- xsi:noNamespaceSchemaLocation="projectlist_1_0_0.xsd">
4
+ xsi:noNamespaceSchemaLocation="projectlist_1_2_0.xsd">
5
5
  <description>Standard Projects</description>
6
6
 
7
7
  <project>
@@ -20,10 +20,11 @@ xsi:noNamespaceSchemaLocation="projectlist_1_0_0.xsd">
20
20
  <tag>v5.0.6.RELEASE</tag>
21
21
  </project>
22
22
 
23
- <!---<project>
24
- <name>openjdk10</name>
25
- <type>hg</type>
26
- <connection>http://hg.openjdk.java.net/jdk10/jdk10/jdk</connection>
27
- <webview-url>http://hg.openjdk.java.net/jdk10/jdk10/jdk/file/777356696811</webview-url>
28
- </project> -->
23
+ <project>
24
+ <name>openjdk-11</name>
25
+ <type>git</type>
26
+ <connection>https://github.com/openjdk/jdk</connection>
27
+ <tag>jdk-11+28</tag>
28
+ <src-subpath>src/java.base</src-subpath>
29
+ </project>
29
30
  </projectlist>