Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Improve Playwright Setup Time
  • Loading branch information
pgermishuys committed Sep 18, 2025
commit c5accebd0b5a4a0fa3063f78934ea9894e73be1a
2 changes: 2 additions & 0 deletions .github/workflow-gen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ void GenerateCiWorkflow(Product product)

playwrightJob.StepBuild(product.Solution);

playwrightJob.CachePlaywrightAssets();

playwrightJob.StepInstallPlayWright();

playwrightJob.StepDotNetDevCerts();
Expand Down
10 changes: 10 additions & 0 deletions .github/workflow-gen/StepExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,19 @@ public static void StepDotNetDevCerts(this Job job)
.Name("Dotnet devcerts")
.Run("dotnet dev-certs https --trust");

public static void CachePlaywrightAssets(this Job job)
=> job.Step("playwright-cache")
.Name("Cache Playwright assets")
.Uses("actions/cache@v4")
.With(
("path", "~/.cache/ms-playwright"),
("key", "playwright-${{ runner.os }}-${{ hashFiles('**/Hosts.Tests.csproj') }}"),
("restore-keys", "playwright-${{ runner.os }}-"));

public static void StepInstallPlayWright(this Job job)
=> job.Step()
.Name("Install Playwright")
.If("steps.playwright-cache.outputs.cache-hit != 'true'")
.Run("pwsh test/Hosts.Tests/bin/Release/net9.0/playwright.ps1 install --with-deps");

public static void StepToolRestore(this Job job)
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/bff-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,15 @@ jobs:
# We do not intend to keep using Debug config after it is fixed in net10.0 rc2.
# Re-generating the workflows with workflow-gen will overwrite this.
run: dotnet build bff.slnf --no-restore -c Debug
- id: playwright-cache
name: Cache Playwright assets
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('**/Hosts.Tests.csproj') }}
restore-keys: playwright-${{ runner.os }}-
- name: Install Playwright
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pwsh test/Hosts.Tests/bin/Debug/net9.0/playwright.ps1 install --with-deps
- name: Dotnet devcerts
run: dotnet dev-certs https --trust
Expand Down
Loading