-
Notifications
You must be signed in to change notification settings - Fork 0
perf(ci): implement repository-wide CI optimization and Nx Cloud integration #12102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
ceb9324
b0004b7
6995bc0
e3b00ae
fedfc42
30c087f
f6e9a16
77e183d
27dc103
779a26c
ab7d796
ad3805a
c8de4f3
7698fb1
9d6b4d2
10d1015
265732f
cedb687
7329c34
f5dc3f7
4d5adba
1680482
63fab5c
0ff7d8a
64d2dda
fcba180
3371a42
116b3a0
c6b65df
47eb2c8
0b1bf6c
2a29b27
2b5c845
c853be6
07d6426
066c663
1ceab70
e6a8855
57fd5d5
02717e7
2607394
48ccc10
0e7518f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,7 +64,16 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||
| run: corepack enable | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install root dependencies | ||||||||||||||||||||||||||||||||||||||||||||||
| run: pnpm install --no-frozen-lockfile | ||||||||||||||||||||||||||||||||||||||||||||||
| run: pnpm install --frozen-lockfile | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Vercel and Next.js Caching | ||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||||||||||||||||||||||||
| apps/website/.next/cache | ||||||||||||||||||||||||||||||||||||||||||||||
| key: ${{ runner.os }}-website-next-cache-${{ github.sha }} | ||||||||||||||||||||||||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||||||||||||||||||||||||
| ${{ runner.os }}-website-next-cache- | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Validate Vercel token | ||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -79,57 +88,27 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||
| curl -fsS -X PATCH \ | ||||||||||||||||||||||||||||||||||||||||||||||
| -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" \ | ||||||||||||||||||||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||||||||||||||||||||
| -d '{"buildCommand":"npm run build","outputDirectory":"apps/website/.next"}' \ | ||||||||||||||||||||||||||||||||||||||||||||||
| -d '{"buildCommand":"pnpm --filter website build","outputDirectory":"apps/website/.next","installCommand":"true"}' \ | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| -d '{"buildCommand":"pnpm --filter website build","outputDirectory":"apps/website/.next","installCommand":"true"}' \ | |
| -d '{"buildCommand":"pnpm --filter website build","outputDirectory":"apps/website/.next"}' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Vercel project settings installCommand skip install with prebuilt deploy
💡 Result:
To skip the install step in Vercel project settings for a prebuilt deployment, use the Install Command override in the Build & Development Settings. In the Vercel dashboard: 1. Go to your Project Settings > Build & Development. 2. Enable the Override toggle for Install Command. 3. Leave the Install Command field empty. This skips the install step entirely, similar to how leaving the Build Command empty skips the build step for static projects. For prebuilt deployments via CLI: - Run vercel build locally to generate .vercel/output (this may run install unless configured otherwise). - Then vercel deploy --prebuilt to upload prebuilt artifacts without re-running build/install on Vercel servers. In vercel.json, set "installCommand": null or "" (type allows null, likely skips). Note: Prebuilt deployments skip the build process on Vercel (including install), using local build output. For Git deployments with prebuilt assets already in repo (e.g., static site), empty installCommand + empty buildCommand + set Output Directory serves directly without install/build.
Citations:
- 1: https://vercel.com/docs/builds/configure-a-build
- 2: https://vercel.com/docs/project-configuration/vercel-json
- 3: https://vercel.com/docs/cli/build
- 4: https://www.vercel.com/docs/cli/deploy
Use null or empty string for installCommand instead of "true".
Vercel's documented pattern for skipping install is "installCommand": null or "installCommand": "". The current "true" works incidentally (as a shell no-op) but deviates from the recommended configuration and could become fragile if Vercel changes how it handles unrecognized commands. Update to match Vercel's API expectations.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/manual-deploy-parallel.yml around lines 88 - 92, Update
the JSON payload in the curl PATCH request that sets Vercel project settings:
replace the current "installCommand":"true" with the recommended pattern
("installCommand": null) or an empty string ("installCommand": "") in the -d
'{"buildCommand":"pnpm --filter website
build","outputDirectory":"apps/website/.next","installCommand":"true"}' payload
so the API explicitly skips install per Vercel docs; ensure the modified payload
preserves buildCommand and outputDirectory exactly as shown.
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vercel deploy --prebuilt requires a locally generated .vercel/output (from vercel build). Right now the build step is conditional (if: inputs.validate_build_website), so disabling validation will make the deploy step fail on a fresh runner because there is no prebuilt output to upload. Consider always running vercel pull + vercel build (and keep an input only for skipping extra checks, not the build itself), or switch back to non-prebuilt deploy when validation is disabled.
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With set -euo pipefail, the assignment deploy_output=$(npx vercel deploy ...) will cause the script to exit immediately on a non-zero deploy, so the retry loop will never retry. Restructure to run the deploy in the if condition (e.g., if deploy_output=$(...); then ... else ... fi) or otherwise suppress errexit for that command so failures fall through to the retry logic.
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log line is in the website deploy job but says "Admin deployment is ready"; it should reference the website deployment to avoid confusing CI logs and on-call troubleshooting.
| echo "Admin deployment is ready in production." | |
| echo "Website deployment is ready in production." |
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the deploy output parsing fails, prod_url falls back to https://elzatona-web.com, but vercel alias set expects a deployment URL/id (not an existing alias/domain). This will likely make aliasing fail or point aliases at the wrong target. Better to fail fast when no deployment URL can be extracted (or query the deployment via vercel inspect/vercel ls to retrieve the actual deployment URL) before calling set_website_aliases.
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The admin Next.js cache key is also tied to github.sha, which causes frequent cache misses/churn. Consider using a lockfile-based key (e.g., hashFiles('pnpm-lock.yaml')) with an admin prefix so the cache is reusable across commits while still invalidating when deps change.
| key: ${{ runner.os }}-next-cache-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-next-cache- | |
| key: ${{ runner.os }}-admin-next-cache-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-admin-next-cache- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admin cache key isn't scoped to "admin" — collision risk with any future ${runner.os}-next-cache-* entry.
The website job uses ${{ runner.os }}-website-next-cache-... (line 74-76), but the admin job uses the generic ${{ runner.os }}-next-cache-.... If another workflow/job ever writes under the same prefix, admin could restore a website (or other) .next/cache. Low severity today, but easy to fix and consistent with the website job.
🛠️ Proposed fix
- key: ${{ runner.os }}-next-cache-${{ github.sha }}
+ key: ${{ runner.os }}-admin-next-cache-${{ github.sha }}
restore-keys: |
- ${{ runner.os }}-next-cache-
+ ${{ runner.os }}-admin-next-cache-📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Setup Vercel and Next.js Caching | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| apps/admin/.next/cache | |
| key: ${{ runner.os }}-next-cache-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-next-cache- | |
| - name: Setup Vercel and Next.js Caching | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| apps/admin/.next/cache | |
| key: ${{ runner.os }}-admin-next-cache-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-admin-next-cache- |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/manual-deploy-parallel.yml around lines 178 - 185, The
cache key for the "Setup Vercel and Next.js Caching" step is too generic and may
collide with other jobs; update the cache key and restore-keys to include an
"admin" scope (e.g., change ${{ runner.os }}-next-cache-${{ github.sha }} and
${{ runner.os }}-next-cache- to include "admin" such as ${{ runner.os
}}-admin-next-cache-${{ github.sha }} and ${{ runner.os }}-admin-next-cache-) so
this job's cache is uniquely namespaced to admin.
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern for the admin project: setting installCommand to true via the API PATCH changes the project’s global Vercel configuration and may break preview/dashboard builds that expect installs. Consider not mutating installCommand here (or resetting it), and rely on the local vercel build + vercel deploy --prebuilt path for this workflow.
| -d '{"buildCommand":"pnpm --filter admin build","outputDirectory":"apps/admin/.next","installCommand":"true"}' \ | |
| -d '{"buildCommand":"pnpm --filter admin build","outputDirectory":"apps/admin/.next"}' \ |
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vercel deploy --prebuilt in the admin job also depends on .vercel/output from vercel build, but the build step is conditional (if: inputs.validate_build_admin). If validation is turned off, the deploy will fail on a clean runner. Consider always running vercel pull + vercel build when using --prebuilt, or falling back to a standard vercel deploy when skipping the build.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
|
|
||
| set -e | ||
|
|
||
| pnpm run check:staged | ||
| npm run check:staged | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| "private": true, | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "dev:website:test": "next dev --port 3000", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two scripts with the same name behave differently — Playwright will pick this one, which doesn't load Root
Consider aligning one of the two (either drop this app-level script and point Playwright at the root script via 🧰 Tools🪛 GitHub Actions: CI Checks (Lint, Type Check, Build)[error] format check failed: Code style issues found in 15 files. Command 'pnpm run format:check:tracked' (bash scripts/ci-quality-gate.sh format) exited with code 1. 🤖 Prompt for AI Agents |
||
| "build": "next build --webpack", | ||
| "start": "next start", | ||
| "lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Next.js cache key is based on
github.sha, which effectively creates a new cache entry every commit and reduces cache hit rates across PR updates (restore-keys helps, but you still churn caches). For better CI performance and lower cache storage churn, consider keying on the lockfile (e.g.,hashFiles('pnpm-lock.yaml')) plus an app identifier, and optionally include a Next.js/version component if needed.