yurake/k8s-3tier-webapp

View on GitHub
.github/workflows/pmd.yml

Summary

Maintainability
Test Coverage
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: pmd

on:
  push:
    branches: ["master"]
    paths:
      - "**.java"
      - "application/**"
      - ".github/workflows/pmd.yml"
      - ".github/pmdrule.yml"
  pull_request:
    # The branches below must be a subset of the branches above
    branches: ["master"]
    paths:
      - "**.java"
      - "application/**"
      - ".github/workflows/pmd.yml"
      - ".github/pmdrule.yml"

permissions:
  contents: read

jobs:
  pmd-code-scan:
    permissions:
      contents: read # for actions/checkout to fetch code
      security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
      actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        quarkus_application:
          [
            consumer-activemq-quarkus,
            consumer-hazelcast-quarkus,
            consumer-kafka-quarkus,
            consumer-rabbitmq-quarkus,
            consumer-redis-quarkus,
            converter-kafka-quarkus,
            converter-rabbitmq-quarkus,
            jaxrs-activemq-quarkus,
            jaxrs-cassandra-quarkus,
            jaxrs-grpc-quarkus,
            jaxrs-hazelcast-quarkus,
            jaxrs-kafka-quarkus,
            jaxrs-memcached-quarkus,
            jaxrs-mongodb-quarkus,
            jaxrs-mysql-quarkus,
            jaxrs-postgres-quarkus,
            jaxrs-rabbitmq-quarkus,
            jaxrs-redis-quarkus,
            producer-kafka-quarkus,
            randompublish-quarkus,
            scheduled-quarkus,
            server-grpc-quarkus,
          ]
    steps:
      - uses: actions/checkout@v4.1.7
      - name: Set up JDK
        uses: actions/setup-java@v4.3.0
        with:
          java-version: "17"
          distribution: "temurin"
      - name: Run PMD
        id: pmd
        uses: pmd/pmd-github-action@v1.4.1
        with:
          rulesets: "${{ github.workspace }}/.github/pmdrule.xml"
          sourcePath: "application/${{ matrix.quarkus_application }}/src/main/java"
          analyzeModifiedFilesOnly: false
      - name: Upload SARIF file
        uses: github/codeql-action/upload-sarif@v2
        with:
          sarif_file: pmd-report.sarif
      - name: Fail build if there are violations
        if: steps.pmd.outputs.violations != 0
        run: exit 1