Skip to content

Commit 1f77abe

Browse files
committed
chore: add Codecov bundle analysis to CI
Installs @codecov/vite-plugin and wires it into the Vite config so bundle stats are generated and uploaded to Codecov during CI builds. The plugin is a no-op when CODECOV_TOKEN is absent (local builds, fork PRs).
1 parent baa858c commit 1f77abe

4 files changed

Lines changed: 155 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: read
10+
id-token: write
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.ref }}
@@ -25,6 +26,8 @@ jobs:
2526
- run: cp .env.example .env
2627
- name: Build (captures log for link check)
2728
shell: bash
29+
env:
30+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2831
run: |
2932
set -o pipefail
3033
pnpm build 2>&1 | tee build.log

astro.config.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import sitemap from "@astrojs/sitemap";
88
import starlight from "@astrojs/starlight";
99
import starlightDocSearch from "@astrojs/starlight-docsearch";
1010
import vercel from "@astrojs/vercel";
11+
import { codecovVitePlugin } from "@codecov/vite-plugin";
1112
import tailwindcss from "@tailwindcss/vite";
1213
import { defineConfig, envField, fontProviders } from "astro/config";
1314
import favicons from "astro-favicons";
@@ -334,7 +335,14 @@ export default defineConfig({
334335
staticHeaders: true,
335336
}),
336337
vite: {
337-
plugins: [tailwindcss()],
338+
plugins: [
339+
tailwindcss(),
340+
codecovVitePlugin({
341+
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
342+
bundleName: "aptos-docs",
343+
uploadToken: process.env.CODECOV_TOKEN,
344+
}),
345+
],
338346
optimizeDeps: {
339347
exclude: ["@rollup/browser"],
340348
},

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"@astrojs/check": "0.9.8",
7878
"@astrojs/markdown-remark": "7.1.0",
7979
"@biomejs/biome": "2.4.4",
80+
"@codecov/vite-plugin": "2.0.1",
8081
"@crowdin/cli": "4.14.1",
8182
"@expressive-code/plugin-collapsible-sections": "0.41.7",
8283
"@graphiql/toolkit": "0.11.3",

pnpm-lock.yaml

Lines changed: 142 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)