static-code-analysis.yml 2.7 KB

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