Skip to main content
Most CI jobs fall into a few kinds, and each kind has a setup that works well with Dynamic CI. For each kind, this page gives the pull request schedule, the Run Before Queue setting, and whether the job should be a required status check, in GitHub or in Trunk Merge Queue. Dynamic CI decides every job unless a section below says to leave it out. In the merge queue, every kind keeps the default schedule, Always run.

Unit tests

  • Schedule: Automatic. Dynamic CI skips unit tests aggressively once they have passed on the pull request, and runs them again when a change touches code they have failed on.
  • Run Before Queue: On any commit. It usually dovetails nicely: the suite has passed once on the pull request before it enters the queue.
  • Required check: Yes.

Integration and end-to-end tests

  • Schedule: Automatic. Dynamic CI skips these more cautiously than unit tests.
  • Run Before Queue: Off. These suites are slow, and Run Before Queue would hold the pull request longer before the merge queue tests it. The merge queue runs them.
  • Required check: Yes.

Lint, format and typecheck

  • Schedule: Automatic, where Dynamic CI skips them aggressively, or Always skip, depending on the check.
  • Run Before Queue: On the head commit, so the commit that enters the queue is checked.
  • Required check: Yes.

Freshness checks

Checks whose result depends on the exact commit that enters the queue, such as generated files being up to date, a lockfile in sync, or migrations in order.
  • Schedule: Always skip, or Automatic.
  • Run Before Queue: On the head commit.
  • Required check: Yes.

Builds other jobs need

A build whose output other jobs use, such as a compile step or an image that later test jobs needs:.
  • Schedule: Always run, or leave the job out of Dynamic CI.
  • Run Before Queue: Off.
  • Required check: Not needed when the jobs that use it are required.

Deploys, previews and publishing

Jobs with side effects, such as deploy previews, pushing images or artifacts, and release steps.
  • Schedule: Always run, or leave the job out of Dynamic CI.
  • Run Before Queue: Off.
  • Required check: Usually not.

Matrix suites

A job that runs one variation per OS, version or shard.
  • Schedule: as for its kind of test, decided by variation, so Dynamic CI can skip some variations and run others.
  • Run Before Queue: as for its kind of test.
  • Required check: Require a fan-in job, not each variation. A skipped variation reports no status.

Fan-in checks

A job that collects other jobs’ results into one required check.
  • Schedule: Always run, or leave the job out of Dynamic CI. It must always run, so that it reports a status.
  • Run Before Queue: Off.
  • Required check: Yes. This is the check to require.

Flaky jobs

Jobs that fail often for reasons unrelated to the change.
  • Schedule: Automatic. Their skip rate is usually lower anyway, because they pass less often.
  • Run Before Queue: On any commit.
  • Required check: Yes, as for any other test.
Nothing else needs to change on your side.

New jobs

A new job runs on every push until Dynamic CI has enough history to decide it. To try Dynamic CI on a job you add while the repository is already Enforced, list the job’s output in the Dynamic CI job, but leave the job’s if: unchanged. Dynamic CI then records a verdict for it, as in Learning mode, and the job keeps running every time. Add the != 'false' check once its verdicts look right. To keep a job out of Dynamic CI, as for some of the kinds above, don’t add the check: on GitHub Actions, leave its output out of the Dynamic CI job; on Buildkite, list the step’s key in the plugin’s exclude-keys.

Tuning

Trunk tunes skip rate and false skips for you. Reach out on Slack with specific requests or questions.