ci(release): build the frontend before deploying mocked services #381

Merged
allan merged 1 commits from fix/ci-release-build-frontend into main 2026-10-28 01:08:49 +00:00
Collaborator

Why

The Build-and-test-development job in release.yaml fails on every push to main at Deploy mocked services:

[error] An error has occurred when compiling web app services. Error: webSourcePath: '.../client/dist' present in 'streamConfig' doesn't exist.
[error] Error building project:  Web source folder not found: .../client/dist. Check streamConfig.webSourcePath - build the frontend first.
  ❌  Failure - Main Deploy mocked services
exitcode '2': failure

The server-ci mock target has streamWeb: true with webSourcePath: ../../client/dist, so sasjs cbd -t server-ci needs a production frontend build on disk. The Build-and-test-development job in build.yaml gained a "Build frontend for web streaming" step for exactly this reason; the equivalent job in release.yaml never did, so it deploys mocks against an empty client/dist.

Because release needs this job, the whole release pipeline is blocked: the released commit merges to main and no release is cut.

What changed

  • .gitea/workflows/release.yaml, job Build-and-test-development: added a Build frontend for web streaming step (cd client && npm run build) between Install dependencies and Setup and start SASjs server - the same step, in the same position, as the passing build.yaml job.

No product code, no test change. client/dist is gitignored, so nothing new is committed to the tree.

Verification

Reproduced the failure and the fix locally, against this branch's tree:

  1. Without client/dist: npx @sasjs/cli cb -t server-ci in sas/mocks/sasjs - fails with Error building project: Web source folder not found: <repo>/client/dist. Check streamConfig.webSourcePath - build the frontend first. (identical to the CI error).
  2. With a client/dist present: the same command completes - The project was successfully compiled for SASJS using target 'server-ci' and Services have been successfully built!, server-ci.json.zip written.

Supporting evidence from CI:

  • Run 2409 (this failure): job Build-production-and-ng-test success, job Build-and-test-development failure at Deploy mocked services.
  • Run 2400 (PR, build.yaml, i.e. the job that does build the frontend first): Build-and-test-development success, including the full Cypress suite against the mocked backend.

Not verified here: the full release workflow cannot run before merge - release.yaml triggers only on push to main, and a PR runs build.yaml instead. There is also no SHEET_PWD on this box, so npm ci in client/ (and therefore a real npm run build) could not be executed locally; step placement, YAML parse (yaml.safe_load, 12 steps in order) and prettier@3.8.4 --check all pass.

release was skipped in run 2409 and will run again on the next push to main once this is merged.

  • agent001
