Browse Source

chore(ui): Update Codecov bundler plugin (#71238)

Update Codecov bundler plugin version, and update workflows to pass correct SHA to Codecov while removing excess fetch-depths.
nicholas-codecov 9 months ago
parent
commit
084100e06e

+ 4 - 0
.github/actions/artifacts/action.yml

@@ -13,6 +13,9 @@ inputs:
   token:
   token:
     description: 'The codecov token'
     description: 'The codecov token'
     required: true
     required: true
+  commit_sha:
+    description: 'The commit sha'
+    required: true
 
 
 runs:
 runs:
   using: 'composite'
   using: 'composite'
@@ -23,6 +26,7 @@ runs:
         token: ${{ inputs.token }}
         token: ${{ inputs.token }}
         flags: ${{ inputs.type }}
         flags: ${{ inputs.type }}
         files: ${{ inputs.files }}
         files: ${{ inputs.files }}
+        override_commit: ${{ inputs.commit_sha}}
         plugin: noop
         plugin: noop
         verbose: true
         verbose: true
       continue-on-error: true
       continue-on-error: true

+ 2 - 0
.github/workflows/acceptance.yml

@@ -98,6 +98,7 @@ jobs:
           CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
           CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
           # should set value either as `true` or `false`
           # should set value either as `true` or `false`
           CODECOV_ENABLE_BA: ${{ needs.files-changed.outputs.frontend_all == 'true'}}
           CODECOV_ENABLE_BA: ${{ needs.files-changed.outputs.frontend_all == 'true'}}
+          GH_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
         run: |
         run: |
           yarn build-acceptance
           yarn build-acceptance
 
 
@@ -136,6 +137,7 @@ jobs:
         if: ${{ always() && needs.files-changed.outputs.backend_all == 'true' }}
         if: ${{ always() && needs.files-changed.outputs.backend_all == 'true' }}
         with:
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           token: ${{ secrets.CODECOV_TOKEN }}
+          commit_sha: ${{ github.event.pull_request.head.sha }}
 
 
   acceptance-required-checks:
   acceptance-required-checks:
     # this is a required check so we need this job to always run and report a status.
     # this is a required check so we need this job to always run and report a status.

+ 4 - 12
.github/workflows/backend.yml

@@ -86,10 +86,6 @@ jobs:
 
 
     steps:
     steps:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
-        with:
-          # Avoid codecov error message related to SHA resolution:
-          # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
-          fetch-depth: '2'
 
 
       - name: Setup sentry env
       - name: Setup sentry env
         uses: ./.github/actions/setup-sentry
         uses: ./.github/actions/setup-sentry
@@ -128,6 +124,7 @@ jobs:
         uses: ./.github/actions/artifacts
         uses: ./.github/actions/artifacts
         with:
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           token: ${{ secrets.CODECOV_TOKEN }}
+          commit_sha: ${{ github.event.pull_request.head.sha }}
 
 
   backend-migration-tests:
   backend-migration-tests:
     if: needs.files-changed.outputs.backend == 'true'
     if: needs.files-changed.outputs.backend == 'true'
@@ -141,10 +138,6 @@ jobs:
 
 
     steps:
     steps:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
-        with:
-          # Avoid codecov error message related to SHA resolution:
-          # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
-          fetch-depth: '2'
 
 
       - name: Setup sentry env
       - name: Setup sentry env
         uses: ./.github/actions/setup-sentry
         uses: ./.github/actions/setup-sentry
@@ -164,6 +157,7 @@ jobs:
         uses: ./.github/actions/artifacts
         uses: ./.github/actions/artifacts
         with:
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           token: ${{ secrets.CODECOV_TOKEN }}
+          commit_sha: ${{ github.event.pull_request.head.sha }}
 
 
   cli:
   cli:
     if: needs.files-changed.outputs.backend == 'true'
     if: needs.files-changed.outputs.backend == 'true'
@@ -194,6 +188,7 @@ jobs:
         uses: ./.github/actions/artifacts
         uses: ./.github/actions/artifacts
         with:
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           token: ${{ secrets.CODECOV_TOKEN }}
+          commit_sha: ${{ github.event.pull_request.head.sha }}
 
 
   requirements:
   requirements:
     if: needs.files-changed.outputs.backend_dependencies == 'true'
     if: needs.files-changed.outputs.backend_dependencies == 'true'
@@ -265,10 +260,6 @@ jobs:
       id-token: write
       id-token: write
     steps:
     steps:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
-        with:
-          # Avoid codecov error message related to SHA resolution:
-          # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
-          fetch-depth: '2'
 
 
       - name: Setup sentry env
       - name: Setup sentry env
         uses: ./.github/actions/setup-sentry
         uses: ./.github/actions/setup-sentry
@@ -295,6 +286,7 @@ jobs:
         uses: ./.github/actions/artifacts
         uses: ./.github/actions/artifacts
         with:
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           token: ${{ secrets.CODECOV_TOKEN }}
+          commit_sha: ${{ github.event.pull_request.head.sha }}
 
 
   typing:
   typing:
     if: needs.files-changed.outputs.backend == 'true'
     if: needs.files-changed.outputs.backend == 'true'

+ 1 - 4
.github/workflows/codecov_per_test_coverage.yml

@@ -31,10 +31,6 @@ jobs:
 
 
     steps:
     steps:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
-        with:
-          # Avoid codecov error message related to SHA resolution:
-          # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
-          fetch-depth: '2'
 
 
       - name: Setup sentry env
       - name: Setup sentry env
         uses: ./.github/actions/setup-sentry
         uses: ./.github/actions/setup-sentry
@@ -71,5 +67,6 @@ jobs:
         with:
         with:
           files: .artifacts/python.coverage.codecov.json
           files: .artifacts/python.coverage.codecov.json
           flags: smart-tests
           flags: smart-tests
+          override_commit: ${{ github.event.pull_request.head.sha }}
           plugins: compress-pycoverage
           plugins: compress-pycoverage
         continue-on-error: true
         continue-on-error: true

+ 1 - 0
.github/workflows/development-environment.yml

@@ -44,6 +44,7 @@ jobs:
         uses: ./.github/actions/artifacts
         uses: ./.github/actions/artifacts
         with:
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           token: ${{ secrets.CODECOV_TOKEN }}
+          commit_sha: ${{ github.event.pull_request.head.sha }}
   devenv:
   devenv:
     runs-on: ubuntu-22.04
     runs-on: ubuntu-22.04
     timeout-minutes: 5
     timeout-minutes: 5

+ 1 - 5
.github/workflows/frontend.yml

@@ -151,11 +151,6 @@ jobs:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
         name: Checkout sentry
         name: Checkout sentry
 
 
-        with:
-          # Avoid codecov error message related to SHA resolution:
-          # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
-          fetch-depth: '2'
-
       - uses: getsentry/action-setup-volta@e4939d337b83760d13a9d7030a6f68c9d0ee7581 # v2.0.0
       - uses: getsentry/action-setup-volta@e4939d337b83760d13a9d7030a6f68c9d0ee7581 # v2.0.0
 
 
       - name: node_modules cache
       - name: node_modules cache
@@ -199,6 +194,7 @@ jobs:
           files: .artifacts/coverage/*
           files: .artifacts/coverage/*
           type: frontend
           type: frontend
           token: ${{ secrets.CODECOV_TOKEN }}
           token: ${{ secrets.CODECOV_TOKEN }}
+          commit_sha: ${{ github.event.pull_request.head.sha }}
 
 
   # This check runs once all dependant jobs have passed
   # This check runs once all dependant jobs have passed
   # It symbolizes that all required Frontend checks have succesfully passed (Or skipped)
   # It symbolizes that all required Frontend checks have succesfully passed (Or skipped)

+ 0 - 4
.github/workflows/openapi.yml

@@ -21,10 +21,6 @@ jobs:
           private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
           private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
 
 
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
-        with:
-          # Avoid codecov error message related to SHA resolution:
-          # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
-          fetch-depth: '2'
 
 
       - name: Check for python file changes
       - name: Check for python file changes
         uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
         uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0

+ 0 - 4
.github/workflows/shuffle-tests.yml

@@ -43,10 +43,6 @@ jobs:
 
 
     steps:
     steps:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
-        with:
-          # Avoid codecov error message related to SHA resolution:
-          # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
-          fetch-depth: '2'
 
 
       - name: Setup sentry env
       - name: Setup sentry env
         uses: ./.github/actions/setup-sentry
         uses: ./.github/actions/setup-sentry

+ 1 - 1
package.json

@@ -175,7 +175,7 @@
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@biomejs/biome": "^1.7.3",
     "@biomejs/biome": "^1.7.3",
-    "@codecov/webpack-plugin": "^0.0.1-beta.6",
+    "@codecov/webpack-plugin": "^0.0.1-beta.8",
     "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
     "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
     "@sentry/jest-environment": "6.0.0",
     "@sentry/jest-environment": "6.0.0",
     "@sentry/profiling-node": "^8.0.0",
     "@sentry/profiling-node": "^8.0.0",

+ 6 - 0
webpack.config.ts

@@ -787,6 +787,9 @@ if (IS_PRODUCTION) {
 
 
 if (CODECOV_TOKEN && ENABLE_CODECOV_BA) {
 if (CODECOV_TOKEN && ENABLE_CODECOV_BA) {
   const {codecovWebpackPlugin} = require('@codecov/webpack-plugin');
   const {codecovWebpackPlugin} = require('@codecov/webpack-plugin');
+  // defaulting to an empty string which in turn will fallback to env var or
+  // determine merge commit sha from git
+  const GH_COMMIT_SHA = env.GH_COMMIT_SHA ?? '';
 
 
   appConfig.plugins?.push(
   appConfig.plugins?.push(
     codecovWebpackPlugin({
     codecovWebpackPlugin({
@@ -794,6 +797,9 @@ if (CODECOV_TOKEN && ENABLE_CODECOV_BA) {
       bundleName: 'app-webpack-bundle',
       bundleName: 'app-webpack-bundle',
       uploadToken: CODECOV_TOKEN,
       uploadToken: CODECOV_TOKEN,
       debug: true,
       debug: true,
+      uploadOverrides: {
+        sha: GH_COMMIT_SHA,
+      },
     })
     })
   );
   );
 }
 }

Some files were not shown because too many files changed in this diff