acceptance.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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-16.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') }}
  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. # TODO(joshuarli): Convert to py3 with snapshots. See other TODO as well.
  63. name: python2.7 acceptance
  64. runs-on: ubuntu-16.04
  65. timeout-minutes: 20
  66. strategy:
  67. matrix:
  68. instance: [0, 1, 2]
  69. env:
  70. VISUAL_SNAPSHOT_ENABLE: 1
  71. TEST_GROUP_STRATEGY: roundrobin
  72. steps:
  73. - uses: actions/checkout@v2
  74. name: Checkout sentry
  75. - uses: volta-cli/action@v1
  76. # Until GH composite actions can use `uses`, we need to setup python here
  77. - uses: actions/setup-python@v2
  78. with:
  79. python-version: 2.7.17
  80. - name: Setup pip
  81. uses: ./.github/actions/setup-pip
  82. id: pip
  83. - name: pip cache
  84. uses: actions/cache@v2
  85. with:
  86. path: ${{ steps.pip.outputs.pip-cache-dir }}
  87. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
  88. restore-keys: |
  89. ${{ runner.os }}-pip-
  90. - name: Setup sentry env
  91. uses: ./.github/actions/setup-sentry
  92. id: setup
  93. with:
  94. python: 2
  95. snuba: true
  96. - uses: actions/cache@v2
  97. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  98. with:
  99. path: ${{ steps.setup.outputs.yarn-cache-dir }}
  100. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  101. restore-keys: |
  102. ${{ runner.os }}-yarn-
  103. - name: Install Javascript Dependencies
  104. run: |
  105. yarn install --frozen-lockfile
  106. - name: webpack
  107. env:
  108. SENTRY_INSTRUMENTATION: 1
  109. # this is fine to not have for forks, it shouldn't fail
  110. SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}
  111. run: |
  112. yarn webpack --display errors-only
  113. - name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
  114. if: always()
  115. run: |
  116. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
  117. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-mobile
  118. mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-tooltips
  119. make run-acceptance
  120. env:
  121. PYTEST_SNAPSHOTS_DIR: ${{ steps.setup.outputs.acceptance-dir }}
  122. USE_SNUBA: 1
  123. - name: Save snapshots
  124. if: always()
  125. uses: getsentry/action-visual-snapshot@v2
  126. with:
  127. save-only: true
  128. snapshot-path: .artifacts/visual-snapshots