From 0ff9d1f7ddaa66d2e35e271de9ff0af6383d3707 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 2 Dec 2024 18:05:43 +0000 Subject: [PATCH] fix(ng-dev): allow for temporarily disabling workflows Allow for temporarily disabling workflows from perf tracking --- ng-dev/perf/workflow/loader.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ng-dev/perf/workflow/loader.ts b/ng-dev/perf/workflow/loader.ts index 25b6685f3..be9cf2b28 100644 --- a/ng-dev/perf/workflow/loader.ts +++ b/ng-dev/perf/workflow/loader.ts @@ -2,13 +2,32 @@ import {readFile} from 'fs/promises'; import {parse} from 'yaml'; export interface Workflow { + // The friendly name of the workflow. name: string; + // The set of commands to run under timing test for the workflow. workflow: string[]; + // The set of commands to run in preparation for the workflow. prepare?: string[]; + // The set of commands to run as a cleanup. cleanup?: string[]; + // Whether the workflow is temporarily disabled. + disabled?: true; } export async function loadWorkflows(src: string) { + /** The set of workflows which can be executed. */ + const filteredWorkflows: {[key: string]: Workflow} = {}; + /** The workflow configuration file content as a string. */ const rawWorkflows = await readFile(src, {encoding: 'utf-8'}); - return parse(rawWorkflows).workflows as {[key: string]: Workflow}; + /** The object parsed from the workflow configuration file, holding the workflow configurations. */ + const workflows = parse(rawWorkflows).workflows as {[key: string]: Workflow}; + + // Remove any workflow which is marked as disabled. + for (const [name, workflow] of Object.entries(workflows)) { + if (workflow.disabled !== true) { + filteredWorkflows[name] = workflow; + } + } + + return filteredWorkflows; }