acceptance.yml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. name: acceptance
  2. on:
  3. push:
  4. branches:
  5. - master
  6. pull_request:
  7. jobs:
  8. jest:
  9. runs-on: ubuntu-latest
  10. env:
  11. VISUAL_SNAPSHOT_ENABLE: 1
  12. steps:
  13. # Checkout codebase
  14. - uses: actions/checkout@v2
  15. # Install/setup node
  16. - uses: volta-cli/action@v1
  17. # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
  18. - name: Get yarn cache directory path
  19. id: yarn-cache-dir-path
  20. run: echo "::set-output name=dir::$(yarn cache dir)"
  21. # yarn cache
  22. - uses: actions/cache@v1
  23. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  24. with:
  25. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  26. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  27. restore-keys: |
  28. ${{ runner.os }}-yarn-
  29. - name: Install dependencies
  30. run: yarn install --frozen-lockfile
  31. - name: jest
  32. run: |
  33. NODE_ENV=production yarn build-css
  34. yarn test-ci --forceExit
  35. - name: Save snapshots
  36. if: always()
  37. uses: getsentry/action-visual-snapshot@v2
  38. with:
  39. save-only: true
  40. snapshot-path: .artifacts/visual-snapshots
  41. acceptance:
  42. runs-on: ubuntu-16.04
  43. continue-on-error: true
  44. strategy:
  45. matrix:
  46. instance: [0, 1, 2]
  47. env:
  48. PIP_DISABLE_PIP_VERSION_CHECK: on
  49. # PIP_QUIET: 1
  50. SENTRY_LIGHT_BUILD: 1
  51. SENTRY_SKIP_BACKEND_VALIDATION: 1
  52. MIGRATIONS_TEST_MIGRATE: 0
  53. # Use this to override the django version in the requirements file.
  54. DJANGO_VERSION: ">=1.11,<1.12"
  55. # Node configuration
  56. NODE_OPTIONS: --max-old-space-size=4096
  57. NODE_ENV: development
  58. PYTEST_SENTRY_DSN: https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079
  59. PYTEST_ADDOPTS: "--reruns 5"
  60. # services configuration
  61. SENTRY_KAFKA_HOSTS: kafka:9093
  62. SENTRY_ZOOKEEPER_HOSTS: zookeeper:2182
  63. SENTRY_REDIS_HOST: redis
  64. # The hostname used to communicate with the PostgreSQL from sentry
  65. DATABASE_URL: postgresql://postgres:postgres@localhost/sentry
  66. # Number of matrix instances
  67. TOTAL_TEST_GROUPS: ${{ strategy.job-total }}
  68. VISUAL_SNAPSHOT_ENABLE: 1
  69. steps:
  70. # Checkout codebase
  71. - uses: actions/checkout@v2
  72. # Install node
  73. - uses: volta-cli/action@v1
  74. # Yarn
  75. # - See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
  76. # Python
  77. # Use `.python-version` to avoid duplication
  78. # XXX: can't actually read from .python-version because GitHub Actions
  79. # does not support our version (2.7.16)
  80. #
  81. # XXX: Using `2.7` as GHA image only seems to keep one minor version around and will break
  82. # CI if we pin it to a specific patch version.
  83. - name: Set up outputs
  84. id: config
  85. env:
  86. MATRIX_INSTANCE: ${{ matrix.instance }}
  87. run: |
  88. echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
  89. echo "::set-output name=python-version::2.7"
  90. echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
  91. # yarn cache
  92. - uses: actions/cache@v1
  93. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  94. with:
  95. path: ${{ steps.config.outputs.yarn-cache-dir }}
  96. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  97. restore-keys: |
  98. ${{ runner.os }}-yarn-
  99. # setup python
  100. - name: Set up Python ${{ steps.config.outputs.python-version }}
  101. uses: actions/setup-python@v1
  102. with:
  103. python-version: ${{ steps.config.outputs.python-version}}
  104. # setup pip
  105. - name: Install pip
  106. run: |
  107. pip install --no-cache-dir --upgrade "pip>=20.0.2"
  108. # pip cache
  109. - name: Get pip cache dir
  110. id: pip-cache
  111. run: |
  112. echo "::set-output name=dir::$(pip cache dir)"
  113. - name: pip cache
  114. uses: actions/cache@v1
  115. with:
  116. path: ${{ steps.pip-cache.outputs.dir }}
  117. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
  118. restore-keys: |
  119. ${{ runner.os }}-pip-
  120. - name: Install System Dependencies
  121. run: |
  122. sudo apt-get update
  123. sudo apt-get install libxmlsec1-dev libmaxminddb-dev
  124. - name: Install Javascript Dependencies
  125. run: |
  126. yarn install --frozen-lockfile
  127. - name: Install Python Dependencies
  128. env:
  129. PGPASSWORD: postgres
  130. run: |
  131. python setup.py install_egg_info
  132. pip install wheel # GitHub Actions does not have this installed by default (unlike Travis)
  133. pip install -U -e ".[dev]"
  134. - name: Start devservices
  135. run: |
  136. sentry init
  137. sentry devservices up postgres redis clickhouse snuba
  138. - name: webpack
  139. run: |
  140. yarn webpack --display errors-only
  141. # Setup custom pytest matcher, see https://github.com/actions/setup-node/issues/97
  142. - name: Add pytest log matcher
  143. if: always()
  144. run: |
  145. echo "::remove-matcher owner=pytest::"
  146. echo "::add-matcher::.github/pytest.json"
  147. - name: Run acceptance tests (#${{ steps.config.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
  148. if: always()
  149. run: |
  150. mkdir -p .artifacts/visual-snapshots/acceptance
  151. mkdir -p .artifacts/visual-snapshots/acceptance-mobile
  152. make run-acceptance
  153. env:
  154. USE_SNUBA: 1
  155. TEST_GROUP: ${{ matrix.instance }}
  156. - name: Save snapshots
  157. if: always()
  158. uses: getsentry/action-visual-snapshot@v2
  159. with:
  160. save-only: true
  161. snapshot-path: .artifacts/visual-snapshots
  162. visual-diff:
  163. if: ${{ github.ref != 'refs/heads/master' }}
  164. needs: [acceptance, jest]
  165. runs-on: ubuntu-16.04
  166. steps:
  167. - name: Diff snapshots
  168. id: visual-snapshots-diff
  169. uses: getsentry/action-visual-snapshot@v2
  170. with:
  171. api-token: ${{ secrets.VISUAL_SNAPSHOT_SECRET }}
  172. github-token: ${{ secrets.GITHUB_TOKEN }}
  173. gcs-bucket: 'sentry-visual-snapshots'
  174. gcp-service-account-key: ${{ secrets.SNAPSHOT_GOOGLE_SERVICE_ACCOUNT_KEY }}