snuba-integration-test.yml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. name: snuba integration
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - releases/**
  7. pull_request:
  8. jobs:
  9. test:
  10. name: snuba test
  11. runs-on: ubuntu-20.04
  12. timeout-minutes: 30
  13. strategy:
  14. matrix:
  15. instance: [0]
  16. env:
  17. USE_SNUBA: 1
  18. MIGRATIONS_TEST_MIGRATE: 1
  19. steps:
  20. - uses: actions/checkout@v2
  21. with:
  22. # Avoid codecov error message related to SHA resolution:
  23. # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
  24. fetch-depth: '2'
  25. # If we make these jobs "required" to merge on GH, then on every PR, GitHub automatically
  26. # creates a status check in the "pending" state. This means that the workflow needs to run
  27. # for every PR in order to update the status checks.
  28. #
  29. # In order to optimize CI usage, we want the tests to only run when python files change,
  30. # since frontend changes should have no effect on these test suites. We cannot use GH workflow
  31. # path filters because entire workflow would be skipped vs skipping individual jobs which
  32. # would still allow this status check to pass.
  33. - name: Check for python file changes
  34. uses: getsentry/paths-filter@v2
  35. id: changes
  36. with:
  37. token: ${{ github.token }}
  38. filters: .github/file-filters.yml
  39. - name: Set python version output
  40. id: python-version
  41. if: steps.changes.outputs.backend == 'true'
  42. run: |
  43. echo "::set-output name=python-version::$(cat .python-version)"
  44. # Until GH composite actions can use `uses`, we need to setup python here
  45. - uses: actions/setup-python@v2
  46. if: steps.changes.outputs.backend == 'true'
  47. with:
  48. python-version: ${{ steps.python-version.outputs.python-version }}
  49. - name: Setup pip
  50. uses: ./.github/actions/setup-pip
  51. if: steps.changes.outputs.backend == 'true'
  52. id: pip
  53. - name: pip cache
  54. uses: actions/cache@v2
  55. if: steps.changes.outputs.backend == 'true'
  56. with:
  57. path: ${{ steps.pip.outputs.pip-cache-dir }}
  58. key: ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ hashFiles('**/requirements-*.txt') }}
  59. restore-keys: |
  60. ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}
  61. - name: Setup sentry env
  62. uses: ./.github/actions/setup-sentry
  63. if: steps.changes.outputs.backend == 'true'
  64. id: setup
  65. with:
  66. snuba: true
  67. kafka: true
  68. - name: Run snuba test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
  69. if: steps.changes.outputs.backend == 'true'
  70. run: |
  71. make test-snuba
  72. - name: Handle artifacts
  73. uses: ./.github/actions/artifacts