GitHub Actions · Lesson 6 of 10 · 4 min read
Runners, caching and artifacts
Runner options
| Runner | Notes |
|---|---|
GitHub-hosted (ubuntu-latest, windows-latest, macos-latest) |
Fresh VM per job, preinstalled tools, billed per minute (free quota for public repos); arm64 Linux runners available |
| Larger runners | More CPU/RAM, static IPs, GPU options — paid |
| Self-hosted | Your machines: access to private networks, custom hardware, no per-minute cost; you patch and secure them |
| Actions Runner Controller (ARC) | Kubernetes operator that runs ephemeral, autoscaling self-hosted runners as pods on EKS (runner scale sets) |
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
Self-hosted runner security:
- Use ephemeral runners (one job, then destroyed) so a job can't leave malware or credentials for the next.
- Never attach self-hosted runners to public repositories — anyone can open a PR that runs code on them.
- Isolate by runner groups (which repos/orgs can use them), run in dedicated namespaces/accounts, give pods IRSA with minimal permissions, restrict network egress.
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
Caching
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}-
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
- Keys usually hash lockfiles;
restore-keysgive partial hits. - Caches are scoped by branch (a branch can read caches from its base/default branch), limited in size per repo (10 GB by default, least-recently-used eviction).
setup-node,setup-java,setup-pythonandsetup-gohave built-incache:options.- Docker layer caching:
docker/build-push-actionwithcache-from: type=gha/cache-to: type=gha,mode=max, or a registry cache in ECR.
Artifacts
actions/upload-artifact / download-artifact pass files between jobs and keep reports/binaries after the run (default retention 90 days, configurable). Artifacts aren't a release store — publish releases to ECR, S3, GitHub Releases or an artifact repository.
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.