6565 8.0.x
6666 9.0.x
6767
68+ # MTConnect.NET-Docs-Tests carries a Category=E2E route walk
69+ # whose [OneTimeSetUp] runs `npm ci && npm run build` from
70+ # docs/ when the dist/ artifact is missing, then drives
71+ # `vitepress preview` through Microsoft.Playwright. Only the
72+ # ubuntu-latest leg runs Category=E2E (the windows-latest leg
73+ # excludes it via testFilter), so Node is only required there.
74+ - name : Setup Node.js (docs e2e prerequisite)
75+ if : matrix.os == 'ubuntu-latest'
76+ uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
77+ with :
78+ node-version : ' 20'
79+ cache : npm
80+ cache-dependency-path : docs/package-lock.json
81+
82+ # `npm run build` in docs/ invokes the `prebuild` hook
83+ # (`npm run regen`), which calls `bash scripts/generate-api-ref.sh`
84+ # → `docfx metadata` to produce the /api/ reference tree the
85+ # VitePress site consumes. The Docs-site workflow installs docfx
86+ # in its Prepare job; this workflow's E2E leg needs it for the
87+ # same reason. Only the ubuntu-latest leg runs Category=E2E
88+ # (windows-latest excludes it via testFilter), so docfx is only
89+ # required there. Without this, RouteCheckTests.OneTimeSetUp
90+ # fails with "docfx not found on PATH and ~/.dotnet/tools/docfx
91+ # is missing" — see PR #181 run 26831500675 job 79113784371.
92+ - name : Install docfx (docs e2e prerequisite)
93+ if : matrix.os == 'ubuntu-latest'
94+ run : dotnet tool install -g docfx
95+ shell : bash
96+
6897 - name : Restore dotnet tools (ReportGenerator)
6998 run : dotnet tool restore
7099
@@ -74,6 +103,34 @@ jobs:
74103 - name : Build (Debug)
75104 run : dotnet build MTConnect.NET.sln --configuration Debug --no-restore
76105
106+ # Cache Playwright browser binaries so the Category=E2E
107+ # [OneTimeSetUp] `playwright install chromium` call is a no-op on
108+ # cache hit. The key hashes the `playwright-core` package.json that
109+ # the Microsoft.Playwright NuGet copies into the build output —
110+ # that file's `version` field directly pins the chromium revision
111+ # the .NET binding drives. Hashing the csproj instead would only
112+ # invalidate by coincidence (a future PR adding an unrelated
113+ # PackageReference would invalidate; an SDK-side change to the
114+ # chromium revision would not). The step therefore runs AFTER
115+ # `dotnet build` so the file exists — placement before build
116+ # would force the key off a workspace-internal artefact (hashFiles
117+ # cannot reach the NuGet cache under ~/.nuget), so the
118+ # micro-optimisation of overlapping cache restore with build is
119+ # sacrificed for key correctness.
120+ # Both Linux (~/.cache/ms-playwright) and Windows
121+ # (%USERPROFILE%\AppData\Local\ms-playwright) paths are listed;
122+ # actions/cache restores only the path that exists on the running
123+ # OS, so the multi-path entry is safe for both matrix legs.
124+ - name : Cache Playwright browsers
125+ uses : actions/cache@v4
126+ with :
127+ path : |
128+ ~/.cache/ms-playwright
129+ ~\AppData\Local\ms-playwright
130+ key : ${{ runner.os }}-playwright-${{ hashFiles('**/tests/MTConnect.NET-Docs-Tests/bin/Debug/net8.0/.playwright/package/package.json') }}
131+ restore-keys : |
132+ ${{ runner.os }}-playwright-
133+
77134 # MTConnect.NET-Integration-Tests is skipped here (its
78135 # IsTestProject is false unless IntegrationCoverage=true) and run
79136 # in the dedicated step below so it can use its own
0 commit comments