backend-test.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. name: backend
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - releases/**
  7. pull_request:
  8. jobs:
  9. test:
  10. name: backend test
  11. runs-on: ubuntu-18.04
  12. timeout-minutes: 20
  13. strategy:
  14. matrix:
  15. python-version: [3.8.12]
  16. # XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
  17. instance: [0, 1, 2]
  18. env:
  19. # XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
  20. MATRIX_INSTANCE_TOTAL: 3
  21. MIGRATIONS_TEST_MIGRATE: 1
  22. steps:
  23. - uses: actions/checkout@v2
  24. with:
  25. # Avoid codecov error message related to SHA resolution:
  26. # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
  27. fetch-depth: '2'
  28. # If we make these jobs "required" to merge on GH, then on every PR, GitHub automatically
  29. # creates a status check in the "pending" state. This means that the workflow needs to run
  30. # for every PR in order to update the status checks.
  31. #
  32. # In order to optimize CI usage, we want the tests to only run when python files change,
  33. # since frontend changes should have no effect on these test suites. We cannot use GH workflow
  34. # path filters because entire workflow would be skipped vs skipping individual jobs which
  35. # would still allow this status check to pass.
  36. - name: Check for python file changes
  37. uses: getsentry/paths-filter@v2
  38. id: changes
  39. with:
  40. token: ${{ github.token }}
  41. filters: .github/file-filters.yml
  42. - name: Setup sentry env (python ${{ matrix.python-version }})
  43. uses: ./.github/actions/setup-sentry
  44. if: steps.changes.outputs.backend == 'true'
  45. id: setup
  46. with:
  47. python-version: ${{ matrix.python-version }}
  48. pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
  49. snuba: true
  50. - name: Run backend test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
  51. if: steps.changes.outputs.backend == 'true'
  52. run: |
  53. # Note: `USE_SNUBA` is not used for backend tests because there are a few failing tests with Snuba enabled.
  54. unset USE_SNUBA
  55. make test-python-ci
  56. - name: Handle artifacts
  57. uses: ./.github/actions/artifacts