-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Local CI testing with act
would help reduce PR failures
Problem
Developers experience a common issue: local tests pass but GitHub CI fails. The current Justfile only provides basic commands:
test: # Only runs cargo test + doc tests
build: # Only builds main binary
build-examples: # Builds examples
Missing CI checks that cause PR failures:
- License header validation (
./scripts/copyright.sh
) - Code formatting (
cargo +nightly fmt --check
) - Linting (
cargo clippy
) - Security audit (
cargo audit
,cargo deny
) - Spell checking (
typos
)
This creates frustrating development cycles where developers push believing code is ready, only to have CI fail on formatting or tooling issues.
Proposed Solution
Add [act](https://github.com/nektos/act)
integration to run GitHub Actions workflows locally. act
uses the exact same .github/workflows/rust.yml
file as GitHub CI, ensuring perfect parity with zero configuration drift.
Benefits
For Developers:
- Catch CI failures before pushing
- Test individual CI jobs (lint, security, etc.)
- Always matches latest workflow changes
For Maintainers:
- Fewer failing PRs
- Reduced review overhead on CI-related issues
Implementation
Add these commands to the Justfile:
# Install act tool
act-install:
curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
# Run individual CI jobs locally
act-lint:
act -W ./.github/workflows/rust.yml -j lint --rm
act-build:
act -W ./.github/workflows/rust.yml -j build --rm
act-security:
act -W ./.github/workflows/rust.yml -j security --rm
# Run all CI jobs
act-ci-all:
act -W ./.github/workflows/rust.yml --rm
Developer Workflow
Before:
$ just test # Only runs cargo test
$ git push # Push to GitHub
# CI fails - formatting, linting issues
$ git commit --fixup # Fix CI issues
After:
$ just test # Quick local tests
$ just act-lint # Run exact GitHub linting
$ git push # Push with confidence
Why act
?
act
uses the same Docker containers and workflow files as GitHub Actions, eliminating environment differences that cause local tests to pass while CI fails. It reads directly from .github/workflows/rust.yml
, ensuring the same tests run locally and on GitHub. When new CI jobs are added to the workflow, corresponding Justfile commands can be added to expose them locally.
Implementation Details
- Requires Docker (for act containers)
- Backward compatible - all existing commands unchanged
- Uses
act-
prefix to avoid conflicts - Optional adoption - developers can use incrementally
This addresses a real developer pain point while reducing maintainer overhead and improving project quality.