static-code-analysis.yml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: Static code analysis
  2. on: [pull_request]
  3. jobs:
  4. static-code-analysis:
  5. runs-on: ubuntu-latest
  6. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  7. steps:
  8. - uses: actions/checkout@v2
  9. - name: Checkout submodules
  10. shell: bash
  11. run: |
  12. auth_header="$(git config --local --get http.https://github.com/.extraheader)"
  13. git submodule sync --recursive
  14. git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
  15. - name: Set up php7.4
  16. uses: shivammathur/setup-php@master
  17. with:
  18. php-version: 7.4
  19. extensions: apcu,ctype,curl,dom,fileinfo,ftp,gd,intl,json,ldap,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip
  20. coverage: none
  21. env:
  22. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  23. - name: Composer install
  24. run: composer i
  25. - name: Psalm
  26. run: composer run psalm -- --monochrome --no-progress --output-format=github --update-baseline || ( git diff -- . ':!lib/composer' && exit 1 )
  27. - name: Check diff
  28. run: git diff -- . ':!lib/composer'
  29. - name: Show potential changes in Psalm baseline
  30. run: |
  31. bash -c "[[ ! \"`git status --porcelain build/psalm-baseline.xml`\" ]] || ( echo 'Uncommited changes in Psalm baseline' && git status && git diff build/psalm-baseline.xml)"
  32. static-code-analysis-ocp:
  33. runs-on: ubuntu-latest
  34. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  35. steps:
  36. - uses: actions/checkout@v2
  37. - name: Checkout submodules
  38. shell: bash
  39. run: |
  40. auth_header="$(git config --local --get http.https://github.com/.extraheader)"
  41. git submodule sync --recursive
  42. git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
  43. - name: Set up php7.4
  44. uses: shivammathur/setup-php@master
  45. with:
  46. php-version: 7.4
  47. extensions: apcu,ctype,curl,dom,fileinfo,ftp,gd,intl,json,ldap,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip
  48. coverage: none
  49. env:
  50. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  51. - name: Composer install
  52. run: composer i
  53. - name: Psalm
  54. run: composer run psalm -- -c psalm-ocp.xml --monochrome --no-progress --output-format=github --update-baseline || ( git diff -- . ':!lib/composer' && exit 1 )
  55. - name: Check diff
  56. run: git diff -- . ':!lib/composer'
  57. - name: Show potential changes in Psalm baseline
  58. run: |
  59. bash -c "[[ ! \"`git status --porcelain build/psalm-baseline-ocp.xml`\" ]] || ( echo 'Uncommited changes in Psalm baseline' && git status && git diff build/psalm-baseline.xml)"