1.3 KiB
1.3 KiB
Running GitHub Actions locally with Act
This repo is configured to run the main CI workflow locally using Docker + Act.
Prerequisites
- Docker running
- GitHub CLI:
gh auth login - Act extension:
gh extension install nektos/gh-act(alternatively installactbinary)
Quick start
- List workflows/jobs:
gh act -l - Run all push jobs (reuses containers):
make ci-local - Run a specific workflow file:
make ci-workflow WORKFLOWS=.github/workflows/ci.yml - Run a single job:
make ci-job J=build-and-test
Configuration
.actrcmapsubuntu-latest/ubuntu-22.04to an Act-compatible image:ghcr.io/catthehacker/ubuntu:act-22.04
- Cache directory for
actions/cacheis.act/cache. The Makefile setsACT_CACHE_DIRaccordingly. - Secrets for local runs can be provided with
-sflags, or via a.secretsfile (never commit secrets).
Tips
- Speed up runs:
--reusekeeps containers around between runs. - Narrow matrix:
gh act push -j <job> --matrix 'compiler=gcc,build_type=Debug'. - Simulate payload:
gh act push -e ./event.json. - Use smaller images: append
:smallto the mapped image in.actrcif pulls are slow.
Limitations
- macOS/Windows runners are not available locally.
- Some marketplace actions may behave differently than GitHub-hosted runners.