diff --git a/.github/workflows/pmd.yml b/.github/workflows/pmd.yml new file mode 100644 index 0000000000..89802c68f6 --- /dev/null +++ b/.github/workflows/pmd.yml @@ -0,0 +1,36 @@ +name: Source DRYness + +on: [push, pull_request, workflow_dispatch] + +jobs: + pmd: + name: PMD + runs-on: "ubuntu-latest" + env: + pr_everything: 0 + steps: + - name: Clone - PR + uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + + - name: Run CPD for Fortran + continue-on-error: true + run: | + # Get latest PMD version from GitHub API + PMD_VERSION=$(curl -s https://api.github.com/repos/pmd/pmd/releases/latest | grep '"tag_name":' | cut -d'"' -f4 | sed 's/pmd_releases\///') + echo "Using PMD version: $PMD_VERSION" + + curl -sSL -o pmd.zip \ + "https://github.com/pmd/pmd/releases/download/pmd_releases/${PMD_VERSION}/pmd-dist-${PMD_VERSION}-bin.zip" + unzip -q pmd.zip + PMD_HOME="pmd-bin-${PMD_VERSION}" + + "${PMD_HOME}/bin/pmd" cpd \ + --dir src \ + --language fortran \ + --minimum-tokens=40