lint-php.yml 2.0 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. #
  6. # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
  7. # SPDX-License-Identifier: MIT
  8. name: Lint php
  9. on: pull_request
  10. permissions:
  11. contents: read
  12. concurrency:
  13. group: lint-php-${{ github.head_ref || github.run_id }}
  14. cancel-in-progress: true
  15. jobs:
  16. changes:
  17. runs-on: ubuntu-latest-low
  18. outputs:
  19. src: ${{ steps.changes.outputs.src}}
  20. steps:
  21. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  22. id: changes
  23. continue-on-error: true
  24. with:
  25. filters: |
  26. src:
  27. - '.github/workflows/**'
  28. - '3rdparty/**'
  29. - '**/lib/**'
  30. - '**/tests/**'
  31. - '**/vendor-bin/**'
  32. - '.php-cs-fixer.dist.php'
  33. - 'composer.json'
  34. - 'composer.lock'
  35. - '**.php'
  36. lint:
  37. runs-on: ubuntu-latest
  38. needs: changes
  39. if: needs.changes.outputs.src != 'false'
  40. strategy:
  41. matrix:
  42. php-versions: [ '8.1', '8.2', '8.3' ]
  43. name: php-lint
  44. steps:
  45. - name: Checkout
  46. uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
  47. - name: Set up php ${{ matrix.php-versions }}
  48. uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198 # v2
  49. with:
  50. php-version: ${{ matrix.php-versions }}
  51. coverage: none
  52. ini-file: development
  53. env:
  54. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  55. - name: Lint
  56. run: composer run lint
  57. summary:
  58. permissions:
  59. contents: none
  60. runs-on: ubuntu-latest-low
  61. needs: [changes, lint]
  62. if: always()
  63. name: php-lint-summary
  64. steps:
  65. - name: Summary status
  66. run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi