diff --git a/.github/quality-gates.json b/.github/quality-gates.json new file mode 100644 index 00000000..ad7c3cc5 --- /dev/null +++ b/.github/quality-gates.json @@ -0,0 +1,32 @@ +{ + "qualityGates": [ + { + "metric": "tests-success-rate", + "name": "Tests Success Rate", + "threshold": 100.0, + "criticality": "FAILURE" + }, + { + "metric": "line", + "threshold": 80.0, + "criticality": "UNSTABLE" + }, + { + "metric": "branch", + "threshold": 80.0, + "criticality": "UNSTABLE" + }, + { + "metric": "bugs", + "name": "Potential Bugs", + "threshold": 0.0, + "criticality": "FAILURE" + }, + { + "metric": "style", + "name": "Style Violations", + "threshold": 0.0, + "criticality": "FAILURE" + } + ] +} diff --git a/.github/quality-monitor.json b/.github/quality-monitor.json new file mode 100644 index 00000000..7e675b46 --- /dev/null +++ b/.github/quality-monitor.json @@ -0,0 +1,145 @@ +{ + "tests": { + "name": "Tests", + "tools": [ + { + "id": "junit", + "name": "Unit Tests", + "pattern": "**/target/surefire-reports/TEST*data*.xml" + }, + { + "id": "junit", + "icon": "rocket", + "name": "Integration Tests", + "pattern": "**/target/failsafe-reports/TEST*.xml" + }, + { + "id": "junit", + "icon": "no_entry", + "name": "Architecture Tests", + "pattern": "**/target/surefire-reports/TEST*archunit*.xml" + } + ] + }, + "analysis": [ + { + "name": "Style", + "id": "style", + "tools": [ + { + "id": "checkstyle", + "pattern": "**/target/**checkstyle-result.xml" + }, + { + "id": "pmd", + "pattern": "**/target/pmd-*/pmd.xml" + }, + { + "id": "java", + "icon": "coffee", + "pattern": "**/maven.log" + } + ] + }, + { + "name": "Bugs", + "id": "bugs", + "icon": "bug", + "tools": [ + { + "id": "spotbugs", + "sourcePath": "src/main/java", + "pattern": "**/target/spotbugsXml.xml" + }, + { + "id": "error-prone", + "pattern": "**/maven.log" + } + ] + }, + { + "name": "API Problems", + "id": "api", + "icon": "no_entry_sign", + "tools": [ + { + "id": "revapi", + "sourcePath": "src/main/java", + "pattern": "**/target/revapi-result.json" + } + ] + }, + { + "name": "Vulnerabilities", + "id": "vulnerabilities", + "icon": "shield", + "tools": [ + { + "icon": "shield", + "id": "owasp-dependency-check", + "icon": "shield", + "pattern": "**/target/dependency-check-report.json" + } + ] + } + ], + "coverage": [ + { + "name": "Code Coverage", + "tools": [ + { + "id": "jacoco", + "metric": "line", + "sourcePath": "src/main/java", + "pattern": "**/target/site/jacoco/jacoco.xml" + }, + { + "id": "jacoco", + "metric": "branch", + "sourcePath": "src/main/java", + "pattern": "**/target/site/jacoco/jacoco.xml" + } + ] + } + ], + "metrics": { + "name": "Software Metrics", + "tools": [ + { + "id": "metrics", + "pattern": "**/metrics/pmd.xml", + "metric": "CYCLOMATIC_COMPLEXITY" + }, + { + "id": "metrics", + "pattern": "**/metrics/pmd.xml", + "metric": "COGNITIVE_COMPLEXITY" + }, + { + "id": "metrics", + "pattern": "**/metrics/pmd.xml", + "metric": "NPATH_COMPLEXITY" + }, + { + "id": "metrics", + "pattern": "**/metrics/pmd.xml", + "metric": "LOC" + }, + { + "id": "metrics", + "pattern": "**/metrics/pmd.xml", + "metric": "NCSS" + }, + { + "id": "metrics", + "pattern": "**/metrics/pmd.xml", + "metric": "COHESION" + }, + { + "id": "metrics", + "pattern": "**/metrics/pmd.xml", + "metric": "WEIGHT_OF_CLASS" + } + ] + } +} diff --git a/.github/workflows/check-md-links.yml b/.github/workflows/check-md-links.yml index 507ba58d..016aa167 100644 --- a/.github/workflows/check-md-links.yml +++ b/.github/workflows/check-md-links.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v5 - - uses: umbrelladocs/action-linkspector@v1.3.7 + - uses: umbrelladocs/action-linkspector@v1.4.0 with: github_token: ${{ secrets.github_token }} reporter: github-pr-check diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 640de6af..c8061253 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,7 +38,7 @@ jobs: maven-version: 3.9.11 - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} queries: +security-and-quality @@ -47,7 +47,7 @@ jobs: run: mvn -V --color always -ntp clean verify -Pskip - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 with: upload: false output: sarif-results @@ -62,6 +62,6 @@ jobs: output: sarif-results/${{ matrix.language }}.sarif - name: Upload SARIF results - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v4 with: sarif_file: sarif-results/${{ matrix.language }}.sarif diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 92077b74..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 'CodeCov' - -on: - push: - branches: - - main - pull_request: - -jobs: - coverage: - - runs-on: ubuntu-latest - name: Create and upload coverage report - - steps: - - uses: actions/checkout@v5 - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: '21' - check-latest: true - cache: 'maven' - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.11 - - name: Generate coverage with JaCoCo - run: mvn -V --color always -ntp clean verify -Pci - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.5.1 - with: - file: 'target/site/jacoco/jacoco.xml' - disable_search: true - token: ${{secrets.CODECOV_TOKEN}} diff --git a/.github/workflows/quality-monitor-build.yml b/.github/workflows/quality-monitor-build.yml new file mode 100644 index 00000000..c4d695a6 --- /dev/null +++ b/.github/workflows/quality-monitor-build.yml @@ -0,0 +1,59 @@ +name: 'Quality Monitor Build' + +on: + pull_request: + +jobs: + build: + runs-on: [ubuntu-latest] + name: Create quality reports + + steps: + - name: Checkout PR + uses: actions/checkout@v5 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: 21 + check-latest: true + cache: 'maven' + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.11 + - name: Cache the NVD database + uses: actions/cache@v4 + with: + path: ~/.m2/repository/org/owasp/dependency-check-data + key: dependency-check + - name: Check if quality monitor reports mutation coverage + run: | + FILE='.github/quality-monitor.json' + PATTERN='target/pit-reports/mutations.xml' + if [ -f "$FILE" ]; then + if grep -q "$PATTERN" "$FILE"; then + echo "PIT=-Ppit" >> "$GITHUB_ENV" + fi + fi + - name: Build with Maven + env: + NVD_API_KEY: ${{ secrets.NVD_API_KEY }} + OSS_INDEX_TOKEN: ${{ secrets.OSS_INDEX_TOKEN }} + PIT: ${{ env.PIT }} + BROWSER: chrome-container + run: | + mvn -V --color always -ntp clean verify $PIT -Pci -Powasp | tee maven.log + if [ "${PIPESTATUS[0]}" != "0" ]; then + exit 1; + fi + mv -fv maven.log target/maven.log + - name: Upload Quality Reports + uses: actions/upload-artifact@v4 + with: + name: quality-reports + path: | + **/target/**/*.json + **/target/**/*.xml + **/target/**/*.log + diff --git a/.github/workflows/quality-monitor-comment.yml b/.github/workflows/quality-monitor-comment.yml new file mode 100644 index 00000000..648b197d --- /dev/null +++ b/.github/workflows/quality-monitor-comment.yml @@ -0,0 +1,52 @@ +name: 'Quality Monitor Comment' + +on: + workflow_run: + workflows: [ "Quality Monitor Build" ] + types: [ completed ] + +permissions: + actions: read + contents: read + pull-requests: write + checks: write + +jobs: + comment: + if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }} + runs-on: ubuntu-latest + name: Comment on PR + + steps: + - name: Extract PR number and SHA + id: pr + run: | + pr_number='${{ github.event.workflow_run.pull_requests[0].number }}' + echo "number=$pr_number" >> "$GITHUB_OUTPUT" + sha='${{ github.event.workflow_run.head_sha }}' + echo "sha=$sha" >> "$GITHUB_OUTPUT" + - name: Checkout PR + uses: actions/checkout@v5 + with: + ref: ${{ steps.pr.outputs.sha }} + - name: Download PR Quality Reports from Quality Monitor Build workflow + uses: dawidd6/action-download-artifact@v11 + with: + run_id: ${{ github.event.workflow_run.id }} + name: quality-reports + - name: Read Quality Monitor Configuration + id: quality-monitor + run: echo "json=$(jq -c . .github/quality-monitor.json)" >> "$GITHUB_OUTPUT" + - name: Read Quality Gates Configuration + id: quality-gates + run: echo "json=$(jq -c . .github/quality-gates.json)" >> "$GITHUB_OUTPUT" + - name: Run Quality Monitor and Comment on PR + uses: uhafner/quality-monitor@v3 + with: + sha: ${{ steps.pr.outputs.sha }} + config: ${{ steps.quality-monitor.outputs.json }} + quality-gates: ${{ steps.quality-gates.outputs.json }} + pr-number: ${{ steps.pr.outputs.number }} + comments-strategy: REMOVE + show-headers: true + title-metric: none diff --git a/.github/workflows/quality-monitor-jenkins.yml b/.github/workflows/quality-monitor-jenkins.yml deleted file mode 100644 index fca447d0..00000000 --- a/.github/workflows/quality-monitor-jenkins.yml +++ /dev/null @@ -1,176 +0,0 @@ -name: 'Quality Monitor PR' - -on: - pull_request_target: - -jobs: - build: - - runs-on: [ubuntu-latest] - name: Build, test and monitor quality on Ubuntu - - steps: - - name: 'Checkout merge commit' - uses: actions/checkout@v5 - with: - ref: "${{ github.event.pull_request.merge_commit_sha }}" - if: github.event.pull_request.merge_commit_sha != '' - - name: 'Checkout PR head commit' - uses: actions/checkout@v5 - with: - ref: "${{ github.event.pull_request.head.sha }}" - if: github.event.pull_request.merge_commit_sha == '' - - name: Set up JDK 21 - uses: actions/setup-java@v5 - with: - distribution: 'temurin' - java-version: 21 - check-latest: true - cache: 'maven' - - name: Set up Maven - uses: stCarolas/setup-maven@v5 - with: - maven-version: 3.9.11 - - name: Cache the NVD database - uses: actions/cache@v4 - with: - path: ~/.m2/repository/org/owasp/dependency-check-data - key: dependency-check - - name: Build with Maven - env: - BROWSER: chrome-container - NVD_API_KEY: ${{ secrets.NVD_API_KEY }} - run: mvn -V --color always -ntp clean verify -Pci -Powasp | tee maven.log - - name: Extract pull request number - uses: jwalton/gh-find-current-pr@v1 - id: pr - - name: Run Quality Monitor - uses: uhafner/quality-monitor@v3 - with: - pr-number: ${{ steps.pr.outputs.number }} - show-headers: true - config: > - { - "tests": { - "name": "Tests", - "tools": [ - { - "id": "junit", - "name": "Unit Tests", - "pattern": "**/target/surefire-reports/TEST*metrics*.xml" - }, - { - "id": "junit", - "icon": "rocket", - "name": "Integration Tests", - "pattern": "**/target/failsafe-reports/TEST*.xml" - }, - { - "id": "junit", - "icon": "no_entry", - "name": "Architecture Tests", - "pattern": "**/target/surefire-reports/TEST*archunit*.xml" - } - ] - }, - "analysis": [ - { - "name": "Style", - "id": "style", - "tools": [ - { - "id": "checkstyle", - "pattern": "**/target/checkstyle-*/checkstyle-result.xml" - }, - { - "id": "pmd", - "pattern": "**/target/pmd-*/pmd.xml" - } - ] - }, - { - "name": "Bugs", - "id": "bugs", - "icon": "bug", - "tools": [ - { - "id": "spotbugs", - "sourcePath": "src/main/java", - "pattern": "**/target/spotbugsXml.xml" - } - ] - }, - { - "name": "Vulnerabilities", - "id": "vulnerabilities", - "icon": "shield", - "tools": [ - { - "id": "owasp-dependency-check", - "icon": "shield", - "pattern": "**/target/dependency-check-report.json" - } - ] - } - ], - "coverage": [ - { - "name": "Code Coverage", - "tools": [ - { - "id": "jacoco", - "metric": "line", - "sourcePath": "src/main/java", - "pattern": "**/target/site/jacoco/jacoco.xml" - }, - { - "id": "jacoco", - "metric": "branch", - "sourcePath": "src/main/java", - "pattern": "**/target/site/jacoco/jacoco.xml" - } - ] - } - ], - "metrics": - { - "name": "Software Metrics", - "tools": [ - { - "id": "metrics", - "pattern": "**/metrics/pmd.xml", - "metric": "CYCLOMATIC_COMPLEXITY" - }, - { - "id": "metrics", - "pattern": "**/metrics/pmd.xml", - "metric": "COGNITIVE_COMPLEXITY" - }, - { - "id": "metrics", - "pattern": "**/metrics/pmd.xml", - "metric": "NPATH_COMPLEXITY" - }, - { - "id": "metrics", - "pattern": "**/metrics/pmd.xml", - "metric": "LOC" - }, - { - "id": "metrics", - "pattern": "**/metrics/pmd.xml", - "metric": "NCSS" - }, - { - "id": "metrics", - "pattern": "**/metrics/pmd.xml", - "metric": "COHESION" - }, - { - "id": "metrics", - "pattern": "**/metrics/pmd.xml", - "metric": "WEIGHT_OF_CLASS" - } - ] - } - } diff --git a/plugin/etc/assertj-templates/assertion_class_template.txt b/plugin/etc/assertj-templates/assertion_class_template.txt index d8046367..74492beb 100644 --- a/plugin/etc/assertj-templates/assertion_class_template.txt +++ b/plugin/etc/assertj-templates/assertion_class_template.txt @@ -4,6 +4,7 @@ ${imports} * {@link ${class_to_assert}} specific assertions - Generated by CustomAssertionGenerator. */ @edu.hm.hafner.util.Generated(value="assertj-assertions-generator") +@SuppressWarnings({"rawtypes", "static"}) public class ${custom_assertion_class} extends AbstractObjectAssert<${custom_assertion_class}, ${class_to_assert}> { /** diff --git a/plugin/etc/assertj-templates/assertions_entry_point_method_template.txt b/plugin/etc/assertj-templates/assertions_entry_point_method_template.txt index d87683ca..052a182c 100644 --- a/plugin/etc/assertj-templates/assertions_entry_point_method_template.txt +++ b/plugin/etc/assertj-templates/assertions_entry_point_method_template.txt @@ -5,6 +5,7 @@ * @return the created assertion object. */ @org.assertj.core.annotation.CheckReturnValue + @SuppressWarnings("rawtypes") public static ${custom_assertion_class} assertThat(${class_to_assert} actual) { return new ${custom_assertion_class}(actual); } diff --git a/plugin/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt b/plugin/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt index fbf6d042..b19f9ca6 100644 --- a/plugin/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt +++ b/plugin/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt @@ -5,6 +5,7 @@ * @return this assertion object. * @throws AssertionError - if the actual ${class_to_assert}'s ${property} is not equal to the given one.${throws_javadoc} */ + @SuppressWarnings("rawtypes") public ${self_type} has${Property}(${propertyType} ${property_safe}) ${throws}{ // check that actual ${class_to_assert} we want to make assertions on is not null. isNotNull(); diff --git a/plugin/etc/assertj-templates/soft_assertions_entry_point_class_template.txt b/plugin/etc/assertj-templates/soft_assertions_entry_point_class_template.txt index 61ff0e6f..7225a85a 100644 --- a/plugin/etc/assertj-templates/soft_assertions_entry_point_class_template.txt +++ b/plugin/etc/assertj-templates/soft_assertions_entry_point_class_template.txt @@ -4,6 +4,7 @@ package ${package}; * Entry point for soft assertions of different data types. */ @edu.hm.hafner.util.Generated(value="assertj-assertions-generator") +@SuppressWarnings("rawtypes") public class SoftAssertions extends org.assertj.core.api.AutoCloseableSoftAssertions { ${all_assertions_entry_points} } diff --git a/plugin/etc/assertj-templates/soft_assertions_entry_point_method_template.txt b/plugin/etc/assertj-templates/soft_assertions_entry_point_method_template.txt index e067440c..25d28565 100644 --- a/plugin/etc/assertj-templates/soft_assertions_entry_point_method_template.txt +++ b/plugin/etc/assertj-templates/soft_assertions_entry_point_method_template.txt @@ -5,6 +5,7 @@ * @return the created "soft" assertion object. */ @org.assertj.core.annotation.CheckReturnValue + @SuppressWarnings("rawtypes") public ${custom_assertion_class} assertThat(${class_to_assert} actual) { return proxy(${custom_assertion_class}.class, ${class_to_assert}.class, actual); } diff --git a/plugin/pom.xml b/plugin/pom.xml index d541f3c0..fbb3fcae 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -35,11 +35,7 @@ false - 0.56.0 - 1.18.3 - - - 3.1.0 + 0.57.0 2.10.4 @@ -89,8 +85,6 @@ org.jenkins-ci.plugins jsoup - - 1.21.1-52.v96e4041b_60fd @@ -147,7 +141,6 @@ io.jenkins.plugins plugin-util-api - 6.1167.v022176c7e0ca_ io.jenkins.plugins @@ -162,7 +155,6 @@ io.jenkins.plugins plugin-util-api - 6.1167.v022176c7e0ca_ tests test @@ -257,7 +249,6 @@ org.jenkins-ci.plugins timestamper - 1.28 test diff --git a/pom.xml b/pom.xml index f42d0301..48291b3c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.jvnet.hudson.plugins analysis-pom - 10.2792.v9dd09fb_3c255 + 11.2852.v88a_36fe3230d diff --git a/ui-tests/etc/assertj-templates/assertion_class_template.txt b/ui-tests/etc/assertj-templates/assertion_class_template.txt index d8046367..74492beb 100644 --- a/ui-tests/etc/assertj-templates/assertion_class_template.txt +++ b/ui-tests/etc/assertj-templates/assertion_class_template.txt @@ -4,6 +4,7 @@ ${imports} * {@link ${class_to_assert}} specific assertions - Generated by CustomAssertionGenerator. */ @edu.hm.hafner.util.Generated(value="assertj-assertions-generator") +@SuppressWarnings({"rawtypes", "static"}) public class ${custom_assertion_class} extends AbstractObjectAssert<${custom_assertion_class}, ${class_to_assert}> { /** diff --git a/ui-tests/etc/assertj-templates/assertions_entry_point_method_template.txt b/ui-tests/etc/assertj-templates/assertions_entry_point_method_template.txt index d87683ca..052a182c 100644 --- a/ui-tests/etc/assertj-templates/assertions_entry_point_method_template.txt +++ b/ui-tests/etc/assertj-templates/assertions_entry_point_method_template.txt @@ -5,6 +5,7 @@ * @return the created assertion object. */ @org.assertj.core.annotation.CheckReturnValue + @SuppressWarnings("rawtypes") public static ${custom_assertion_class} assertThat(${class_to_assert} actual) { return new ${custom_assertion_class}(actual); } diff --git a/ui-tests/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt b/ui-tests/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt index fbf6d042..b19f9ca6 100644 --- a/ui-tests/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt +++ b/ui-tests/etc/assertj-templates/has_assertion_template_for_primitive_wrapper.txt @@ -5,6 +5,7 @@ * @return this assertion object. * @throws AssertionError - if the actual ${class_to_assert}'s ${property} is not equal to the given one.${throws_javadoc} */ + @SuppressWarnings("rawtypes") public ${self_type} has${Property}(${propertyType} ${property_safe}) ${throws}{ // check that actual ${class_to_assert} we want to make assertions on is not null. isNotNull(); diff --git a/ui-tests/etc/assertj-templates/soft_assertions_entry_point_class_template.txt b/ui-tests/etc/assertj-templates/soft_assertions_entry_point_class_template.txt index 61ff0e6f..7225a85a 100644 --- a/ui-tests/etc/assertj-templates/soft_assertions_entry_point_class_template.txt +++ b/ui-tests/etc/assertj-templates/soft_assertions_entry_point_class_template.txt @@ -4,6 +4,7 @@ package ${package}; * Entry point for soft assertions of different data types. */ @edu.hm.hafner.util.Generated(value="assertj-assertions-generator") +@SuppressWarnings("rawtypes") public class SoftAssertions extends org.assertj.core.api.AutoCloseableSoftAssertions { ${all_assertions_entry_points} } diff --git a/ui-tests/etc/assertj-templates/soft_assertions_entry_point_method_template.txt b/ui-tests/etc/assertj-templates/soft_assertions_entry_point_method_template.txt index e067440c..25d28565 100644 --- a/ui-tests/etc/assertj-templates/soft_assertions_entry_point_method_template.txt +++ b/ui-tests/etc/assertj-templates/soft_assertions_entry_point_method_template.txt @@ -5,6 +5,7 @@ * @return the created "soft" assertion object. */ @org.assertj.core.annotation.CheckReturnValue + @SuppressWarnings("rawtypes") public ${custom_assertion_class} assertThat(${class_to_assert} actual) { return proxy(${custom_assertion_class}.class, ${class_to_assert}.class, actual); } diff --git a/ui-tests/pom.xml b/ui-tests/pom.xml index 93f57995..3a9bea7c 100644 --- a/ui-tests/pom.xml +++ b/ui-tests/pom.xml @@ -5,7 +5,7 @@ edu.hm.hafner codingstyle-pom - 5.35.0 + 5.36.0 @@ -16,10 +16,10 @@ UI Tests of Code Coverage Plugin - 2.528 + 2.532 3.1762.vd3ff902a_5b_c4 2.3 - 4.1.1 + 5.0.0 ${project.groupId}.code.coverage.api.ui.tests @@ -37,7 +37,7 @@ io.netty netty-bom - 4.2.6.Final + 4.2.7.Final pom import @@ -48,7 +48,7 @@ org.jenkins-ci acceptance-test-harness - 6361.vcb_036a_7ffb_a_5 + 6388.v40780b_42e87e com.fasterxml.jackson.core