Top Related Projects
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
The Runner for GitHub Actions :rocket:
The GitHub ToolKit for developing GitHub Actions.
GitHub Actions runner images
Quick Overview
nektos/act is a tool that allows you to run GitHub Actions locally. It provides a way to test and debug your GitHub Actions workflows without pushing changes to a remote repository, making the development process faster and more efficient.
Pros
- Enables local testing of GitHub Actions workflows
- Speeds up the development and debugging process
- Supports most GitHub Actions features and syntax
- Reduces the need for frequent commits to test workflow changes
Cons
- May not perfectly replicate the GitHub Actions environment
- Some actions or features might not work identically to GitHub's implementation
- Requires Docker to be installed and running on the local machine
- Limited support for certain complex workflows or organization-level features
Getting Started
To get started with nektos/act, follow these steps:
-
Install act using one of the following methods:
- macOS:
brew install act
- Windows:
choco install act-cli
- Linux: Download the latest release from GitHub
- macOS:
-
Navigate to your repository containing a
.github/workflows
directory. -
Run act:
act
-
To run a specific job:
act -j job_name
-
To list all available actions without running them:
act -l
For more advanced usage and configuration options, refer to the project's documentation on GitHub.
Competitor Comparisons
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
Pros of setup-php
- Specifically designed for PHP environments, offering extensive PHP version and extension support
- Integrates seamlessly with GitHub Actions workflows
- Provides caching mechanisms for improved performance
Cons of setup-php
- Limited to PHP-specific setups, lacking versatility for other languages or environments
- Requires GitHub Actions infrastructure, not suitable for local testing
Code Comparison
setup-php:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, xml
coverage: xdebug
act:
- run: |
docker run --rm -v $PWD:/app -w /app php:8.1 \
bash -c "apt-get update && apt-get install -y libxml2-dev \
&& docker-php-ext-install mbstring xml"
Key Differences
- setup-php is tailored for PHP environments in GitHub Actions
- act allows for local testing of GitHub Actions workflows
- setup-php offers more streamlined configuration for PHP-specific setups
- act provides flexibility to test various actions and environments locally
Use Cases
setup-php is ideal for:
- PHP projects using GitHub Actions
- Teams requiring specific PHP versions and extensions
act is suitable for:
- Local testing of GitHub Actions workflows
- Developers working with multiple languages and environments
The Runner for GitHub Actions :rocket:
Pros of runner
- Official GitHub Actions runner, ensuring full compatibility and support
- Supports all GitHub Actions features and integrations out-of-the-box
- Designed for production use in various environments (self-hosted, cloud, etc.)
Cons of runner
- Requires more setup and configuration compared to act
- Heavier resource usage, as it's a full-fledged runner implementation
Code comparison
act:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm test
runner:
jobs:
test:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- run: npm test
Key differences
- act simulates the GitHub Actions environment locally, while runner is the actual runtime used in GitHub's infrastructure
- act is primarily for local testing and development, whereas runner is for production deployments
- act has a simpler setup process but may not fully replicate all GitHub Actions features
- runner provides a more accurate representation of the GitHub Actions environment but requires more resources and configuration
Use cases
- Use act for quick local testing and development of GitHub Actions workflows
- Use runner for setting up self-hosted runners or when full GitHub Actions compatibility is required in production environments
The GitHub ToolKit for developing GitHub Actions.
Pros of Toolkit
- Provides official, well-maintained libraries for developing GitHub Actions
- Offers a comprehensive set of tools and utilities for common Actions tasks
- Integrates seamlessly with GitHub's ecosystem and best practices
Cons of Toolkit
- Requires more setup and coding knowledge to create custom Actions
- Limited to GitHub Actions platform, less flexible for local development
Code Comparison
Toolkit example:
const core = require('@actions/core');
const github = require('@actions/github');
try {
const nameToGreet = core.getInput('who-to-greet');
console.log(`Hello ${nameToGreet}!`);
} catch (error) {
core.setFailed(error.message);
}
Act example:
- name: Run custom script
run: |
echo "Hello, World!"
./my-custom-script.sh
Summary
Toolkit is ideal for developers creating custom GitHub Actions, offering robust tools and integration. Act, on the other hand, focuses on local testing and simulation of GitHub Actions workflows, providing a simpler setup for running existing actions locally. While Toolkit requires more coding expertise, Act offers a more straightforward approach to testing workflows without deep GitHub Actions development knowledge.
GitHub Actions runner images
Pros of runner-images
- Provides official, pre-built images used in GitHub-hosted runners
- Offers a wide range of software and tools pre-installed
- Ensures compatibility with GitHub Actions workflows
Cons of runner-images
- Large image size, requiring significant storage and download time
- Less flexibility for customization compared to local environments
- May include unnecessary tools for specific workflows
Code comparison
runner-images:
runs-on: ubuntu-latest
act:
- uses: nektos/act@v1
with:
runner: ubuntu-latest
Key differences
act:
- Allows running GitHub Actions locally
- Lightweight and faster to set up
- Provides more control over the execution environment
runner-images:
- Ensures exact replication of GitHub-hosted runners
- Supports a broader range of pre-installed software
- Maintained and updated by GitHub
Use cases
act is ideal for:
- Local development and testing of workflows
- CI/CD pipelines in resource-constrained environments
- Quick iterations and debugging
runner-images is better for:
- Production-grade GitHub Actions workflows
- Scenarios requiring specific software versions
- Ensuring consistency between local and GitHub-hosted runners
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Overview
"Think globally,
act
locally"
Run your GitHub Actions locally! Why would you want to do this? Two reasons:
- Fast Feedback - Rather than having to commit/push every time you want to test out the changes you are making to your
.github/workflows/
files (or for any changes to embedded GitHub actions), you can useact
to run the actions locally. The environment variables and filesystem are all configured to match what GitHub provides. - Local Task Runner - I love make. However, I also hate repeating myself. With
act
, you can use the GitHub Actions defined in your.github/workflows/
to replace yourMakefile
!
How Does It Work?
When you run act
it reads in your GitHub Actions from .github/workflows/
and determines the set of actions that need to be run. It uses the Docker API to either pull or build the necessary images, as defined in your workflow files and finally determines the execution path based on the dependencies that were defined. Once it has the execution path, it then uses the Docker API to run containers for each action based on the images prepared earlier. The environment variables and filesystem are all configured to match what GitHub provides.
Let's see it in action with a sample repo!
Act User Guide
Please look at the act user guide for more documentation.
Support
Need help? Ask on Gitter!
Contributing
Want to contribute to act? Awesome! Check out the contributing guidelines to get involved.
Manually building from source
- Install Go tools 1.20+ - (https://golang.org/doc/install)
- Clone this repo
git clone git@github.com:nektos/act.git
- Run unit tests with
make test
- Build and install:
make install
Top Related Projects
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
The Runner for GitHub Actions :rocket:
The GitHub ToolKit for developing GitHub Actions.
GitHub Actions runner images
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot