Skip to content

Commit 330737d

Browse files
committed
fixup! feat(ng-dev): add support for uploading results of workflow testing to database
1 parent 55a8a88 commit 330737d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.github/workflows/perf.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ jobs:
4545
- uses: ./github-actions/npm/checkout-and-setup-node
4646
- uses: ./github-actions/bazel/setup
4747
- run: yarn install --immutable
48+
# We utilize the google-github-actions/auth action to allow us to get an active credential using workflow
49+
# identity federation. This allows us to request short lived credentials on demand, rather than storing
50+
# credentials in secrets long term. More information can be found at:
51+
# https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-google-cloud-platform
4852
- uses: 'google-github-actions/auth@v2'
4953
with:
5054
project_id: 'internal-200822'

ng-dev/perf/workflow/database.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,32 @@
88

99
import {Spanner} from '@google-cloud/spanner';
1010

11+
/**
12+
* The workflow performance results are stored in a spanner database within our
13+
* project to be able to retrieve later, The commit sha will be used as a foreign
14+
* key to point to specific commits found in the table of commit shas expressing
15+
* the full graph of commits within the git graph for the repository.
16+
*
17+
* The workflow performance table is defined with the following characteristics.
18+
*
19+
* |--------------------------------------------------------------------|
20+
* | Column | Type | Notes |
21+
* |--------------------------------------------------------------------|
22+
* | workflow_performance_id | STRING(36) | Autogenerated |
23+
* | commit_sha | STRING(40) | |
24+
* | value | FLOAT64 | |
25+
* | name | STRING(256) | |
26+
* |--------------------------------------------------------------------|
27+
*/
28+
29+
/** The reuslt of workflow performance eresult to be stored in the database. */
1130
export interface WorkflowPerformanceRowResult {
1231
commit_sha: string;
1332
value: number;
1433
name: string;
1534
}
1635

36+
/** Add a single workflow performance result to the spanner database. */
1737
export async function addWorkflowPerformanceResult(result: WorkflowPerformanceRowResult) {
1838
/** The spanner client instance. */
1939
const spanner = new Spanner({
@@ -27,7 +47,7 @@ export async function addWorkflowPerformanceResult(result: WorkflowPerformanceRo
2747
const workflowPerformanceTable = database.table('WorkflowPerformance');
2848

2949
try {
30-
await workflowPerformanceTable.insert([result]);
50+
await workflowPerformanceTable.insert(result);
3151
} finally {
3252
await database.close();
3353
}

0 commit comments

Comments
 (0)