Skip to content

Developer Guide

This guide walks through environment setup, repository structure, and local testing using nektos/act so you can confidently extend d-flows workflows and actions.

πŸ“‹ Prerequisites

Ensure the following tooling is installed and accessible from your terminal:

  • Docker Desktop (or Docker Engine) β€” required for act containers. Verify with docker --version.
  • PowerShell 7+ β€” cross-platform scripting runtime. Verify with pwsh --version.
  • Git β€” source control. Verify with git --version.
  • nektos/act β€” local GitHub Actions runner. Verify with act --version.
  • Package Manager β€” WinGet on Windows (winget --version) or a Linux/macOS equivalent to install dependencies.

Docker performance

Allocate at least 4 CPU cores and 6 GB RAM in Docker Desktop to match GitHub-hosted runner resources when executing integration tests.

πŸš€ Quick Start

  1. Clone the repository
    git clone https://github.com/nntin/d-flows.git
    cd d-flows
    
  2. Install act (see ACT Setup Guide for OS-specific instructions)
  3. Copy local secrets template
    cp .secrets.template .secrets
    
  4. Verify development prerequisites
    pwsh -File scripts/dev/Verify-Setup.ps1
    
  5. Run the full integration suite
    pwsh -File scripts/integration/Run-ActTests.ps1 -RunAll
    

πŸ“ Project Structure

  • .github/workflows/ β€” workflow definitions (deployment, release, validation, docs)
  • actions/ β€” composite actions used by workflows
  • docs/ β€” MkDocs content (this guide + ACT documentation)
  • scripts/ β€” PowerShell automation
  • scripts/integration/ β€” orchestrates act test matrices
  • scripts/dev/ β€” helper utilities for contributors
  • tests/ β€” JSON fixtures & assets for each workflow
  • tests/integration/ β€” complex multi-workflow scenarios
  • tests/<workflow>/ β€” targeted fixtures for unit-level validation
  • .actrc β€” shared configuration for act runner images and arguments
  • .secrets.template β€” copy to .secrets for local secret injection

πŸ§ͺ Local Testing with Act

nektos/act mirrors GitHub-hosted runners locally using Docker containers.

  • Follow ACT_SETUP_GUIDE.md for installation and Docker tuning.
  • Use ACT_USAGE.md for scenario-based walkthroughs and troubleshooting tips.
  • Common commands:
    act --list
    act workflow_dispatch -W .github/workflows/step-summary.yml -e tests/step-summary/minimal.json
    pwsh -File scripts/integration/Run-ActTests.ps1 -RunAll
    

Speed up repeated runs

Pass --reuse to act or -SkipCleanup to Run-ActTests.ps1 when iterating on failures to avoid re-provisioning containers.

πŸ”§ Development Workflow

  1. Implement workflow or action changes
  2. Lint YAML with actionlint
    bash <(curl -s https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
    ./actionlint
    
  3. Execute targeted jobs locally
    act workflow_dispatch --job <job-id> -W .github/workflows/<file>.yml
    
  4. Run integration harness
    pwsh -File scripts/integration/Run-ActTests.ps1 -TestName "<test-name>"
    
  5. Commit, push, and open a PR including relevant test evidence in the description

πŸ§ͺ Testing Framework

  • Unit-level fixtures β€” JSON payloads under tests/<workflow>/ emulate GitHub webhook events
  • Integration scenarios β€” tests/integration/ pairs PowerShell orchestration with persistent artifacts
  • State isolation β€” PowerShell scripts create GUID-based temp directories; pass -SkipCleanup for debugging
  • Harness scripts β€” Run-ActTests.ps1 bundles preparation, execution, log capture, and cleanup
  • Artifacts β€” Logs, traces, and snapshots stored under tests/_artifacts for later inspection

Refer to the β€œTest State Management” section of README.md for lifecycle details.

βš™οΈ Configuration

  • .actrc β€” defines default runner images, container options, and artifact paths for act
  • .secrets β€” injects secrets into local runs; copy from .secrets.template and keep it untracked
  • mkdocs.yml β€” docs navigation, theme, and versioning (Mike integration)

Example tweaks:

# Switch act to large runner image
echo '-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest' >> .actrc

# Add a temporary PAT for integration tests
echo 'GH_TOKEN=<token>' >> .secrets

πŸ”§ Troubleshooting

  • Docker not running β€” ensure Desktop/Engine is up and restart containers
  • act missing β€” confirm binary is in PATH (act --version)
  • Permission denied β€” run your shell as Administrator (Windows) or ensure user is in the docker group
  • Failed tests β€” rerun with -SkipCleanup to preserve reproducer artifacts
  • Workflow syntax errors β€” execute ./actionlint to surface lint feedback locally

For expanded act troubleshooting, see ACT_SETUP_GUIDE.md.

πŸ”— Additional Resources