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


##########
.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'

Review Comment:
   The detector runs tip-vs-parent for every job in this workflow, and pushes 
to master are squash merges, so the tip is the whole change. Not specific to 
this job.



##########
.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:
   @sadpandajoe good catch, not intended. The job now skips pushes unless the 
ref is `master`, and `autoAcceptChanges` is keyed on `refs/heads/master` too.



##########
.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:
   @sadpandajoe not intentional. Added `workflow_dispatch` to the `on:` block; 
a dispatch from `master` auto-accepts, so it refreshes the baseline.



-- 
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