From 2f64ecf7a8000e096fa8e399caacdbddc71c00e2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 13 Aug 2024 13:32:17 +0800 Subject: [PATCH] test: enable codecov bundle analysis (#50384) --- .github/workflows/size-limit.yml | 1 + package.json | 1 + scripts/visual-regression/report-template.html | 8 ++------ webpack.config.js | 10 ++++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/size-limit.yml b/.github/workflows/size-limit.yml index 65ba79c033..62accf9777 100644 --- a/.github/workflows/size-limit.yml +++ b/.github/workflows/size-limit.yml @@ -27,5 +27,6 @@ jobs: env: NODE_OPTIONS: "--max_old_space_size=4096" PRODUCTION_ONLY: 1 + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} NO_DUP_CHECK: 1 CI_JOB_NUMBER: 1 diff --git a/package.json b/package.json index 9bb0e6e153..78df445ef7 100644 --- a/package.json +++ b/package.json @@ -156,6 +156,7 @@ "@antv/g6": "^4.8.24", "@babel/eslint-plugin": "^7.24.7", "@biomejs/biome": "^1.8.3", + "@codecov/webpack-plugin": "^0.0.1-beta.10", "@codesandbox/sandpack-react": "^2.18.0", "@dnd-kit/core": "^6.1.0", "@dnd-kit/modifiers": "^7.0.0", diff --git a/scripts/visual-regression/report-template.html b/scripts/visual-regression/report-template.html index 5c0adeede5..1bc3e6354e 100644 --- a/scripts/visual-regression/report-template.html +++ b/scripts/visual-regression/report-template.html @@ -35,17 +35,13 @@ text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; + width: 33%; } td img { max-width: 100%; } - th, - td { - width: 33%; - } - th { background-color: #f2f2f2; } @@ -112,4 +108,4 @@ - \ No newline at end of file + diff --git a/webpack.config.js b/webpack.config.js index 278f2ce360..b306fdf609 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ // This config is for building dist files const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); +const { codecovWebpackPlugin } = require('@codecov/webpack-plugin'); const { EsbuildPlugin } = require('esbuild-loader'); const CircularDependencyPlugin = require('circular-dependency-plugin'); const DuplicatePackageCheckerPlugin = require('@madccc/duplicate-package-checker-webpack-plugin'); @@ -39,6 +40,15 @@ if (process.env.PRODUCTION_ONLY) { // eslint-disable-next-line no-console console.log('🍐 Build production only'); webpackConfig = webpackConfig.filter((config) => config.mode === 'production'); + webpackConfig.forEach((config) => { + config.plugins.push( + codecovWebpackPlugin({ + enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, + bundleName: 'antd', + uploadToken: process.env.CODECOV_TOKEN, + }), + ); + }); } if (process.env.RUN_ENV === 'PRODUCTION') {