We use cookies to understand how the site is used and to display ads. Analytics and advertising only run after you accept. You can change your choice anytime. Privacy policy

Skip to content
devvkit
$devvkit learn --librarie act-&-just-guide

Act & Just Guide

[task-runner][ci][automation][cli]
Automation & CI/CD
Install
# Act:
brew install act
# or: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash

# Just:
brew install just
# or: cargo install just
# Windows: winget install --id=Casey.Just

Act runs your GitHub Actions workflows locally. Before pushing, run `act` to test that your CI pipeline works: no waiting for GitHub runners. It uses Docker containers to simulate the GitHub Actions environment, supports secrets via `.secrets` file, and matrix strategies.

Just is a command runner (like `make` but simpler). Define commands in a `justfile` with dependencies, arguments, and cross-platform compatibility. `just build`, `just test`, `just deploy`: each runs the shell commands you define. No Makefile weirdness.

Act: use `act -j build` to run a specific job, `act --list` to see all jobs, `act -W .github/workflows/deploy.yml` for non-default workflow files. Just: use `just --list` to see available recipes, `just --dry-run` to preview commands, `just variable=value recipe` to override parameters.

Act Basics

Act: run all jobs· Run full CI locally.
act                          # Default: push event
act pull_request              # Simulate PR event
act --job lint                # Run specific job only
act --list                    # List all jobs
act -W .github/workflows/test.yml  # Specific workflow file

Act Options

Act: with secrets· Pass secrets to workflow.
# .secrets file:
DOCKER_USERNAME=myuser
DOCKER_PASSWORD=mypass

act --secret-file .secrets

# Or inline:
act -s MY_SECRET=value

# Skip local checks for large secrets:
echo "DOCKER_PASSWORD" >> .actignore
Act: matrix strategy· Test multiple versions.
# Act runs matrix strategies by default.
# To limit:
act --matrix node-version:18          # Only node 18
act --matrix os:ubuntu-latest    # Only Ubuntu

# With custom GitHub token (higher rate limits):
act -G token  # or GITHUB_TOKEN env var
Act: use Docker image· Custom runner image.
act -P ubuntu-latest=catthehacker/ubuntu:full-latest
act -P ubuntu-latest=node:20-bookworm-slim

# List available images:
act --list-images

# Clean cached images:
docker system prune -a  # Act caches images locally

Just Basics

Just: hello world· Simple justfile.
# justfile
build:
    npm run build

test:
    npm test

lint:
    npx eslint src/

deploy: build test
    echo "Ready to deploy"

# Run:
# just build
# just test
# just deploy  # runs build → test → deploy
Just: dry run· Preview commands.
just --dry-run deploy           # Show commands without running
just --highlight                # Colorize justfile
just --list                     # List all recipes
just --summary                  # List with descriptions
just --evaluate                 # Print evaluated variables
just --init                     # Create minimal justfile

Justfiles

Just: with arguments· Parameterized recipes.
# justfile
node_image := "node:20"
port := "3000"

build arch:
    docker build --platform linux/{{arch}} -t myapp .

serve name="default":
    docker run -p {{port}}:3000 --name {{name}} myapp

clean *targets:
    for target in {{targets}}; do
        rm -rf ./dist/$target
    done

# Run:
# just build amd64
# just serve my-container
# just clean app1 app2 app3
Just: cross-platform· Windows/macOS/Linux.
# justfile
alias b := build

[no-cd]
build:
    npm run build

[no-exit-message]
clean:
    rm -rf dist/

[windows]
clean:
    if exist dist rmdir /s /q dist

# Commands run with cmd.exe on Windows, sh on macOS/Linux
# Just handles OS-specific recipes
Just: dotenv· Load environment files.
# justfile
dotenv: .env.local

set positional-arguments := true

serve:
    echo $DATABASE_URL
    npm run dev

# .env.local:
# DATABASE_URL=postgres://localhost:5432/dev

# Check env:
just --dotenv-filename .env.production serve