From afcdb98b70a2513add41135a305ae9026506cd9c Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Mon, 9 Oct 2023 05:01:48 -0700 Subject: [PATCH] Revert "temporarily disable Chromatic upload that is failing on main (#57455)" (#57463) This reverts commit 4c23391014ecbc0159e5c64f55e95f8de9cef718 and adds a workaround to the Storybook Vite configuration to make it work. --- client/storybook/src/main.ts | 14 ++++++++++++++ dev/ci/internal/ci/operations.go | 6 ++---- doc/dev/background-information/ci/reference.md | 16 ++++++++-------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/client/storybook/src/main.ts b/client/storybook/src/main.ts index 417191f82b8..34bf5057b1b 100644 --- a/client/storybook/src/main.ts +++ b/client/storybook/src/main.ts @@ -63,6 +63,20 @@ const config: StorybookConfig & StorybookConfigVite & ReactViteStorybookConfig = viteFinal: config => { config.define = { ...config.define, 'process.env.CHROMATIC': getEnvironmentBoolean('CHROMATIC') } + + config.build = { + ...config.build, + minify: false, + + // HACK(sqs): cssCodeSplit is needed to avoid `Failed to fetch dynamically imported + // module: ...` errors where SourcegraphWebApp.scss's JavaScript stub file with the CSS + // module class names is not emitted in the Storybook build. (It works in the dev + // server.) This is not a perfect workaround as there are some incorrect global styles + // being applied, but it's mostly fine (and any discrepancies are likely due to our + // misuse of global CSS anyway). + cssCodeSplit: false, + } + config.css = { ...config.css, modules: { diff --git a/dev/ci/internal/ci/operations.go b/dev/ci/internal/ci/operations.go index 0e8a4721a67..222cb76f15c 100644 --- a/dev/ci/internal/ci/operations.go +++ b/dev/ci/internal/ci/operations.go @@ -321,10 +321,8 @@ func clientChromaticTests(opts CoreTestOperationsOptions) operations.Operation { chromaticCommand += " | ./dev/ci/post-chromatic.sh" } - // TODO(sqs): build is failing (https://buildkite.com/sourcegraph/sourcegraph/builds/246235#018b0c9a-38be-43ed-af9e-d8cf04ab7305) - _ = stepOpts - _ = chromaticCommand - // pipeline.AddStep(":chromatic: Upload Storybook to Chromatic", append(stepOpts, bk.Cmd(chromaticCommand))...) + pipeline.AddStep(":chromatic: Upload Storybook to Chromatic", + append(stepOpts, bk.Cmd(chromaticCommand))...) } } diff --git a/doc/dev/background-information/ci/reference.md b/doc/dev/background-information/ci/reference.md index 39579193e59..ad3c7161b68 100644 --- a/doc/dev/background-information/ci/reference.md +++ b/doc/dev/background-information/ci/reference.md @@ -29,7 +29,7 @@ The default run type. - Tests - Async BackCompat Tests - **Linters and static analysis**: Run sg lint - - **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) + - **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - **Pipeline setup**: Trigger async @@ -37,7 +37,7 @@ The default run type. - Perform bazel prechecks - Tests - Async BackCompat Tests - - **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) + - **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - Pipeline for `DatabaseSchema` changes: @@ -141,7 +141,7 @@ Base pipeline (more steps might be included based on branch changes): - Tests - Async BackCompat Tests - **Linters and static analysis**: Run sg lint -- **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) +- **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - **Publish candidate images**: Push candidate Images - **End-to-end tests**: Executors E2E @@ -203,7 +203,7 @@ Base pipeline (more steps might be included based on branch changes): - Tests - Async BackCompat Tests - **Linters and static analysis**: Run sg lint -- **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) +- **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - **Publish candidate images**: Push candidate Images - **End-to-end tests**: Executors E2E @@ -221,7 +221,7 @@ Base pipeline (more steps might be included based on branch changes): - Tests - Async BackCompat Tests - **Linters and static analysis**: Run sg lint -- **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) +- **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - **Publish candidate images**: Push candidate Images - **End-to-end tests**: Executors E2E @@ -262,7 +262,7 @@ Base pipeline (more steps might be included based on branch changes): - Tests - Async BackCompat Tests - **Linters and static analysis**: Run sg lint -- **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) +- **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - **Publish candidate images**: Push candidate Images - **End-to-end tests**: Executors E2E @@ -285,7 +285,7 @@ Base pipeline (more steps might be included based on branch changes): - Tests - Async BackCompat Tests - **Linters and static analysis**: Run sg lint -- **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) +- **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - **Publish candidate images**: Push candidate Images - **End-to-end tests**: Executors E2E @@ -361,7 +361,7 @@ Base pipeline (more steps might be included based on branch changes): - Tests - Async BackCompat Tests - **Linters and static analysis**: Run sg lint -- **Client checks**: Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) +- **Client checks**: Upload Storybook to Chromatic, Enterprise build, Build (client/jetbrains), Tests for VS Code extension, Stylelint (all) - **Security Scanning**: Sonarcloud Scan - **Publish candidate images**: Push candidate Images - **End-to-end tests**: Executors E2E