Skip to content

Improve performance of core acceptance/legacy CI jobs#27293

Merged
ErisDS merged 2 commits into
TryGhost:mainfrom
acburdine:ci/acceptance-less-work
Apr 9, 2026
Merged

Improve performance of core acceptance/legacy CI jobs#27293
ErisDS merged 2 commits into
TryGhost:mainfrom
acburdine:ci/acceptance-less-work

Conversation

@acburdine
Copy link
Copy Markdown
Member

@acburdine acburdine commented Apr 9, 2026

Summary

  • remove nx cache step + unnecessary env var from setup job that hasn't done anything since the Nx v22 update
  • remove explicit TS package build step in favor of nx automatic build tracking

Why this change

As part of #27202, I was looking into ways to leverage the Nx build cache across jobs in a given CI run, since I noticed that certain packages (the frontend code in apps/* primarily) were being built multiple times throughout the various CI jobs. What I ultimately realized after a bit more investigation is that the Core Acceptance + Legacy tests jobs are building more of the repo than they need to, since the --exclude=ghost-admin doesn't actually prevent any work from being done (ghost-admin is a dependency of @tryghost/admin so it gets built anyways).

What the fix does

By updating the nx config in ghost/core to dependent on the built target for the test:ci:* scripts (and switching the jobs themselves to use yarn nx run ghost:test:ci:*), Nx will automatically build the dependencies it needs to. Overall, this should shave an average of 3-4 minutes off of all of the Acceptance/Legacy test builds.


Note

Low Risk
Low risk CI-only change, but could cause unexpected rebuilds or missing prereqs if Nx target dependencies are misconfigured, affecting test job reliability/timings.

Overview
CI pipeline is simplified to reduce unnecessary work. The setup job drops the unused NX_REJECT_UNKNOWN_LOCAL_CACHE env var and removes the GitHub Actions Nx cache step.

Acceptance and legacy test jobs now rely on Nx dependency tracking. The explicit “build TS packages” step is removed, and Ghost core test:ci:* scripts are executed via yarn nx run ghost:test:ci:*, with ghost/core/package.json updated so build:tsc, lint, test:unit, and the test:ci:* targets depend on ^build instead of a hardcoded @tryghost/parse-email-address build.

Reviewed by Cursor Bugbot for commit 130791d. Bugbot is set up for automated code reviews on this repo. Configure here.

no issue
- nx cache hasn't been used since the update to Nx 22 when the legacy file cache was removed
- removing the NX_REJECT_UNKNOWN_LOCAL_CACHE environment variable stops a warning from being printed every time nx is used
no issue
This removes the explicit TS package build step in favor of nx automatic build triggers. Because of the way this command was invoked, all of the frontend packages were being built on every CI run of acceptance/legacy tests, which adds about 3-4 minutes per job. The only package ghost/core depends on is parse-email-address, and so by leveraging Nx's automatic dependent target running, we can ensure that only the necessary packages are built. Leveraging Nx now also means that if more lecal packages with build targets are added as ghost/core deps in the future, the jobs will continue to work as designed.
@acburdine acburdine changed the title Ci/acceptance less work Improve performance of core acceptance/legacy CI jobs Apr 9, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 9, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 477d7bbb-ac94-4d28-9881-c6fc099c5137

📥 Commits

Reviewing files that changed from the base of the PR and between 24a6081 and 130791d.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • ghost/core/package.json

Walkthrough

The changes refactor CI/CD workflow and Nx task configuration. The GitHub Actions workflow was modified to remove explicit Nx cache handling and the separate "Build TS packages" steps from test jobs. Test command execution was updated to use Nx-targeted commands (e.g., yarn nx run ghost:test:ci:e2e) instead of direct yarn commands with working directory configuration. In ghost/core/package.json, task dependencies were simplified by replacing explicit project dependencies with wildcard dependencies (^build), and three new Nx targets for CI test execution (test:ci:e2e, test:ci:legacy, test:ci:integration) were introduced, each depending on upstream build tasks.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main objective: improving CI job performance by reducing unnecessary work in acceptance and legacy test jobs.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation (removing unused Nx cache and build tracking), what was changed, and the expected performance benefits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.45%. Comparing base (c92425f) to head (130791d).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #27293   +/-   ##
=======================================
  Coverage   73.45%   73.45%           
=======================================
  Files        1545     1545           
  Lines      123675   123686   +11     
  Branches    14958    14958           
=======================================
+ Hits        90846    90856   +10     
- Misses      31809    31831   +22     
+ Partials     1020      999   -21     
Flag Coverage Δ
admin-tests 54.37% <ø> (-0.02%) ⬇️
e2e-tests 73.45% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ErisDS
Copy link
Copy Markdown
Member

ErisDS commented Apr 9, 2026

@acburdine Is there any reason why we should not just merge this? Seems great to me!

@acburdine
Copy link
Copy Markdown
Member Author

@ErisDS Nope, feel free to merge!

@acburdine acburdine requested a review from 9larsons April 9, 2026 12:30
@ErisDS ErisDS merged commit e45d470 into TryGhost:main Apr 9, 2026
42 checks passed
acburdine added a commit that referenced this pull request Apr 10, 2026
no issue
This removes the explicit TS package build step in favor of nx automatic
build triggers. Because of the way this command was invoked, all of the
frontend packages were being built on every CI run of acceptance/legacy
tests, which adds about 3-4 minutes per job. The only package ghost/core
depends on is parse-email-address, and so by leveraging Nx's automatic
dependent target running, we can ensure that only the necessary packages
are built. Leveraging Nx now also means that if more lecal packages with
build targets are added as ghost/core deps in the future, the jobs will
continue to work as designed.

This is a repeat of #27293 which was partially reverted during the pnpm
cutover)
franky19 pushed a commit to franky19/Ghost that referenced this pull request Apr 18, 2026
## Summary

- remove nx cache step + unnecessary env var from setup job that hasn't
done anything since the Nx v22 update
- remove explicit TS package build step in favor of nx automatic build
tracking

## Why this change

As part of TryGhost#27202, I was looking into ways to leverage the Nx build
cache across jobs in a given CI run, since I noticed that certain
packages (the frontend code in apps/* primarily) were being built
multiple times throughout the various CI jobs. What I ultimately
realized after a bit more investigation is that the Core Acceptance +
Legacy tests jobs are building more of the repo than they need to, since
the `--exclude=ghost-admin` doesn't actually prevent any work from being
done (ghost-admin is a dependency of `@tryghost/admin` so it gets built
anyways).

## What the fix does

By updating the nx config in ghost/core to dependent on the built target
for the test:ci:* scripts (and switching the jobs themselves to use
`yarn nx run ghost:test:ci:*`), Nx will automatically build the
dependencies it needs to. Overall, this should shave an average of 3-4
minutes off of all of the Acceptance/Legacy test builds.
franky19 pushed a commit to franky19/Ghost that referenced this pull request Apr 18, 2026
no issue
This removes the explicit TS package build step in favor of nx automatic
build triggers. Because of the way this command was invoked, all of the
frontend packages were being built on every CI run of acceptance/legacy
tests, which adds about 3-4 minutes per job. The only package ghost/core
depends on is parse-email-address, and so by leveraging Nx's automatic
dependent target running, we can ensure that only the necessary packages
are built. Leveraging Nx now also means that if more lecal packages with
build targets are added as ghost/core deps in the future, the jobs will
continue to work as designed.

This is a repeat of TryGhost#27293 which was partially reverted during the pnpm
cutover)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants