The act is a command line tool that allows to run GitHub Actions in local environment. It reads
.github/workflows and determines the set of actions that need to be run. The act is based on Docker.
This tutorial shows how to install act on Ubuntu 20.04.
You must have Git and Docker installed in the system:
Run the following command to download
tar.gz. file from releases page of the
wget -qO act.tar.gz https://github.com/nektos/act/releases/latest/download/act_Linux_x86_64.tar.gz
act executable file to
sudo tar xf act.tar.gz -C /usr/local/bin act
act command can be used all users as system-wide command.
We can check
act version as follows:
rm -rf act.tar.gz
Clone the sample repository for testing:
git clone https://github.com/cplee/github-actions-demo.git
act command and specify working directory with
-C option to run GitHub Actions locally:
act -C github-actions-demo
For the first time, you will be asked to choose image to be used as default. You can select Medium size image. It can be changed later in
~/.actrc configuration file.
act run jobs defined in YAML file which stored in
[CI/test] Start image=ghcr.io/catthehacker/ubuntu:act-latest ...... [CI/test] * Run actions/checkout@v2 [CI/test] Success - actions/checkout@v2 [CI/test] * Run actions/setup-node@v1 ...... [CI/test] Success - actions/setup-node@v1 [CI/test] * Run npm install ...... [CI/test] Success - npm install [CI/test] * Run npm test ...... | GET / | ✓ should respond with hello world | | | 1 passing (28ms) | [CI/test] Success - npm test
act is no longer needed, remove the executable file:
sudo rm -rf /usr/local/bin/act
You can also remove configuration file and cache:
rm -rf ~/.actrc rm -rf ~/.cache/act