-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automation: Track Gutenberg performance metrics over time. (#33694)
- Loading branch information
1 parent
979c34a
commit 26a9c45
Showing
4 changed files
with
104 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
const fs = require( 'fs' ); | ||
const path = require( 'path' ); | ||
const https = require( 'https' ); | ||
const [ branch, hash, baseHash, timestamp ] = process.argv.slice( 2 ); | ||
|
||
const performanceResults = JSON.parse( | ||
fs.readFileSync( | ||
path.join( __dirname, '../post-editor-performance-results.json' ), | ||
'utf8' | ||
) | ||
); | ||
|
||
const data = new TextEncoder().encode( | ||
JSON.stringify( { | ||
branch, | ||
hash, | ||
baseHash, | ||
timestamp: parseInt( timestamp, 10 ), | ||
metrics: performanceResults[ hash ], | ||
baseMetrics: performanceResults[ baseHash ], | ||
} ) | ||
); | ||
|
||
const options = { | ||
hostname: 'codehealth-riad.vercel.app', | ||
port: 443, | ||
path: '/api/log', | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Content-Length': data.length, | ||
}, | ||
}; | ||
|
||
const req = https.request( options, ( res ) => { | ||
console.log( `statusCode: ${ res.statusCode }` ); | ||
|
||
res.on( 'data', ( d ) => { | ||
process.stdout.write( d ); | ||
} ); | ||
} ); | ||
|
||
req.on( 'error', ( error ) => { | ||
console.error( error ); | ||
} ); | ||
|
||
req.write( data ); | ||
req.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters