Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bench options in stats-config #41432

Merged
merged 7 commits into from Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -16,7 +16,10 @@ function loadStatsConfig() {
'stats-config.js'
))
break
} catch (_) {
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') {
console.error('Failed to load stats-config at', configPath, err)
}
/* */
}
}
Expand Down
49 changes: 0 additions & 49 deletions .github/actions/next-stats-action/src/run/index.js
Expand Up @@ -169,55 +169,6 @@ async function runConfigs(
)
)
curStats.General.buildDurationCached = Date.now() - secondBuildStart

if (statsConfig.appDevCommand) {
const port = await getPort()
const startTime = Date.now()
const child = exec.spawn(statsConfig.appDevCommand, {
cwd: statsAppDir,
env: {
PORT: port,
},
stdio: 'pipe',
})

let serverReadyResolve
let serverReadyResolved = false
const serverReadyPromise = new Promise((resolve) => {
serverReadyResolve = resolve
})

child.stdout.on('data', (data) => {
if (
data.toString().includes('started server') &&
!serverReadyResolved
) {
serverReadyResolved = true
serverReadyResolve()
}
process.stdout.write(data)
})
child.stderr.on('data', (data) => process.stderr.write(data))

child.on('exit', (code) => {
if (!serverReadyResolved) {
serverReadyResolve()
serverReadyResolved = true
}
exitCode = code
})

setTimeout(() => {
if (!serverReadyResolved) {
child.kill()
}
}, 3 * 1000)

await serverReadyPromise
child.kill()

curStats['General']['nextDevReadyDuration'] = Date.now() - startTime
}
}

logger(`Finished running: ${config.title}`)
Expand Down
File renamed without changes.
79 changes: 12 additions & 67 deletions test/.stats-app/stats-config.js
@@ -1,12 +1,3 @@
const fs = require('fs')
const path = require('path')
// this page is conditionally added when not testing
// in webpack 4 mode since it's not supported for webpack 4
const imagePageData = fs.readFileSync(
path.join(__dirname, './image.js'),
'utf8'
)

const clientGlobs = [
{
name: 'Client Bundles (main, webpack)',
Expand Down Expand Up @@ -84,17 +75,13 @@ module.exports = {
title: 'Default Build',
diff: 'onOutputChange',
diffConfigFiles: [
{
path: 'pages/image.js',
content: imagePageData,
},
{
path: 'next.config.js',
content: `
module.exports = {
experimental: {
appDir: true,
// remove after next stable relase (current v12.3.1)
// remove after next stable release (current v12.3.1)
serverComponents: true,
},
generateBuildId: () => 'BUILD_ID',
Expand All @@ -110,10 +97,6 @@ module.exports = {
// renames to apply to make file names deterministic
renames,
configFiles: [
{
path: 'pages/image.js',
content: imagePageData,
},
{
path: 'next.config.js',
content: `
Expand All @@ -135,51 +118,22 @@ module.exports = {
'http://localhost:$PORT/link',
'http://localhost:$PORT/withRouter',
],
pagesToBench: [
'http://localhost:$PORT/',
'http://localhost:$PORT/error-in-render',
],
benchOptions: {
reqTimeout: 60,
concurrency: 50,
numRequests: 2500,
},
// TODO: investigate replacing "ab" for this
// pagesToBench: [
// 'http://localhost:$PORT/',
// 'http://localhost:$PORT/error-in-render',
// ],
// benchOptions: {
// reqTimeout: 60,
// concurrency: 50,
// numRequests: 2500,
// },
},
{
title: 'Default Build with SWC',
diff: 'onOutputChange',
diffConfigFiles: [
{
path: 'pages/image.js',
content: imagePageData,
},
{
path: 'next.config.js',
content: `
module.exports = {
experimental: {
appDir: true,
// remove after next stable relase (current v12.3.1)
serverComponents: true
},
generateBuildId: () => 'BUILD_ID',
swcMinify: true,
webpack(config) {
config.optimization.minimize = false
config.optimization.minimizer = undefined
return config
}
}
`,
},
],
title: 'Default Build with SWC minify',
// renames to apply to make file names deterministic
renames,
configFiles: [
{
path: 'pages/image.js',
content: imagePageData,
},
{
path: 'next.config.js',
content: `
Expand All @@ -202,15 +156,6 @@ module.exports = {
'http://localhost:$PORT/link',
'http://localhost:$PORT/withRouter',
],
pagesToBench: [
'http://localhost:$PORT/',
'http://localhost:$PORT/error-in-render',
],
benchOptions: {
reqTimeout: 60,
concurrency: 50,
numRequests: 2500,
},
},
],
}