From 4ff2c0899b92281031d9420e82e2836a471a035b Mon Sep 17 00:00:00 2001 From: Mabrouk Mahdhi Date: Fri, 24 Jan 2025 01:43:33 +0100 Subject: [PATCH 1/4] DATA: InstallPlaywrightTask --- .../DotNets/Tasks/InstallPlaywrightTask.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightTask.cs diff --git a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightTask.cs b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightTask.cs new file mode 100644 index 0000000..607861c --- /dev/null +++ b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightTask.cs @@ -0,0 +1,13 @@ +// --------------------------------------------------------------------------- +// Copyright (c) Hassan Habib & Shri Humrudha Jagathisun All rights reserved. +// Licensed under the MIT License. +// See License.txt in the project root for license information. +// --------------------------------------------------------------------------- + +namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks +{ + public class InstallPlaywrightTask : GithubTask + { + public override string Run { get; set; } = "dotnet tool install --global Microsoft.Playwright.CLI"; + } +} From f7a12d1d32932afc0bdf47bea865a2774344c82d Mon Sep 17 00:00:00 2001 From: Mabrouk Mahdhi Date: Fri, 24 Jan 2025 01:46:04 +0100 Subject: [PATCH 2/4] DATA: WorkloadUpdateTask --- .../DotNets/Tasks/WorkloadUpdateTask.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/WorkloadUpdateTask.cs diff --git a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/WorkloadUpdateTask.cs b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/WorkloadUpdateTask.cs new file mode 100644 index 0000000..f5c02cc --- /dev/null +++ b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/WorkloadUpdateTask.cs @@ -0,0 +1,13 @@ +// --------------------------------------------------------------------------- +// Copyright (c) Hassan Habib & Shri Humrudha Jagathisun All rights reserved. +// Licensed under the MIT License. +// See License.txt in the project root for license information. +// --------------------------------------------------------------------------- + +namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks +{ + public class WorkloadUpdateTask : GithubTask + { + public override string Run { get; set; } = "dotnet workload update"; + } +} From 3217e27136dc07e044a6763d36b0573c80150fa8 Mon Sep 17 00:00:00 2001 From: Mabrouk Mahdhi Date: Fri, 24 Jan 2025 01:56:10 +0100 Subject: [PATCH 3/4] DATA: InstallPlaywrightBrowsersTask --- .../Tasks/InstallPlaywrightBrowsersTask.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs diff --git a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs new file mode 100644 index 0000000..a7a4c97 --- /dev/null +++ b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs @@ -0,0 +1,17 @@ +// --------------------------------------------------------------------------- +// Copyright (c) Hassan Habib & Shri Humrudha Jagathisun All rights reserved. +// Licensed under the MIT License. +// See License.txt in the project root for license information. +// --------------------------------------------------------------------------- + +using YamlDotNet.Serialization; + +namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks +{ + public class InstallPlaywrightBrowsersTask : GithubTask + { + [YamlIgnore] + public string ProjectName { get; set; } + public override string Run => $"pwsh ./{ProjectName}/bin/Debug/net9.0/playwright.ps1 install"; + } +} From e5b9872b9e4769c8fe58dcf2a9be960aadc3218b Mon Sep 17 00:00:00 2001 From: Mabrouk Mahdhi Date: Mon, 27 Jan 2025 18:18:29 +0100 Subject: [PATCH 4/4] DATA: Add Dotnet Version Parameter --- .../Tasks/InstallPlaywrightBrowsersTask.cs | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs index a7a4c97..3407963 100644 --- a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs +++ b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/Tasks/InstallPlaywrightBrowsersTask.cs @@ -4,14 +4,38 @@ // See License.txt in the project root for license information. // --------------------------------------------------------------------------- -using YamlDotNet.Serialization; - namespace ADotNet.Models.Pipelines.GithubPipelines.DotNets.Tasks { + /// + /// Represents a task that installs Playwright browsers for a given project. + /// public class InstallPlaywrightBrowsersTask : GithubTask { - [YamlIgnore] - public string ProjectName { get; set; } - public override string Run => $"pwsh ./{ProjectName}/bin/Debug/net9.0/playwright.ps1 install"; + private readonly string projectName; + private readonly string dotnetVersion; + + /// + /// Initializes a new instance of the class. + /// + /// The name of the project for which Playwright browsers should be installed. + public InstallPlaywrightBrowsersTask( + string projectName, + string dotnetVersion = "net9.0") + { + this.projectName = projectName; + this.dotnetVersion = dotnetVersion; + } + /// + /// Gets or sets the name of the task. + /// The default value is: "Install Microsoft.Playwright.CLI". + /// + public override string Name { get; set; } = "Install Microsoft.Playwright.CLI."; + + /// + /// Gets the command to execute for the task. + /// The command installs Playwright browsers by running the Playwright CLI script. + /// The default value is: "pwsh ./{projectName}/bin/Debug/{dotnetVersion}/playwright.ps1 install". + /// + public override string Run => $"pwsh ./{projectName}/bin/Debug/{dotnetVersion}/playwright.ps1 install"; } }