|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | +# PHPMD is a spin-off project of PHP Depend and |
| 6 | +# aims to be a PHP equivalent of the well known Java tool PMD. |
| 7 | +# What PHPMD does is: It takes a given PHP source code base |
| 8 | +# and look for several potential problems within that source. |
| 9 | +# These problems can be things like: |
| 10 | +# Possible bugs |
| 11 | +# Suboptimal code |
| 12 | +# Overcomplicated expressions |
| 13 | +# Unused parameters, methods, properties |
| 14 | +# More details at https://phpmd.org/ |
| 15 | + |
| 16 | +name: PHPMD |
| 17 | + |
| 18 | +on: |
| 19 | + push: |
| 20 | + branches: [ "master" ] |
| 21 | + pull_request: |
| 22 | + # The branches below must be a subset of the branches above |
| 23 | + branches: [ "master" ] |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + PHPMD: |
| 30 | + name: Run PHPMD scanning |
| 31 | + runs-on: ubuntu-latest |
| 32 | + permissions: |
| 33 | + contents: read # for checkout to fetch code |
| 34 | + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 35 | + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout code |
| 39 | + uses: actions/checkout@v3 |
| 40 | + |
| 41 | + - name: Setup PHP |
| 42 | + uses: shivammathur/setup-php@aa1fe473f9c687b6fb896056d771232c0bc41161 |
| 43 | + with: |
| 44 | + coverage: none |
| 45 | + tools: phpmd |
| 46 | + |
| 47 | + - name: Build IFM |
| 48 | + run: php ./compiler.php |
| 49 | + |
| 50 | + - name: Run PHPMD |
| 51 | + run: phpmd ./dist sarif codesize --reportfile phpmd-results.sarif |
| 52 | + continue-on-error: true |
| 53 | + |
| 54 | + - name: Upload analysis results to GitHub |
| 55 | + uses: github/codeql-action/upload-sarif@v2 |
| 56 | + with: |
| 57 | + sarif_file: phpmd-results.sarif |
| 58 | + wait-for-processing: true |
0 commit comments