What a GitHub Actions matrix build costs
A matrix turns one job definition into many jobs. Three operating systems times three language versions is nine jobs on every push, each billed separately and each at the rate of the runner it lands on. This page prices that matrix per run and per month with this site's calculator.
How a matrix is billed
Every combination in the matrix is its own job. GitHub rounds each job up to the nearest whole minute and bills it at the per-minute rate of its runner. There is no price for a matrix as such: the cost is the sum of its jobs. Two things follow. The macOS combinations dominate the bill, and short jobs are rounded up once per combination, not once per run.
Assumptions
- A matrix of 3 operating systems (Linux, Windows, macOS) and 3 versions: 9 jobs per run, 3 on each runner.
- Each job is billed as 5 minutes.
- Standard runners: Linux 2-core x64 at $0.006 a minute, Windows 2-core at $0.01 and macOS at $0.062.
- For the monthly figures: a private repository on GitHub Team, 10 runs per working day, 22 working days a month. Compute only; seats, storage and taxes are left out.
Cost of one run
| Runner | Jobs | Minutes | Cost per run |
|---|---|---|---|
| Linux 2-core, x64 | 3 | 15 | $0.09 |
| Windows 2-core | 3 | 15 | $0.15 |
| macOS | 3 | 15 | $0.93 |
| Total | 9 | 45 | $1.17 |
A run costs $1.17 once the plan's included minutes are used up. The three macOS jobs are a third of the minutes and about four fifths of the price. Inside the included minutes, and in a public repository, the run is not charged.
Rounding, nine times over
Suppose each matrix job only takes 20 seconds: a quick smoke test. The real work is 3 minutes per run, but each of the nine jobs is billed as a whole minute, so the run is billed as 9 minutes and costs about $0.23. A single job that ran the nine checks one after another on one runner would be billed for 3 minutes. For very short jobs, a matrix triples the billed time before the runner rates are even considered.
Cost per month
Ten runs a day is 90 jobs a day, 1,980 jobs and 9,900 minutes a month. GitHub Team includes 3,000 minutes, shared here between the runners in proportion to their minutes.
| Runner | Minutes | Included minutes used | Minutes billed | Cost per month |
|---|---|---|---|---|
| Linux 2-core, x64 | 3,300 | 1,000 | 2,300 | $13.80 |
| Windows 2-core | 3,300 | 1,000 | 2,300 | $23.00 |
| macOS | 3,300 | 1,000 | 2,300 | $142.60 |
| Total | 9,900 | 3,000 | 6,900 | $179.40 |
That is $179.40 a month, or $2,152.80 a year. Included minutes are really used in the order jobs run, so the month can fall between $71.40, if the macOS jobs used the allowance, and $239.40, if the Linux jobs did.
In the calculator, enter 90 jobs per day, 5 minutes, 22 working days and the same share for the three runners. Shares that do not add up to 100 are scaled, so 1, 1 and 1 give equal thirds.
Trimming the matrix
| Matrix | Jobs per run | Minutes per month | Minutes billed | Cost per month | Cost per year |
|---|---|---|---|---|---|
| 3 systems, 3 versions | 9 | 9,900 | 6,900 | $179.40 | $2,152.80 |
| 3 systems, 2 versions | 6 | 6,600 | 3,600 | $93.60 | $1,123.20 |
| 3 versions on Linux and Windows, 1 on macOS | 7 | 7,700 | 4,700 | $73.86 | $886.29 |
Dropping one version everywhere saves $85.80 a month. Keeping all three versions on Linux and Windows but testing a single version on macOS saves more, $105.54 a month, while running one more job per run than the two-version matrix. Which combinations you can drop is a testing decision; the table only shows what each one costs.
Other ways to cut the cost without shrinking the matrix on the main branch: run the full matrix only on pushes to the main branch and a reduced one on pull requests, and cancel runs that a newer push has superseded.
Price your own matrix. Multiply the combinations by your runs per day to get jobs per day, then enter that with the share of jobs on each runner in the free calculator.