App-GHGen

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


## Rust

Rust workflows with cargo, clippy, and formatting.

**Features:**

- Cargo registry and target caching
- cargo fmt formatting check
- Clippy linting with -D warnings
- Comprehensive test suite
- Optional release builds
- Cargo.lock hash-based cache

## Go

Go testing with modules and race detection.

**Features:**

- Configurable Go version
- Go modules caching (~/go/pkg/mod)
- go vet for static analysis
- Race detector (-race flag)
- Test coverage with atomic mode
- go.sum hash-based cache

## Ruby

Ruby testing with Bundler integration.

**Features:**

- Multiple Ruby versions (3.1, 3.2, 3.3)
- Automatic Bundler caching (built into setup-ruby)
- Gemfile.lock hash-based cache
- Rake integration

## Docker

Docker image building and publishing.

**Features:**

- Docker Buildx for multi-platform builds
- GitHub Container Registry (GHCR) support
- Docker Hub support
- Automatic tag extraction from git
- Layer caching with GitHub Actions cache
- Only pushes on non-PR events

## Static Sites

Static site deployment to GitHub Pages.

**Features:**

- GitHub Pages deployment
- Configurable build command
- Configurable build directory
- Artifact upload
- Proper Pages permissions
- Separate build and deploy jobs

# CONFIGURATION DETECTION

GHGen automatically detects configuration and adjusts workflows accordingly.

## Minimum Version Detection

For Perl, minimum version is detected from:

- cpanfile: `requires 'perl', '5.036'`
- Makefile.PL: `MIN_PERL_VERSION => '5.036'`
- dist.ini: `perl = 5.036`

Only compatible Perl versions are tested (e.g., if min is 5.36, won't test 5.32 or 5.34).

## Dependency Files

Caching is based on dependency files:

- Perl: cpanfile, dist.ini, Makefile.PL, Build.PL
- Node: package-lock.json, yarn.lock, pnpm-lock.yaml
- Python: requirements.txt, Pipfile.lock
- Rust: Cargo.lock
- Go: go.sum
- Ruby: Gemfile.lock

# BEST PRACTICES

## Workflow Generation

- **Use --auto for quick start** - Let GHGen detect your project
- **Use --customize for fine control** - Customize versions, OS, and features
- **Review before committing** - Always review generated workflows
- **Test locally first** - Use tools like `act` to test locally
- **Start with defaults** - Customize only when needed

## Workflow Analysis

- **Run analyze regularly** - Weekly `ghgen analyze` catches issues early
- **Use --estimate** - Monitor CI costs over time
- **Enable in CI** - Catch issues in PRs automatically
- **Review auto-fixes** - Always review changes before committing
- **Fix incrementally** - Don't fix everything at once if unsure

## Cost Optimization

- **Add caching** - Biggest time/cost savings
- **Add concurrency** - Cancel superseded runs
- **Filter triggers** - Only run on relevant changes
- **Optimize matrix** - Don't test unnecessary combinations
- **Run coverage once** - Only on one OS/version combination

# EXAMPLES

## Example 1: New Perl Module

    # In your new Perl module directory
    cd My-Module/



( run in 1.321 second using v1.01-cache-2.11-cpan-b16cb0d3907 )