Benefits of Self-Hosted Runners
Faster Builds
Cache images and artifacts for significantly faster build times
Resource Control
Control hardware specs and optimize for your workload
Cost Efficiency
Reduce GitHub Actions minutes usage for large projects
Runner Registration Scope
GitHub runners can be registered at two levels:- Organization level - Accessible to all repositories in the organization
- Repository level - Dedicated to a single repository
Registration URLs
- Organization
- Repository
Navigate to:
Setup Methods
You can set up self-hosted runners using two approaches:Azure VM Template
Quick automated setup using Microsoft’s template
Manual Setup
Full control over runner configuration and dependencies
Method 1: Azure VM Template
The fastest way to create self-hosted runners is using the Azure VM template.Access Template
Navigate to https://aka.ms/getbuildagent in a new tab.
Configure VM Settings
Enter the following information:
- Resource Group name - Azure resource group for the VM
- Region - Azure region for deployment
- VM Name - Name for your virtual machine
- Admin Password - Administrator password for VM access
- Number of agents - How many runners to create on the VM
Configure Runner Settings
From the GitHub “Create Self-Hosted Runner” page, copy:
- Token - Registration token from GitHub
- Organization URL - Your GitHub organization URL
- Agent URL - GitHub Actions runner download URL
- Labels - Set to
self-hosted
The Azure template automatically installs all required dependencies including Docker, PowerShell, Git, and development tools.
Method 2: Manual Setup
For more control over the runner environment, you can set up runners manually.Choose Configuration
On the GitHub runner registration page, select:
- Runner Image: Windows
- Architecture: x64
Follow Installation Steps
Follow the provided instructions to download and configure the runner on your machine.
Required Dependencies
- Docker
- PowerShell Tools
- Development Tools
- NuGet
Install Docker Engine using this script.
Complete Software List
| Software | Purpose | Installation Method |
|---|---|---|
| Docker Engine | Container runtime | PowerShell script |
| Azure PowerShell Module | Azure integration | Install-Module az -force |
| Git | Version control | choco install git --force --params "/NoAutoCrlf" |
| 7-Zip | Archive extraction | choco install 7zip |
| GitHub CLI | GitHub operations | choco install gh |
| PowerShell 7.4.1+ | Scripting runtime | choco install pwsh -y |
| Visual C++ Redistributable | Runtime libraries | choco install vcredist140 -y |
| .NET Runtime | Application runtime | choco install dotnet -y |
| .NET SDK | Development SDK | choco install dotnet-sdk -y |
If the Deploy Reference Documentation job fails with errors, verify your Git installation configuration. See this issue for details.
Configure Repository Access
Once your runners are set up, configure your repository to use them.Configure Runner Group
On the GitHub runners list, select the Default runner group and allow public repositories if your repository is public.
Update AL-Go Settings
Edit your repository settings file at
.github/AL-Go-Settings.json and set the gitHubRunner property:You can use additional tags like
"self-hosted, Windows" to target specific runner types if you have multiple self-hosted runners with different operating systems.Understanding Runner Settings
AL-Go provides two settings to control runner selection:gitHubRunner vs. runs-on
- gitHubRunner
- runs-on
Used for: Build and test jobs requiring:
- High memory and CPU
- Docker container support
- Longer execution times
Build jobs benefit most from self-hosted runners due to caching capabilities.
Performance Optimization
Runner Capacity Planning
Based on real-world testing:Over-allocation Risk
Running 5+ concurrent builds on a single VM causes:
- 50% slower individual build times
- High CPU contention
- Memory pressure
Optimal Configuration
Running 4 concurrent builds provides:
- Similar performance to single build
- Good resource utilization
- Minimal queuing
Performance Tips
Disable Real-Time Protection
Turning off Windows Defender real-time protection on self-hosted runners can improve build performance by approximately 25%.
Right-Size Runner Count
Monitor CPU and memory usage to determine optimal runner count:
- Start with 4 runners per VM
- Monitor performance during concurrent builds
- Adjust based on actual workload
Performance Metrics
Typical improvements with self-hosted runners:| Metric | GitHub-Hosted | Self-Hosted (First Run) | Self-Hosted (Cached) |
|---|---|---|---|
| Build Time | Baseline | Similar to baseline | 50-70% faster |
| Image Download | Every run | First run only | Cached |
| Artifact Access | Remote | Remote | Local cache available |
Monitoring Runners
Track runner performance and activity:View Active Jobs
Click on a runner in GitHub settings to see:
- Current job being executed
- Job duration
- Workflow name and run ID
Monitor Queue
Check for queued workflows when all runners are busy:
- Workflows will wait for available runners
- Consider adding more runners if queuing is frequent
Runners show as “Idle” when not executing jobs and “Active” when running workflows. A green status indicator confirms the runner is online and available.
Troubleshooting
Common Issues
Runners not picking up jobs
Runners not picking up jobs
Verify:
- Runner is online and shows “Idle” status
- Repository has access to the runner group
gitHubRunnersetting matches runner labels- Runner has sufficient disk space
Slow build performance
Slow build performance
Check:
- Number of concurrent builds vs. runner capacity
- CPU and memory usage during builds
- Antivirus real-time scanning
- Disk I/O performance
Runner offline/disconnected
Runner offline/disconnected
Investigate:
- Runner service status on the VM
- Network connectivity to GitHub
- VM resource availability
- Registration token expiration
Security Considerations
Next Steps
Azure KeyVault Integration
Secure secrets using Azure KeyVault
Enable Telemetry
Monitor runner and workflow performance