test_devservices_acceptance.yml 5.4 KB

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