CI / Speed and debugging
Find out where your CI time goes
A CI run is slow, and the log does not say why: the time can go to a wait for a container, to the checkout, to the install, or to the tests. The forge keeps the time of each part of each job, so you can find the slow part and fix it.
5 min read
You can read the timing on the run page, with src, with MCP and with REST.
You need:
- Read access to the CI runs of the repository. Only admins see the timing of a hidden workflow.
1. Open the run
Open the run on the CI tab of the repository. Then select a job.
2. Read the Timing card
The Timing card is above the log. Each row is one part of the job, with a bar at its place in the job and its duration.
The header of the card gives the total time of each kind of part:
- Waits for the forge: the job waits for a container slot, for its run, or for the forge to start it.
- Forge work: the forge prepares the checkout, starts the container, checks out the commit, and collects the results.
- Steps of the workflow: the steps of your workflow file. A step that failed has a red bar.
What each part means explains each row.
3. Make the slow part faster
- If Install dependencies is the longest step, check that the job gets a warm start: put the setup and install steps first. The next jobs then start with the packages in place, and their install takes a few seconds.
- If Restore the snapshot is long, the host of the container did not have that snapshot yet. The next jobs on that host start faster.
- If a step downloads the same files in each job, keep them with
cache(). See the CI reference. - If Wait for a container slot is long, your runs start more jobs than can run at the same time. An admin can see and change the container limit of the repository with
src ci settings --containers <n>.
Done
You know which part of the job takes the time, and which change makes it faster. To measure the start of containers in more detail, see Measure how fast CI jobs start.
Read the timing from a terminal or an agent
Find the id of the run:
src ci runs --limit 5Show the timing of every job of the run, or of one job:
src ci timing <run> src ci timing <run> --job "test (shard: 1)"For a script, add
--json. The answer is the same as the answer ofGET /api/v1/repos/<owner>/<repo>/ci/runs/<run>/timingand of the MCP toolget_ci_run_timing.
The output of src ci timing looks like this:
Timing of run 7c1e2d3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f (ci)
build: success
KIND PART RESULT START TOOK
wait Wait for a container slot +0.0 s 4.1 s
forge Make the job +4.1 s 0.6 s
wait Start the job +4.7 s 0.4 s
forge Provision the container +5.1 s 0.4 s
forge Restore the snapshot (repository) +5.5 s 1.2 s
forge Make the repository +6.7 s 0.3 s
forge Download the checkout +7.0 s 3.0 s
forge Index the checkout +10.0 s 1.9 s
forge Check out the commit +11.9 s 1.2 s
forge Start the runner +13.1 s 0.8 s
step Set up Node success +13.9 s 1.1 s
step Install dependencies success +15.0 s 2.4 s
step Test success +17.4 s 98.2 s
forge Send the last logs and results +115.6 s 0.3 s
forge Collect the results +115.9 s 0.2 s
forge Remove the container +116.1 s 1.7 s
Total: wait 4.5 s, forge 11.6 s, step 101.7 s.
If a job ended with an error, a line Error: <why> comes under its name. For example, a job whose container did not start fails before its first step, and this line tells you why.
src run view <run> --json jobs also gives the start and the end of each step, as gh run view does.
What each part means
| Part | What happens |
|---|---|
| Wait for the run | The forge started the job's container when you pushed, before it planned the commit. This part is the time that the container waited for its run. Only such a job has this part. See Jobs that start before the plan. |
| Wait for a container slot | The job waits until the account and the repository have a free container slot. A long wait means that other jobs use the slots. |
| Make the job | The forge reads the plans of the run and makes the job's record. The pack of the commit that the checkout downloads usually started to build when the forge planned the commit. If it did not, it starts now, and the forge does not wait for it. |
| Start the job | The forge starts the job. |
| Provision the container | The forge makes a token for the job, and finds where its container starts from. |
| Restore the snapshot (repository) | The container starts from the snapshot of the job's setup: a warm start. A job whose container started before the plan has a short one. |
| Restore the snapshot (node base) | A node job with no snapshot of its repository starts from the base snapshot of the forge. |
, failed after a restore | The restore failed. The job then starts from its CI image, in the next part. |
| Start the image | The container starts from the CI image. A new CI image makes this longer. |
| Make the repository, Download the checkout, Index the checkout, Check out the commit | The checkout of your commit in the container. When the pack of the commit is still building, Download the checkout waits for it. The first run of a commit waits the longest. |
| Check out the extra checkouts | The other repositories that the job checks out. |
| Start the runner | The forge copies the runner into the container. The runner starts and loads your workflow file. |
| Your steps | The steps of your workflow, with their result. |
| Send the last logs and results | The runner sends the end of the log, the outputs and the summary. |
| Collect the results, Remove the container | The forge reads the results of the job and removes its container. |
| Debug window | The job ran again with debug, and its container stayed after its last step for people to run commands in it. See Debug a job in its container. |
Note
A job that ran before the forge kept the start of steps has an older timing. It shows the steps without a place in the job, and the checkout as one part.