Skip to content

Commit

Permalink
Update bench options in stats-config (#41432)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Oct 15, 2022
1 parent 974e8b6 commit c66b8f3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 117 deletions.
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,
},
},
],
}

0 comments on commit c66b8f3

Please sign in to comment.