Enhance Job Duration Tracking in CircleCI and GitHub Actions
When working with CI/CD tools like CircleCI and GitHub Actions, you might have noticed that the reported total duration of a pipeline isn’t always accurate depending on what you’re looking for. Typically, the duration is calculated as the difference between the start and end times of the pipeline.
This approach works well for assessing overall time efficiency. However, when jobs run in parallel, only the longest job duration is considered in the total pipeline duration. This means that if you’re interested in understanding the total time billed or the actual workload on your self hosted runners, you’re missing crucial information.
To address this, I’ve created 2 tiny custom userscripts that sum the durations of all jobs in CircleCI and GitHub Actions, providing a more comprehensive view of your pipeline’s performance.
TL;DR
If you just want to access those userscripts, they are hosted on gist
2025–01–25 — Update CircleCI version to 1.1
What's a userscript and what's violentmonkey ?
Userscripts are small programs, typically written in JavaScript, designed to modify the behavior and appearance of web pages in a user’s browser. They allow users to customize and enhance their browsing experience on specific web pages by adding new features, changing layouts, automating repetitive tasks or integrating additional information.
To manage and run these scripts, you need a userscript manager, which comes as a browser extension. Popular userscript managers include Tampermonkey and Violentmonkey. These tools provide a user-friendly interface for managing scripts, allowing users to install, edit, and delete scripts as needed.
Violentmonkey is an open-source userscript manager that supports browsers with WebExtensions support, such as Chrome, Firefox, and Opera. Unlike Tampermonkey, Violentmonkey does not require enabling developer mode, making it easier to use. It includes features like automatic updates for installed scripts and a built-in editor for customizing scripts directly within the extension. This makes Violentmonkey a versatile choice for users looking to enhance their web experience by tailoring it to their needs.
Together, userscripts and Violentmonkey empower users to tailor their web browsing experience, making it more efficient and personalized.
Here are CircleCI and Github Actions sum durations
Once installed, these userscripts will add a new section titled "Sum Durations" to the CircleCI and GitHub Actions interfaces. In this section, the scripts will display the total duration of all jobs in the pipeline. Additionally, each job duration used in the calculation will be highlighted in bold. This visual cue makes it easy to validate that no job durations are overlooked.
How to install them ?
Start by installing ViolentMonkey extension for your browser. These scripts should work with other userscript managers as well, although they have not been specifically tested with them. https://chromewebstore.google.com/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag
Now click on one of those 2 links
After clicking on the link, you will be directed to a page where you can install the userscript. Follow the prompts to complete the installation. Once installed, navigate to your favorite tool and you should see the additional section and the Violentmonkey icon in your browser toolbar with a notification indicating that a script is active on the page.
Important Note: the userscripts may sometimes not update the content on the page. If you don’t see the expected sum, try refreshing the page to ensure the scripts run correctly.