acceptance.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # TODO(billy): this workflow has not been re-named from `acceptance` because
  2. # Visual Snapshots compares against artifacts from the same workflow name (on main branch)
  3. # We should rename this when we have a more finalized naming scheme.
  4. #
  5. # Also note that this name *MUST* match the filename because GHA
  6. # only provides the workflow name (https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables)
  7. # and GH APIs only support querying by workflow *FILENAME* (https://developer.github.com/v3/actions/workflows/#get-a-workflow)
  8. name: acceptance
  9. on:
  10. push:
  11. branches:
  12. - master
  13. - releases/**
  14. pull_request:
  15. jobs:
  16. frontend:
  17. name: frontend tests
  18. runs-on: ubuntu-20.04
  19. timeout-minutes: 20
  20. env:
  21. VISUAL_HTML_ENABLE: 1
  22. steps:
  23. - uses: actions/checkout@v2
  24. name: Checkout sentry
  25. with:
  26. # Avoid codecov error message related to SHA resolution:
  27. # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
  28. fetch-depth: '2'
  29. - uses: volta-cli/action@v1
  30. # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
  31. - name: Get yarn cache directory path
  32. id: yarn-cache-dir-path
  33. run: echo "::set-output name=dir::$(yarn cache dir)"
  34. - uses: actions/cache@v2
  35. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  36. with:
  37. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  38. key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
  39. restore-keys: |
  40. ${{ runner.os }}-yarn-
  41. - name: Install dependencies
  42. run: yarn install --frozen-lockfile
  43. - name: jest
  44. run: |
  45. NODE_ENV=production yarn build-css
  46. yarn test-ci --forceExit
  47. - name: Save HTML artifacts
  48. uses: actions/upload-artifact@v2
  49. with:
  50. name: jest-html
  51. path: .artifacts/visual-snapshots/jest
  52. - name: Create Images from HTML
  53. uses: getsentry/action-html-to-image@main
  54. with:
  55. base-path: .artifacts/visual-snapshots/jest
  56. css-path: src/sentry/static/sentry/dist/sentry.css
  57. - name: Save snapshots
  58. if: always()
  59. uses: getsentry/action-visual-snapshot@v2
  60. with:
  61. save-only: true
  62. snapshot-path: .artifacts/visual-snapshots
  63. - name: Handle artifacts
  64. uses: ./.github/actions/artifacts
  65. acceptance:
  66. name: acceptance
  67. runs-on: ubuntu-20.04
  68. timeout-minutes: 20
  69. strategy:
  70. matrix:
  71. instance: [0, 1, 2, 3]
  72. env:
  73. VISUAL_SNAPSHOT_ENABLE: 1
  74. TEST_GROUP_STRATEGY: roundrobin
  75. steps:
  76. - uses: actions/checkout@v2
  77. name: Checkout sentry
  78. - uses: volta-cli/action@v1
  79. - name: Set python version output
  80. id: python-version
  81. run: |
  82. echo "::set-output name=python-version::$(cat .python-version)"
  83. # Until GH composite actions can use `uses`, we need to setup python here
  84. - uses: actions/setup-python@v2
  85. with:
  86. python-version: ${{ steps.python-version.outputs.python-version }}
  87. - name: Setup pip
  88. uses: ./.github/actions/setup-pip
  89. id: pip
  90. - name: pip cache
  91. uses: actions/cache@v2
  92. with:
  93. path: ${{ steps.pip.outputs.pip-cache-dir }}
  94. key: ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ hashFiles('**/requirements-*.txt') }}
  95. restore-keys: |
  96. ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}
  97. - name: Setup sentry python env
  98. uses: ./.github/actions/setup-sentry
  99. id: setup
  100. with:
  101. snuba: true
  102. - name: yarn cache
  103. uses: actions/cache@v2
  104. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  105. with:
  106. path: ${{ steps.setup.outputs.yarn-cache-dir }}
  107. key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
  108. restore-keys: |
  109. ${{ runner.os }}-yarn-
  110. - name: Install Javascript Dependencies
  111. run: |
  112. yarn install --frozen-lockfile
  113. - name: webpack
  114. env:
  115. SENTRY_INSTRUMENTATION: 1
  116. # this is fine to not have for forks, it shouldn't fail
  117. SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}
  118. run: |
  119. yarn webpack --display errors-only
  120. - name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
  121. if: always()
  122. run: |
  123. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
  124. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-mobile
  125. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-tooltips
  126. make run-acceptance
  127. env:
  128. PYTEST_SNAPSHOTS_DIR: ${{ steps.setup.outputs.acceptance-dir }}
  129. USE_SNUBA: 1
  130. - name: Save snapshots
  131. if: always()
  132. uses: getsentry/action-visual-snapshot@v2
  133. with:
  134. save-only: true
  135. snapshot-path: .artifacts/visual-snapshots
  136. - name: Handle artifacts
  137. uses: ./.github/actions/artifacts