## Why The `Build-and-test-development` job in `release.yaml` fails on every push to `main` at **Deploy mocked services**: ``` [error] An error has occurred when compiling web app services. Error: webSourcePath: '.../client/dist' present in 'streamConfig' doesn't exist. [error] Error building project: Web source folder not found: .../client/dist. Check streamConfig.webSourcePath - build the frontend first. ❌ Failure - Main Deploy mocked services exitcode '2': failure ``` The `server-ci` mock target has `streamWeb: true` with `webSourcePath: ../../client/dist`, so `sasjs cbd -t server-ci` needs a production frontend build on disk. The `Build-and-test-development` job in `build.yaml` gained a "Build frontend for web streaming" step for exactly this reason; the equivalent job in `release.yaml` never did, so it deploys mocks against an empty `client/dist`. Because `release` needs this job, the whole release pipeline is blocked: the released commit merges to `main` and no release is cut. ## What changed - `.gitea/workflows/release.yaml`, job `Build-and-test-development`: added a **Build frontend for web streaming** step (`cd client && npm run build`) between *Install dependencies* and *Setup and start SASjs server* - the same step, in the same position, as the passing `build.yaml` job. No product code, no test change. `client/dist` is gitignored, so nothing new is committed to the tree. ## Verification Reproduced the failure and the fix locally, against this branch's tree: 1. Without `client/dist`: `npx @sasjs/cli cb -t server-ci` in `sas/mocks/sasjs` - fails with `Error building project: Web source folder not found: <repo>/client/dist. Check streamConfig.webSourcePath - build the frontend first.` (identical to the CI error). 2. With a `client/dist` present: the same command completes - `The project was successfully compiled for SASJS using target 'server-ci'` and `Services have been successfully built!`, `server-ci.json.zip` written. Supporting evidence from CI: - Run 2409 (this failure): job `Build-production-and-ng-test` success, job `Build-and-test-development` failure at *Deploy mocked services*. - Run 2400 (PR, `build.yaml`, i.e. the job that *does* build the frontend first): `Build-and-test-development` success, including the full Cypress suite against the mocked backend. Not verified here: the full release workflow cannot run before merge - `release.yaml` triggers only on `push` to `main`, and a PR runs `build.yaml` instead. There is also no `SHEET_PWD` on this box, so `npm ci` in `client/` (and therefore a real `npm run build`) could not be executed locally; step placement, YAML parse (`yaml.safe_load`, 12 steps in order) and `prettier@3.8.4 --check` all pass. `release` was skipped in run 2409 and will run again on the next push to `main` once this is merged. - agent001
hermes added 1 commit 2026-10-28 01:07:24 +00:00
ci(release): build the frontend before deploying mocked services
Build / Build-and-ng-test (pull_request) Canceled after 1m32s
Build / Build-and-test-development (pull_request) Canceled after 0s
Lighthouse Checks / lighthouse (pull_request) Successful in 19m52s
bc9e0996ec
hermes left a comment
Author
Collaborator

Reviewed the full base...head diff: one CI change in .gitea/workflows/release.yaml (+10 lines), adding a client production build before the mocked-services deploy. ci(release): is the right type and cuts no release, which matches the change.

  • .gitea/workflows/release.yaml:110-118 - the new step runs npm run build immediately after the install step (release.yaml:103-108) but skips npm run postinstall, which both other frontend build/serve paths in this workflow run first: the Angular Production Build job (release.yaml:61-65) and the cypress serve path (release.yaml:176). If postinstall produces anything the Angular build consumes, this step will fail or stream an incomplete dist. Add npm run postinstall before npm run build to match those paths.
  • .gitea/workflows/release.yaml:110-118 - the build happens before the index.html <sasjs> rewrites at release.yaml:178-180, so the dist streamed as the 'clickme' web app carries the repo's default serverUrl/appLoc rather than the local SASJS values. That is fine if the dist only needs to exist to satisfy webSourcePath (which is what the step comment describes), but the deployed copy cannot be opened against the test server - worth saying so in the step comment so the next reader does not assume it is a usable build.

No blocking issues.

Reviewed the full base...head diff: one CI change in .gitea/workflows/release.yaml (+10 lines), adding a client production build before the mocked-services deploy. `ci(release):` is the right type and cuts no release, which matches the change. - .gitea/workflows/release.yaml:110-118 - the new step runs `npm run build` immediately after the install step (release.yaml:103-108) but skips `npm run postinstall`, which both other frontend build/serve paths in this workflow run first: the Angular Production Build job (release.yaml:61-65) and the cypress serve path (release.yaml:176). If postinstall produces anything the Angular build consumes, this step will fail or stream an incomplete dist. Add `npm run postinstall` before `npm run build` to match those paths. - .gitea/workflows/release.yaml:110-118 - the build happens before the index.html `<sasjs>` rewrites at release.yaml:178-180, so the dist streamed as the 'clickme' web app carries the repo's default serverUrl/appLoc rather than the local SASJS values. That is fine if the dist only needs to exist to satisfy webSourcePath (which is what the step comment describes), but the deployed copy cannot be opened against the test server - worth saying so in the step comment so the next reader does not assume it is a usable build. No blocking issues.
allan merged commit 849153d4a2 into main 2026-10-28 01:08:49 +00:00
allan deleted branch fix/ci-release-build-frontend 2026-10-28 01:08:49 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/dc#381