coding-standards.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. name: "Coding Standards"
  2. on:
  3. pull_request:
  4. branches:
  5. - "*.x"
  6. push:
  7. branches:
  8. - "*.x"
  9. schedule:
  10. # Run workflow on every Sunday
  11. - cron: '25 5 * * 0'
  12. jobs:
  13. coding-standards:
  14. name: "Coding Standards"
  15. runs-on: "ubuntu-20.04"
  16. strategy:
  17. matrix:
  18. php-version:
  19. - "7.2"
  20. steps:
  21. - name: "Checkout"
  22. uses: "actions/checkout@v2"
  23. - name: Setup cache environment
  24. id: extcache
  25. uses: shivammathur/cache-extensions@v1
  26. with:
  27. php-version: ${{ matrix.php-version }}
  28. extensions: "mongodb"
  29. key: "extcache-v1"
  30. - name: Cache extensions
  31. uses: actions/cache@v2
  32. with:
  33. path: ${{ steps.extcache.outputs.dir }}
  34. key: ${{ steps.extcache.outputs.key }}
  35. restore-keys: ${{ steps.extcache.outputs.key }}
  36. - name: "Install PHP"
  37. uses: "shivammathur/setup-php@v2"
  38. with:
  39. coverage: "none"
  40. extensions: "mongodb"
  41. php-version: "${{ matrix.php-version }}"
  42. tools: "cs2pr"
  43. - name: "Show driver information"
  44. run: "php --ri mongodb"
  45. - name: "Cache dependencies installed with Composer"
  46. uses: "actions/cache@v2"
  47. with:
  48. path: "~/.composer/cache"
  49. key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.json') }}"
  50. restore-keys: "php-${{ matrix.php-version }}-composer-normal-"
  51. - name: "Install dependencies with Composer"
  52. run: "composer install --no-interaction --no-progress --no-suggest"
  53. # The -q option is required until phpcs v4 is released
  54. - name: "Run PHP_CodeSniffer"
  55. run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"