test_docker_compose_acceptance.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Also note that this name *MUST* match the filename because GHA
  2. # only provides the workflow name (https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables)
  3. # and GH APIs only support querying by workflow *FILENAME* (https://developer.github.com/v3/actions/workflows/#get-a-workflow)
  4. name: test-docker-compose-acceptance
  5. on:
  6. schedule:
  7. - cron: '30,0 * * * *'
  8. # Cancel in progress workflows on pull_requests.
  9. # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
  10. concurrency:
  11. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  12. cancel-in-progress: true
  13. # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
  14. env:
  15. SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
  16. NODE_OPTIONS: '--max-old-space-size=4096'
  17. jobs:
  18. docker-compose-acceptance:
  19. name: docker-compose-acceptance
  20. runs-on: ubuntu-22.04
  21. timeout-minutes: 30
  22. permissions:
  23. contents: read
  24. id-token: write
  25. strategy:
  26. # This helps not having to run multiple jobs because one fails, thus, reducing resource usage
  27. # and reducing the risk that one of many runs would turn red again (read: intermittent tests)
  28. fail-fast: false
  29. matrix:
  30. # XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
  31. instance: [0, 1, 2, 3, 4]
  32. pg-version: ['14']
  33. env:
  34. # XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
  35. MATRIX_INSTANCE_TOTAL: 5
  36. TEST_GROUP_STRATEGY: roundrobin
  37. steps:
  38. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  39. name: Checkout sentry
  40. - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
  41. id: setup-node
  42. with:
  43. node-version-file: '.volta.json'
  44. - name: Step configurations
  45. id: config
  46. run: |
  47. echo "webpack-path=.webpack_cache" >> "$GITHUB_OUTPUT"
  48. echo "WEBPACK_CACHE_PATH=.webpack_cache" >> "$GITHUB_ENV"
  49. - name: webpack cache
  50. uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
  51. with:
  52. path: ${{ steps.config.outputs.webpack-path }}
  53. key: ${{ runner.os }}-v2-webpack-cache-${{ hashFiles('webpack.config.ts') }}
  54. - name: node_modules cache
  55. uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
  56. id: nodemodulescache
  57. with:
  58. path: node_modules
  59. key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock', '.volta.json') }}
  60. - name: Install Javascript Dependencies
  61. if: steps.nodemodulescache.outputs.cache-hit != 'true'
  62. run: yarn install --frozen-lockfile
  63. - name: webpack
  64. env:
  65. # this is fine to not have for forks, it shouldn't fail
  66. SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}
  67. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  68. # should set value either as `true` or `false`
  69. CODECOV_ENABLE_BA: true
  70. GH_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
  71. run: |
  72. yarn build-acceptance
  73. - name: Build chartcuterie configuration module
  74. run: |
  75. make build-chartcuterie-config
  76. - name: Setup sentry env
  77. uses: ./.github/actions/test-setup-sentry-devservices
  78. id: setup
  79. - name: copy chartcuterie config to devservices chartcuterie directory
  80. run: |
  81. ls config/chartcuterie
  82. cp -r config/chartcuterie devservices
  83. - name: Bring up devservices
  84. run: |
  85. docker network create sentry
  86. docker compose -f devservices/docker-compose-testing.yml up -d redis postgres snuba clickhouse chartcuterie
  87. - name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
  88. run: make run-acceptance
  89. - name: Collect test data
  90. uses: ./.github/actions/collect-test-data
  91. if: ${{ !cancelled() }}
  92. with:
  93. artifact_path: .artifacts/pytest.acceptance.json
  94. gcs_bucket: ${{ secrets.COLLECT_TEST_DATA_GCS_BUCKET }}
  95. gcp_project_id: ${{ secrets.COLLECT_TEST_DATA_GCP_PROJECT_ID }}
  96. workload_identity_provider: ${{ secrets.SENTRY_GCP_DEV_WORKLOAD_IDENTITY_POOL }}
  97. service_account_email: ${{ secrets.COLLECT_TEST_DATA_SERVICE_ACCOUNT_EMAIL }}
  98. matrix_instance_number: ${{ steps.setup.outputs.matrix-instance-number }}
  99. # This job runs when FE or BE changes happen, however, we only upload coverage data for
  100. # BE changes since it conflicts with codecov's carry forward functionality
  101. # Upload coverage data even if running the tests step fails since
  102. # it reduces large coverage fluctuations
  103. - name: Handle artifacts
  104. uses: ./.github/actions/artifacts
  105. if: ${{ always() }}
  106. with:
  107. token: ${{ secrets.CODECOV_TOKEN }}
  108. commit_sha: ${{ github.event.pull_request.head.sha }}
  109. - name: Inspect failure
  110. if: failure()
  111. run: |
  112. docker compose -f devservices/docker-compose-testing.yml ps
  113. docker compose -f devservices/docker-compose-testing.yml logs --tail 1000
  114. docker-compose-acceptance-required-checks:
  115. # this is a required check so we need this job to always run and report a status.
  116. if: always()
  117. name: Docker Compose Acceptance
  118. needs: [docker-compose-acceptance]
  119. runs-on: ubuntu-22.04
  120. timeout-minutes: 3
  121. steps:
  122. - name: Check for failures
  123. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
  124. run: |
  125. echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1