acceptance.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. - uses: volta-cli/action@v1
  26. # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
  27. - name: Get yarn cache directory path
  28. id: yarn-cache-dir-path
  29. run: echo "::set-output name=dir::$(yarn cache dir)"
  30. - uses: actions/cache@v2
  31. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  32. with:
  33. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  34. key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
  35. restore-keys: |
  36. ${{ runner.os }}-yarn-
  37. - name: Install dependencies
  38. run: yarn install --frozen-lockfile
  39. - name: jest
  40. run: |
  41. NODE_ENV=production yarn build-css
  42. yarn test-ci --forceExit
  43. - name: Save HTML artifacts
  44. uses: actions/upload-artifact@v2
  45. with:
  46. name: jest-html
  47. path: .artifacts/visual-snapshots/jest
  48. - name: Create Images from HTML
  49. uses: getsentry/action-html-to-image@main
  50. with:
  51. base-path: .artifacts/visual-snapshots/jest
  52. css-path: src/sentry/static/sentry/dist/sentry.css
  53. - name: Save snapshots
  54. if: always()
  55. uses: getsentry/action-visual-snapshot@v2
  56. with:
  57. save-only: true
  58. snapshot-path: .artifacts/visual-snapshots
  59. - name: Handle artifacts
  60. uses: ./.github/actions/artifacts
  61. acceptance:
  62. name: acceptance
  63. runs-on: ubuntu-20.04
  64. timeout-minutes: 20
  65. strategy:
  66. matrix:
  67. instance: [0, 1, 2, 3]
  68. env:
  69. VISUAL_SNAPSHOT_ENABLE: 1
  70. TEST_GROUP_STRATEGY: roundrobin
  71. steps:
  72. - uses: actions/checkout@v2
  73. name: Checkout sentry
  74. - uses: volta-cli/action@v1
  75. - name: Set python version output
  76. id: python-version
  77. run: |
  78. echo "::set-output name=python-version::$(cat .python-version)"
  79. # Until GH composite actions can use `uses`, we need to setup python here
  80. - uses: actions/setup-python@v2
  81. with:
  82. python-version: ${{ steps.python-version.outputs.python-version }}
  83. - name: Setup pip
  84. uses: ./.github/actions/setup-pip
  85. id: pip
  86. - name: pip cache
  87. uses: actions/cache@v2
  88. with:
  89. path: ${{ steps.pip.outputs.pip-cache-dir }}
  90. key: ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ hashFiles('**/requirements-*.txt') }}
  91. restore-keys: |
  92. ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}
  93. - name: Setup sentry python env
  94. uses: ./.github/actions/setup-sentry
  95. id: setup
  96. with:
  97. snuba: true
  98. - name: yarn cache
  99. uses: actions/cache@v2
  100. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  101. with:
  102. path: ${{ steps.setup.outputs.yarn-cache-dir }}
  103. key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
  104. restore-keys: |
  105. ${{ runner.os }}-yarn-
  106. - name: Install Javascript Dependencies
  107. run: |
  108. yarn install --frozen-lockfile
  109. - name: webpack
  110. env:
  111. SENTRY_INSTRUMENTATION: 1
  112. # this is fine to not have for forks, it shouldn't fail
  113. SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}
  114. run: |
  115. yarn webpack --display errors-only
  116. - name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
  117. if: always()
  118. run: |
  119. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
  120. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-mobile
  121. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-tooltips
  122. make run-acceptance
  123. env:
  124. PYTEST_SNAPSHOTS_DIR: ${{ steps.setup.outputs.acceptance-dir }}
  125. USE_SNUBA: 1
  126. - name: Save snapshots
  127. if: always()
  128. uses: getsentry/action-visual-snapshot@v2
  129. with:
  130. save-only: true
  131. snapshot-path: .artifacts/visual-snapshots
  132. - name: Handle artifacts
  133. uses: ./.github/actions/artifacts