Skip to content

chore(deps): bump the all-dependencies group with 2 updates #12

chore(deps): bump the all-dependencies group with 2 updates

chore(deps): bump the all-dependencies group with 2 updates #12

Workflow file for this run

name: Code analysis
on:
pull_request:
branches:
- master
- main
jobs:
pmd-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install PMD CLI
env:
PMD_VERSION: '7.14.0'
run: |
curl -L -o pmd-dist-$PMD_VERSION-bin.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F$PMD_VERSION/pmd-dist-$PMD_VERSION-bin.zip
unzip pmd-dist-$PMD_VERSION-bin.zip
mv pmd-bin-$PMD_VERSION /opt/pmd
echo "/opt/pmd/bin" >> $GITHUB_PATH
- name: Run PMD CLI analysis
run: |
mkdir -p build/reports/pmd
set +e
/opt/pmd/bin/pmd check \
--dir src/main/java \
--rulesets \
.github/pmd-ruleset.xml \
--format html \
-r build/reports/pmd/pmd-report.html
PMD_EXIT_CODE=$?
set -e
if [[ "$PMD_EXIT_CODE" -eq 1 ]]; then
echo "Unexpected internal error during PMD execution"
exit 1
elif [[ "$PMD_EXIT_CODE" -eq 2 ]]; then
echo "PMD CLI usage error"
exit 1
fi
echo "PMD_EXIT_CODE=$PMD_EXIT_CODE" >> $GITHUB_ENV
- name: Upload static analysis report on failure
if: env.PMD_EXIT_CODE != '0'
uses: actions/upload-artifact@v4
with:
name: pmd-report
path: build/reports/pmd/pmd-report.html
- name: Check for static code analysis violations
run: |
if [[ "$PMD_EXIT_CODE" -eq 0 ]]; then
echo "No PMD violations"
else
echo "PMD violations found"
exit 1
fi