sadpandajoe commented on code in PR #45609:
URL: https://github.com/apache/superset/pull/45609#discussion_r4345210126


##########
.github/workflows/superset-frontend.yml:
##########
@@ -207,8 +207,63 @@ jobs:
           docker run --rm $TAG bash -c \
           "npx playwright install-deps && npx playwright install chromium && 
npm run test-storybook"
 
+  # Chromatic used to live in its own workflow and build a second copy of the
+  # CI image (about 50 s on a warm layer cache, 7 minutes after a lockfile
+  # change). It now reuses the image frontend-build uploads, like the other
+  # jobs here. Every step is skipped when the project token is absent
+  # (forks), which is what the old workflow did too.
+  chromatic:

Review Comment:
   The deleted `chromatic.yml` had `workflow_dispatch`, but this workflow only 
runs on push and pull_request, so there is no longer a way to publish Chromatic 
manually (e.g. after rotating `CHROMATIC_PROJECT_TOKEN`, to refresh the master 
baseline) without another qualifying code change. Is dropping the manual 
trigger intentional, or should `workflow_dispatch` be added to the `on:` block 
(the change detector already treats it as all-changed)?



##########
.github/workflows/superset-frontend.yml:
##########
@@ -207,8 +207,63 @@ jobs:
           docker run --rm $TAG bash -c \
           "npx playwright install-deps && npx playwright install chromium && 
npm run test-storybook"
 
+  # Chromatic used to live in its own workflow and build a second copy of the
+  # CI image (about 50 s on a warm layer cache, 7 minutes after a lockfile
+  # change). It now reuses the image frontend-build uploads, like the other
+  # jobs here. Every step is skipped when the project token is absent
+  # (forks), which is what the old workflow did too.
+  chromatic:
+    needs: frontend-build
+    if: needs.frontend-build.outputs.should-run == 'true'
+    runs-on: ubuntu-26.04
+    timeout-minutes: 30
+    permissions:
+      contents: read
+      pull-requests: write
+    env:
+      CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
+    steps:
+      # Chromatic's onlyChanged (TurboSnap) needs git history to find the
+      # baseline commit, hence the deeper checkout.
+      - name: Checkout Code
+        if: ${{ env.CHROMATIC_PROJECT_TOKEN != '' }}
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 
v7.0.1
+        with:
+          persist-credentials: false
+          fetch-depth: 500
+          ref: ${{ github.event_name == 'pull_request' && 
github.event.pull_request.head.sha || github.sha }}
+      - name: Download Docker Image Artifact
+        if: ${{ env.CHROMATIC_PROJECT_TOKEN != '' }}
+        uses: 
actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+        with:
+          name: docker-image
+      - name: Load Docker Image
+        if: ${{ env.CHROMATIC_PROJECT_TOKEN != '' }}
+        run: |
+          zstd -d < docker-image.tar.zst | docker load
+      - name: Build Storybook
+        if: ${{ env.CHROMATIC_PROJECT_TOKEN != '' }}
+        run: |
+          mkdir -p ${{ github.workspace }}/superset-frontend/storybook-static
+          docker run \
+          -v ${{ github.workspace 
}}/superset-frontend/storybook-static:/app/superset-frontend/storybook-static \
+          --rm $TAG \
+          bash -c "npm run build-storybook -- --webpack-stats-json"
+      - name: Publish to Chromatic
+        if: ${{ env.CHROMATIC_PROJECT_TOKEN != '' }}
+        uses: chromaui/action@18599f2ae5010524d496b86099c9b69a37f5d8d2 # 
v18.12.2
+        with:
+          projectToken: ${{ env.CHROMATIC_PROJECT_TOKEN }}
+          token: ${{ secrets.GITHUB_TOKEN }}
+          workingDir: superset-frontend
+          storybookBuildDir: storybook-static
+          onlyChanged: true
+          exitZeroOnChanges: true
+          autoAcceptChanges: ${{ github.event_name == 'push' }}

Review Comment:
   This workflow also triggers on pushes to the `[0-9].[0-9]*` release 
branches, and the old standalone workflow only ran on `master`. With the token 
present, a frontend backport push to a release branch will now publish 
Storybook to Chromatic and auto-accept every visual change as that branch's 
baseline, so regressions there never get reviewed. Should the `push` case be 
limited to `refs/heads/master` (e.g. an `if:` on the job or step), or is 
publishing release branches with auto-accept intended?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to