Guides

Which runner should I use

Selecting the right runner for your CI/CD pipeline is crucial for balancing build times and costs. To make an informed decision, you can leverage the built-in matrix feature in GitHub Actions, which allows you to test your workflow on multiple runners simultaneously.

The matrix feature in GitHub Actions enables you to run a job with different configurations, specified as a matrix of key-value pairs. In this case, we'll use the runs-on key to compare the performance of different BuildJet runners.

To use the matrix feature, modify your GitHub Actions workflow file (main.yml or a similar file in the .github/workflows directory) as follows:

yaml
1
jobs:
2
test:
3
strategy:
4
fail-fast: true # In case one of the jobs fails, the other jobs will be cancelled
5
matrix:
6
runs-on: [ buildjet-2vcpu-ubuntu-2204, buildjet-4vcpu-ubuntu-2204, buildjet-8vcpu-ubuntu-2204, buildjet-16vcpu-ubuntu-2204 ]
7
name: Test - ${{matrix.runs-on}}
8
runs-on: ${{matrix.runs-on}}
9
steps:
10
- uses: actions/checkout@v2
11
...

This configuration will run the test job as four different jobs in parallel with varying CPU counts (2, 4, 8, and 16). You can then compare the build times and costs to determine the best runner for your specific workload.