static-code-analysis.yml 2.9 KB

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