test_devservices_acceptance.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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-devservices-acceptance
  5. on:
  6. schedule:
  7. - cron: '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. USE_NEW_DEVSERVICES: 1
  18. IS_DEV: 1
  19. CHARTCUTERIE_CONFIG_PATH: ${{ github.workspace }}/config/chartcuterie
  20. SNUBA_NO_WORKERS: 1
  21. jobs:
  22. devservices-acceptance:
  23. name: devservices-acceptance
  24. runs-on: ubuntu-24.04
  25. timeout-minutes: 30
  26. permissions:
  27. contents: read
  28. id-token: write
  29. strategy:
  30. # This helps not having to run multiple jobs because one fails, thus, reducing resource usage
  31. # and reducing the risk that one of many runs would turn red again (read: intermittent tests)
  32. fail-fast: false
  33. matrix:
  34. # XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
  35. instance: [0, 1, 2, 3, 4]
  36. pg-version: ['14']
  37. env:
  38. # XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
  39. MATRIX_INSTANCE_TOTAL: 5
  40. TEST_GROUP_STRATEGY: roundrobin
  41. steps:
  42. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  43. name: Checkout sentry
  44. - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
  45. id: setup-node
  46. with:
  47. node-version-file: '.volta.json'
  48. - name: Step configurations
  49. id: config
  50. run: |
  51. echo "webpack-path=.webpack_cache" >> "$GITHUB_OUTPUT"
  52. echo "WEBPACK_CACHE_PATH=.webpack_cache" >> "$GITHUB_ENV"
  53. - name: webpack cache
  54. uses: actions/cache@v4.2.0
  55. with:
  56. path: ${{ steps.config.outputs.webpack-path }}
  57. key: ${{ runner.os }}-v2-webpack-cache-${{ hashFiles('webpack.config.ts') }}
  58. - name: node_modules cache
  59. uses: actions/cache@v4.2.0
  60. id: nodemodulescache
  61. with:
  62. path: node_modules
  63. key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock', '.volta.json') }}
  64. - name: Install Javascript Dependencies
  65. if: steps.nodemodulescache.outputs.cache-hit != 'true'
  66. run: yarn install --frozen-lockfile
  67. - name: webpack
  68. env:
  69. # this is fine to not have for forks, it shouldn't fail
  70. SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}
  71. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  72. # should set value either as `true` or `false`
  73. CODECOV_ENABLE_BA: true
  74. GH_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
  75. run: |
  76. yarn build-acceptance
  77. - name: Build chartcuterie configuration module
  78. run: |
  79. make build-chartcuterie-config
  80. - name: Setup sentry env
  81. uses: ./.github/actions/test-setup-sentry-devservices
  82. id: setup
  83. - name: Bring up devservices
  84. run: |
  85. devservices up --mode acceptance-ci
  86. - name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
  87. run: make run-acceptance
  88. - name: Collect test data
  89. uses: ./.github/actions/collect-test-data
  90. if: ${{ !cancelled() }}
  91. with:
  92. artifact_path: .artifacts/pytest.acceptance.json
  93. gcs_bucket: ${{ secrets.COLLECT_TEST_DATA_GCS_BUCKET }}
  94. gcp_project_id: ${{ secrets.COLLECT_TEST_DATA_GCP_PROJECT_ID }}
  95. workload_identity_provider: ${{ secrets.SENTRY_GCP_DEV_WORKLOAD_IDENTITY_POOL }}
  96. service_account_email: ${{ secrets.COLLECT_TEST_DATA_SERVICE_ACCOUNT_EMAIL }}
  97. matrix_instance_number: ${{ steps.setup.outputs.matrix-instance-number }}
  98. # This job runs when FE or BE changes happen, however, we only upload coverage data for
  99. # BE changes since it conflicts with codecov's carry forward functionality
  100. # Upload coverage data even if running the tests step fails since
  101. # it reduces large coverage fluctuations
  102. - name: Handle artifacts
  103. uses: ./.github/actions/artifacts
  104. if: ${{ always() }}
  105. with:
  106. token: ${{ secrets.CODECOV_TOKEN }}
  107. commit_sha: ${{ github.event.pull_request.head.sha }}
  108. - name: Inspect failure
  109. if: failure()
  110. run: |
  111. devservices logs
  112. devservices-acceptance-required-checks:
  113. # this is a required check so we need this job to always run and report a status.
  114. if: always()
  115. name: Devservices Acceptance
  116. needs: [devservices-acceptance]
  117. runs-on: ubuntu-24.04
  118. timeout-minutes: 3
  119. steps:
  120. - name: Check for failures
  121. if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
  122. run: |
  123. echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1