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

chore: add tsc and jsii versions as benchmark metric dimension #1083

Merged
merged 13 commits into from
Jun 17, 2024
Merged
51 changes: 48 additions & 3 deletions .github/workflows/build.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 53 additions & 5 deletions projenrc/benchmark-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as tar from 'tar';
import * as ts from 'typescript';
import * as yargs from 'yargs';
import { ACTIONS_SETUP_NODE, YARN_INSTALL } from './common';
import { SUPPORT_POLICY } from './support';

export class BenchmarkTest {
public constructor(
Expand All @@ -21,6 +22,8 @@ export class BenchmarkTest {
receiveArgs: true,
});

const jsiiVersion = SUPPORT_POLICY.current;

const iterations = 20;
const indices = Array.from({ length: iterations }, (_, idx) => idx);

Expand Down Expand Up @@ -142,14 +145,59 @@ export class BenchmarkTest {
'output-credentials': true,
},
},
{
name: 'Get TSC version',
id: 'get_tsc_version',
if: `github.event.repository.fork == false && github.ref == 'refs/heads/main'`,
run: `echo "TSC_VERSION=$(tsc --version | awk '{print $2}')" >> $GITHUB_ENV`,
},
{
name: 'Publish Metrics',
if: `github.event.repository.fork == false && github.ref == 'refs/heads/main'`,
run: [
'aws cloudwatch put-metric-data --metric-name TSC-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-tsc }}',
'aws cloudwatch put-metric-data --metric-name JSII-average --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.duration-jsii }}',
'aws cloudwatch put-metric-data --metric-name JSII-slowdown --namespace JsiiPerformance --value ${{ steps.output_summary.outputs.jsii-slowdown }}',
].join('\n'),
run: `aws cloudwatch put-metric-data --namespace JsiiPerformance --metric-data '[
{
"MetricName": "TSC-average",
"Value": \${{steps.output_summary.outputs.duration-tsc}}
},
{
"MetricName": "JSII-average",
"Value": \${{steps.output_summary.outputs.duration-jsii}}
},
{
"MetricName": "JSII-slowdown",
"Value": \${{steps.output_summary.outputs.jsii-slowdown}}
},
{
"MetricName": "TSC-average",
"Value": \${{steps.output_summary.outputs.duration-tsc}},
"Dimensions": [
{
"Name": "TscVersion",
"Value": "\${{ env.TSC_VERSION }}"
}
]
},
{
"MetricName": "JSII-average",
"Value": \${{steps.output_summary.outputs.duration-jsii}},
"Dimensions": [
{
"Name": "JsiiVersion",
"Value": "${jsiiVersion}"
}
]
},
{
"MetricName": "JSII-slowdown",
"Value": \${{steps.output_summary.outputs.jsii-slowdown}},
"Dimensions": [
{
"Name": "JsiiVersion",
"Value": "${jsiiVersion}"
}
]
}
]'`,
},
],
},
Expand Down
Loading