Skip to main content

Scalable GitHub Actions Runners: Top 5 Solutions

· 3 min read
Max Kaido
Architect

I've been using GitHub Actions for a while now, and I've learned a lot about how to make them more cost-effective.

A comprehensive analysis of cost-effective solutions for short-lived GitHub Actions runners.

1. Actions Runner Controller (ARC)

Cost: 💰

  • Kubernetes cluster costs only
  • Can use spot instances for significant savings
  • Scales to zero when not in use

Features:

  • Native Kubernetes integration
  • Auto-scaling based on workflow demand
  • Supports ephemeral runners
  • Works with any cloud provider

Implementation:

# Example ARC configuration
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: example-runnerdeploy
spec:
replicas: 1
template:
spec:
repository: owner/repo
ephemeral: true
labels: ['self-hosted', 'linux', 'x64']

Pros:

  • True auto-scaling
  • Cloud-agnostic
  • Excellent security with ephemeral runners
  • Community support

Cons:

  • Requires Kubernetes knowledge
  • Initial setup complexity

2. AWS CodeBuild with GitHub Actions

Cost: 💰💰

  • Pay per build minute
  • Free tier: 100 build minutes/month
  • ~$0.005 per build minute after free tier

Features:

  • Serverless
  • Native AWS integration
  • Pre-configured build environments
  • Parallel builds

Implementation:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: my-project

Pros:

  • Zero maintenance
  • Built-in caching
  • AWS security features
  • No idle costs

Cons:

  • AWS-specific
  • Higher cost for long builds

3. Scale Set Runners (Azure)

Cost: 💰💰

  • VM costs only
  • Can use spot instances
  • Automatic scaling

Features:

  • Native Azure integration
  • Auto-scaling
  • VM-based isolation
  • Easy setup

Implementation:

name: Scale Set Runner
on:
workflow_dispatch:

jobs:
build:
runs-on: ['self-hosted', 'azure']
steps:
- uses: actions/checkout@v2

Pros:

  • Simple setup
  • Good Azure integration
  • Cost-effective with spot instances
  • Built-in auto-scaling

Cons:

  • Azure-specific
  • Minimum VM costs

4. Google Cloud Run Jobs

Cost: 💰

  • Pay per second
  • Only for actual execution time
  • Free tier available

Features:

  • Serverless
  • Container-based
  • Auto-scaling
  • Zero maintenance

Implementation:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/deploy-cloudrun@v1
with:
service: my-runner
region: us-central1

Pros:

  • True serverless
  • Very cost-effective
  • Zero maintenance
  • Fast startup

Cons:

  • GCP-specific
  • Limited customization

5. Self-managed Nomad Cluster

Cost: 💰💰💰

  • Infrastructure costs
  • More control over costs
  • Can use spot instances

Features:

  • Complete control
  • Multi-cloud support
  • Simple orchestration
  • Easy scaling

Implementation:

job "github-runner" {
datacenters = ["dc1"]
type = "batch"

group "runners" {
count = 3

task "runner" {
driver = "docker"

config {
image = "myrunner:latest"
}
}
}
}

Pros:

  • Full control
  • Cloud-agnostic
  • Simple architecture
  • Good for hybrid setups

Cons:

  • Manual maintenance
  • More complex setup

Cost Comparison (2-3 minute builds)

SolutionCost per buildMonthly (100 builds)
ARC (spot)$0.01$1.00
AWS CodeBuild$0.015$1.50
Azure Scale Set$0.02$2.00
Google Cloud Run$0.008$0.80
Nomad (spot)$0.012$1.20

Recommendation

For short builds (2-3 minutes):

  1. Best Overall: Actions Runner Controller (ARC)

    • Perfect for existing Kubernetes users
    • Most flexible and scalable
    • Cost-effective with spot instances
  2. Simplest Setup: Google Cloud Run Jobs

    • Lowest cost for short runs
    • Zero maintenance
    • Quick startup times
  3. Enterprise Choice: AWS CodeBuild

    • Great AWS integration
    • Reliable and secure
    • Good free tier

Implementation Tips

  1. Use Spot Instances where possible
  2. Set Maximum Concurrency to control costs
  3. Implement Proper Timeouts to prevent runaway builds
  4. Use Caching to reduce build times
  5. Monitor Usage and adjust resources accordingly

Security Considerations

  1. Always use ephemeral runners when possible
  2. Implement proper RBAC
  3. Use secrets management
  4. Regular security updates
  5. Network isolation

Remember: The best solution depends on your existing infrastructure, team expertise, and specific requirements. For pure cost optimization with 2-3 minute builds, Google Cloud Run or ARC with spot instances are your best bets.