Browse Source

Remove frontend browser tests from acceptance workflow (#44307)

Matt Gaunt-Seo @ Sentry.io 2 years ago
parent
commit
fd3c6177cf
3 changed files with 18 additions and 100 deletions
  1. 0 1
      .github/file-filters.yml
  2. 12 92
      .github/workflows/acceptance.yml
  3. 6 7
      .github/workflows/frontend.yml

+ 0 - 1
.github/file-filters.yml

@@ -76,7 +76,6 @@ backend_all: &backend_all
 # This is the ultimate controller for acceptance.yml
 acceptance: &acceptance
   - *backend_all
-  - *frontend_all
   # This is verbose because backend_build_changes includes it, however,
   - '.github/actions/setup-sentry/action.yml'
   - '.github/workflows/acceptance.yml'

+ 12 - 92
.github/workflows/acceptance.yml

@@ -32,7 +32,6 @@ jobs:
     outputs:
       acceptance: ${{ steps.changes.outputs.acceptance }}
       backend_all: ${{ steps.changes.outputs.backend_all }}
-      frontend_all: ${{ steps.changes.outputs.frontend_all }}
     steps:
       - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8  # v3.1.0
 
@@ -43,91 +42,6 @@ jobs:
           token: ${{ github.token }}
           filters: .github/file-filters.yml
 
-  frontend:
-    if: needs.files-changed.outputs.acceptance == 'true'
-    needs: files-changed
-    name: frontend tests
-    # If you change the runs-on image, you must also change the runner in jest-balance.yml
-    # so that the balancer runs in the same environment as the tests.
-    runs-on: ubuntu-20.04
-    timeout-minutes: 30
-    strategy:
-      # This helps not having to run multiple jobs because one fails, thus, reducing resource usage
-      # and reducing the risk that one of many runs would turn red again (read: intermittent tests)
-      fail-fast: false
-      matrix:
-        # XXX: When updating this, make sure you also update CI_NODE_TOTAL.
-        instance: [0, 1, 2, 3]
-
-    env:
-      VISUAL_HTML_ENABLE: 1
-    steps:
-      - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8  # v3.1.0
-        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@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
-
-      - name: node_modules cache
-        uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7  # v3.0.11
-        id: nodemodulescache
-        with:
-          path: node_modules
-          key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
-
-      - name: Install Javascript Dependencies
-        if: steps.nodemodulescache.outputs.cache-hit != 'true'
-        run: yarn install --frozen-lockfile
-
-      - name: Build CSS
-        run: NODE_ENV=production yarn build-css
-
-      - name: jest
-        env:
-          GITHUB_PR_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
-          GITHUB_PR_REF: ${{ github.event.pull_request.head.ref || github.ref }}
-          # XXX: CI_NODE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
-          #      Otherwise, if there are other things in the matrix, using strategy.job-total
-          #      wouldn't be correct.
-          CI_NODE_TOTAL: 4
-          CI_NODE_INDEX: ${{ matrix.instance }}
-        run: |
-          SENTRY_PROFILER_LOGGING_MODE=eager JEST_TESTS=$(yarn -s jest --listTests --json) yarn test-ci --forceExit
-
-      - name: Save HTML artifacts
-        uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb  # v3.1.1
-        with:
-          retention-days: 14
-          name: jest-html
-          path: .artifacts/visual-snapshots/jest
-
-      - name: Create Images from HTML
-        uses: getsentry/action-html-to-image@dc153dae538e6e1138f77156d8e62e3b2b897f41 # main
-        with:
-          base-path: .artifacts/visual-snapshots/jest
-          css-path: src/sentry/static/sentry/dist/entrypoints/sentry.css
-
-      - name: Save snapshots
-        uses: getsentry/action-visual-snapshot@d08945864bd75129863897062b8c1687f1600a2d
-        with:
-          save-only: true
-          snapshot-path: .artifacts/visual-snapshots
-
-      # This job runs when FE or BE changes happen, however, we only upload coverage data for
-      # FE changes since it conflicts with codecov's carry forward functionality
-      # Upload coverage data even if running the tests step fails since
-      # it reduces large coverage fluctuations
-      - name: Handle artifacts
-        uses: ./.github/actions/artifacts
-        if: ${{ always() && needs.files-changed.outputs.frontend_all == 'true' }}
-        with:
-          files: .artifacts/coverage/*
-          type: frontend
-
   acceptance:
     if: needs.files-changed.outputs.acceptance == 'true'
     needs: files-changed
@@ -220,15 +134,17 @@ jobs:
         if: ${{ always() && needs.files-changed.outputs.backend_all == 'true' }}
 
   visual-diff:
+    # triggers visual snapshot is a required check so we need this job to
+    # always run and report a status.
     if: always()
-    # This guarantees that we will only schedule Visual Snapshots if all
-    # workflows that generate artifacts succeed
-    needs: [acceptance, frontend, files-changed]
     name: triggers visual snapshot
+    needs: [acceptance, files-changed]
     runs-on: ubuntu-20.04
     timeout-minutes: 20
     steps:
-      # If any jobs we depend on fail, we will fail since this checks triggers Visual Snapshots which is a required check
+      # If any jobs we depend on fail, we will fail since this check calls the
+      # visual snapshot service which creates the "Visual Snapshot" status,
+      # which is a required check.
       # NOTE: A timeout is considered a failure
       - name: Check for failures
         if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
@@ -245,7 +161,11 @@ jobs:
           gcs-bucket: 'sentry-visual-snapshots'
           gcp-service-account-key: ${{ secrets.SNAPSHOT_GOOGLE_SERVICE_ACCOUNT_KEY }}
 
-  # Since Visual Snapshot is a required check we need to pretend to have run
+  # "Visual Snapshot" is a required check, so we either skip the visual tests
+  # and need to post a status passing OR we run the visual tests and let the
+  # visual snapshot service post a status.
+  #
+  # This handles the skip case and creates a status we skip acceptance tests.
   fake-visual-snapshot:
     name: Visual Snapshot
     needs: [files-changed]
@@ -255,4 +175,4 @@ jobs:
     steps:
       - name: Sentaur attack
         run: |
-          echo "This check pretends to be the Visual Snapshot to satisfy Github required checks"
+          echo "This check creates a Visual Snapshot to satisfy Github required checks when we skip acceptance tests."

+ 6 - 7
.github/workflows/frontend.yml

@@ -228,13 +228,12 @@ jobs:
       # codecov's carry forward functionality.
       # Upload coverage data even if running the tests step fails since
       # it reduces large coverage fluctuations.
-      # TODO: Enable at the full switch
-      #- name: Handle artifacts
-      #  uses: ./.github/actions/artifacts
-      #  if: ${{ always() && needs.files-changed.outputs.frontend_all == 'true' }}
-      #  with:
-      #    files: .artifacts/coverage/*
-      #    type: frontend
+      - name: Handle artifacts
+        uses: ./.github/actions/artifacts
+        if: ${{ always() && needs.files-changed.outputs.frontend_all == 'true' }}
+        with:
+          files: .artifacts/coverage/*
+          type: frontend
 
   frontend-visual-diff:
     needs: [frontend-browser-tests]