How to Measure the Energy and Carbon of a CI Run
You cannot reduce what you do not measure; Eco-CI estimates the energy a job draws on the runner.
Tools like Eco-CI (from the Green Metrics Tool project) estimate a job's energy use from CPU utilization and combine it with grid intensity to approximate carbon. Adding it to a pipeline turns a vague goal into a number you can track per run.
Steps
- Add the Eco-CI initialize step at the start of the job.
- Add measurement steps around the work you want to attribute.
- Emit a final estimate to the job summary and trend it over time.
Workflow
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: green-coding-solutions/eco-ci-energy-estimation@v4
with:
task: start-measurement
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: green-coding-solutions/eco-ci-energy-estimation@v4
with:
task: display-resultsTradeoffs
- The number is an estimate from CPU model and utilization, not a wattmeter reading.
- Its value is relative: compare runs of the same pipeline to see if a change helped.