1
0

static-code-analysis.yml 2.5 KB

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