checks.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. name: Perform checks
  2. on:
  3. pull_request:
  4. branches: [ master ]
  5. paths:
  6. - '**'
  7. - '!.github/**'
  8. - '!*.yml'
  9. - '!*.config'
  10. - '!README.md'
  11. - '.github/workflows/*.yml'
  12. permissions:
  13. pull-requests: write
  14. checks: write
  15. concurrency:
  16. group: pr-checks-${{ github.event.number }}
  17. cancel-in-progress: true
  18. jobs:
  19. format:
  20. runs-on: ubuntu-latest
  21. steps:
  22. - uses: actions/checkout@v3
  23. with:
  24. fetch-depth: 0
  25. - uses: actions/setup-dotnet@v3
  26. with:
  27. global-json-file: global.json
  28. - run: dotnet restore
  29. - name: Print dotnet format version
  30. run: dotnet format --version
  31. - name: Run dotnet format whitespace
  32. run: |
  33. dotnet format whitespace --verify-no-changes --report ./whitespace-report.json -v d
  34. - name: Run dotnet format style
  35. run: |
  36. dotnet format style --severity info --verify-no-changes --report ./style-report.json -v d
  37. # For some reason this step sometimes fails with exit code 139 (segfault?),
  38. # so should that be the case we'll try again (3 tries max).
  39. - name: Run dotnet format analyzers
  40. run: |
  41. attempt=0
  42. exit_code=139
  43. until [ $attempt -ge 3 ] || [ $exit_code -ne 139 ]; do
  44. ((attempt+=1))
  45. exit_code=0
  46. echo "Attempt: ${attempt}/3"
  47. dotnet format analyzers --severity info --verify-no-changes --report ./analyzers-report.json -v d || exit_code=$?
  48. done
  49. exit $exit_code
  50. - name: Upload report
  51. if: failure()
  52. uses: actions/upload-artifact@v3
  53. with:
  54. name: dotnet-format
  55. path: ./*-report.json
  56. pr_build:
  57. uses: ./.github/workflows/build.yml
  58. needs: format
  59. secrets: inherit