Skip to content

Commit c59f8cc

Browse files
authored
feat: show expected failures for rolldown-vite runs (#395)
1 parent b886c61 commit c59f8cc

File tree

14 files changed

+89
-6
lines changed

14 files changed

+89
-6
lines changed

.github/workflows/ecosystem-ci-rolldown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,4 @@ jobs:
107107
STATUS: ${{ job.status }}
108108
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL_ROLLDOWN_VITE }}
109109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
IS_ROLLDOWN_VITE: "1"

discord-webhook.ts

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ type Env = {
1111
SUITE?: string
1212
STATUS?: Status
1313
DISCORD_WEBHOOK_URL?: string
14+
IS_ROLLDOWN_VITE?: '1'
1415
}
1516

1617
const statusConfig = {
1718
success: {
1819
color: parseInt('57ab5a', 16),
1920
emoji: ':white_check_mark:',
2021
},
22+
expectedFailure: {
23+
color: parseInt('c69026', 16),
24+
emoji: ':construction:',
25+
},
2126
failure: {
2227
color: parseInt('e5534b', 16),
2328
emoji: ':x:',
@@ -53,6 +58,14 @@ async function run() {
5358
assertEnv('SUITE', env.SUITE)
5459
assertEnv('STATUS', env.STATUS)
5560
assertEnv('DISCORD_WEBHOOK_URL', env.DISCORD_WEBHOOK_URL)
61+
const isRolldownVite = !!env.IS_ROLLDOWN_VITE
62+
const expectedFailureReason = isRolldownVite
63+
? await loadExpectedFailureReason(env.SUITE)
64+
: undefined
65+
const status =
66+
env.STATUS === 'failure' && expectedFailureReason
67+
? 'expectedFailure'
68+
: env.STATUS
5669

5770
await setupEnvironment()
5871

@@ -67,9 +80,13 @@ async function run() {
6780
avatar_url: 'https://github.com/vitejs.png',
6881
embeds: [
6982
{
70-
title: `${statusConfig[env.STATUS].emoji} ${env.SUITE}`,
71-
description: await createDescription(env.SUITE, targetText),
72-
color: statusConfig[env.STATUS].color,
83+
title: `${statusConfig[status].emoji} ${env.SUITE}`,
84+
description: await createDescription(
85+
env.SUITE,
86+
targetText,
87+
expectedFailureReason,
88+
),
89+
color: statusConfig[status].color,
7390
},
7491
],
7592
}
@@ -97,6 +114,12 @@ function assertEnv<T>(
97114
}
98115
}
99116

117+
async function loadExpectedFailureReason(suite: string) {
118+
const module = await import(`./tests/${suite}.ts`)
119+
const reason: string | undefined = module.rolldownViteExpectedFailureReason
120+
return reason?.trim()
121+
}
122+
100123
async function createRunUrl(suite: string) {
101124
const result = await fetchJobs()
102125
if (!result) {
@@ -151,13 +174,24 @@ async function fetchJobs() {
151174
}
152175
}
153176

154-
async function createDescription(suite: string, targetText: string) {
177+
async function createDescription(
178+
suite: string,
179+
targetText: string,
180+
expectedFailureReason: string | undefined,
181+
) {
155182
const runUrl = await createRunUrl(suite)
156183
const open = runUrl === undefined ? 'Null' : `[Open](${runUrl})`
157-
158-
return `
184+
let message = `
159185
:scroll:\u00a0\u00a0${open}\u3000\u3000:zap:\u00a0\u00a0${targetText}
160186
`.trim()
187+
if (expectedFailureReason) {
188+
message +=
189+
'\n' +
190+
`
191+
:bulb:\u00a0\u00a0${expectedFailureReason}
192+
`.trim()
193+
}
194+
return message
161195
}
162196

163197
function createTargetText(

tests/astro.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ export async function test(options: RunOptions) {
1010
test: 'test:vite-ci',
1111
})
1212
}
13+
14+
export const rolldownViteExpectedFailureReason = `
15+
needs to be updated on astro side (manualChunks) and rolldown side (https://github.com/rolldown/rolldown/issues/3640)
16+
`

tests/histoire.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ export async function test(options: RunOptions) {
1010
test: ['test', 'test:examples'],
1111
})
1212
}
13+
14+
export const rolldownViteExpectedFailureReason = `
15+
needs to be updated on histoire side (manualChunks)
16+
`

tests/ladle.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ export async function test(options: RunOptions) {
1111
test: 'test',
1212
})
1313
}
14+
15+
export const rolldownViteExpectedFailureReason = `
16+
needs to be updated on ladle side (transformWithEsbuild)
17+
`

tests/nuxt.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ export async function test(options: RunOptions) {
1313
test: ['test:fixtures', 'test:fixtures:dev', 'test:types'],
1414
})
1515
}
16+
17+
export const rolldownViteExpectedFailureReason = `
18+
needs to be updated on rolldown side (different chunking behavior, also https://github.com/oxc-project/oxc/issues/9170)
19+
`

tests/one.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ export async function test(options: RunOptions) {
1111
test: 'test:vite-ecosystem-ci',
1212
})
1313
}
14+
15+
export const rolldownViteExpectedFailureReason = `
16+
needs to be updated on one side (manualChunks)
17+
`

tests/qwik.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ export async function test(options: RunOptions) {
1010
test: 'test.vite',
1111
})
1212
}
13+
14+
export const rolldownViteExpectedFailureReason = `
15+
needs to be updated on qwik side (manualChunks, types)
16+
`

tests/storybook.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ export async function test(options: RunOptions) {
1111
test: 'vite-ecosystem-ci:test',
1212
})
1313
}
14+
15+
export const rolldownViteExpectedFailureReason = `
16+
needs to be updated on rolldown side (https://github.com/vitejs/rolldown-vite/issues/182)
17+
`

tests/sveltekit.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ export async function test(options: RunOptions) {
1818
],
1919
})
2020
}
21+
22+
export const rolldownViteExpectedFailureReason = `
23+
needs to be updated on sveltekit side
24+
`

0 commit comments

Comments
 (0)