lint-php.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # This workflow is provided via the organization template repository
  2. #
  3. # https://github.com/nextcloud/.github
  4. # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
  5. name: Lint php
  6. on:
  7. pull_request:
  8. permissions:
  9. contents: read
  10. concurrency:
  11. group: lint-php-${{ github.head_ref || github.run_id }}
  12. cancel-in-progress: true
  13. jobs:
  14. changes:
  15. runs-on: ubuntu-latest-low
  16. outputs:
  17. src: ${{ steps.changes.outputs.src}}
  18. steps:
  19. - uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1
  20. id: changes
  21. continue-on-error: true
  22. with:
  23. filters: |
  24. src:
  25. - '.github/workflows/**'
  26. - '3rdparty/**'
  27. - '**/lib/**'
  28. - '**/tests/**'
  29. - '**/vendor-bin/**'
  30. - '.php-cs-fixer.dist.php'
  31. - 'composer.json'
  32. - 'composer.lock'
  33. - '**.php'
  34. lint:
  35. runs-on: ubuntu-latest
  36. needs: changes
  37. if: needs.changes.outputs.src != 'false'
  38. strategy:
  39. matrix:
  40. php-versions: [ "8.0", "8.1", "8.2", "8.3" ]
  41. name: php-lint
  42. steps:
  43. - name: Checkout
  44. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  45. - name: Set up php ${{ matrix.php-versions }}
  46. uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
  47. with:
  48. php-version: ${{ matrix.php-versions }}
  49. coverage: none
  50. ini-file: development
  51. env:
  52. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  53. - name: Lint
  54. run: composer run lint
  55. summary:
  56. permissions:
  57. contents: none
  58. runs-on: ubuntu-latest-low
  59. needs: [changes, lint]
  60. if: always()
  61. name: php-lint-summary
  62. steps:
  63. - name: Summary status
  64. run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi