A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python
Project description
WorkflowForge 🔨
📊 Project Status
A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python.
✨ Features
- Intuitive API: Fluent and easy-to-use syntax
- Type Validation: Built on Pydantic for automatic validation
- IDE Support: Full autocompletion with type hints
- Type Safety: Complete mypy compliance with strict type checking
- Multi-Platform: GitHub Actions, Jenkins, AWS CodeBuild
- AI Documentation: Optional AI-powered README generation with Ollama
- Pipeline Visualization: Automatic diagram generation with Graphviz
- Secrets Support: Secure credential handling across all platforms
- Templates: Pre-built workflows for common use cases
- Validation: Schema validation and best practices checking
🚀 Installation
pip install workflowforge
📚 Examples
Check out the examples/ directory for complete working examples:
# Or run individual examples
python examples/github_actions/basic_ci.py
python examples/jenkins/maven_build.py
python examples/codebuild/node_app.py
This will generate actual pipeline files and diagrams using the new import structure.
🤖 AI Documentation (Optional)
WorkflowForge can automatically generate comprehensive README documentation for your workflows using Ollama (free local AI):
# Install Ollama (one-time setup)
curl -fsSL https://ollama.com/install.sh | sh
ollama serve
ollama pull llama3.2
# Generate workflow with AI documentation and diagram
workflow.save(".github/workflows/ci.yml", generate_readme=True, use_ai=True, generate_diagram=True)
# Creates: ci.yml + ci_README.md + CI_Pipeline_workflow.png
# Or generate README separately
readme = workflow.generate_readme(use_ai=True, ai_model="llama3.2")
print(readme)
Features:
- ✅ Completely free - no API keys or cloud services
- ✅ Works offline - local AI processing
- ✅ Optional - gracefully falls back to templates if Ollama not available
- ✅ Comprehensive - explains purpose, triggers, jobs, secrets, setup instructions
- ✅ All platforms - GitHub Actions, Jenkins, AWS CodeBuild
📊 Pipeline Visualization (Automatic)
WorkflowForge automatically generates visual diagrams of your pipelines using Graphviz:
# Install Graphviz (one-time setup)
brew install graphviz # macOS
sudo apt-get install graphviz # Ubuntu
choco install graphviz # Windows
# Generate workflow with automatic diagram
workflow.save(".github/workflows/ci.yml", generate_diagram=True)
# Creates: ci.yml + CI_Pipeline_workflow.png
# Generate diagram separately
diagram_path = workflow.generate_diagram("png")
print(f"📊 Diagram saved: {diagram_path}")
# Multiple formats supported
workflow.generate_diagram("svg") # Vector graphics
workflow.generate_diagram("pdf") # PDF document
Features:
- ✅ Automatic generation - every pipeline gets a visual diagram
- ✅ Multiple formats - PNG, SVG, PDF, DOT
- ✅ Smart fallback - DOT files if Graphviz not installed
- ✅ Platform-specific styling - GitHub (blue), Jenkins (orange), CodeBuild (purple)
- ✅ Comprehensive view - shows triggers, jobs, dependencies, step counts
📖 Basic Usage
New Modular Import Style (Recommended)
from workflowforge import github_actions
# Create workflow using snake_case functions
workflow = github_actions.workflow(
name="My Workflow",
on=github_actions.on_push(branches=["main"])
)
# Create job
job = github_actions.job(runs_on="ubuntu-latest")
job.add_step(github_actions.action("actions/checkout@v4", name="Checkout"))
job.add_step(github_actions.run("echo 'Hello World!'", name="Say Hello"))
# Add job to workflow
workflow.add_job("hello", job)
# Generate YAML
print(workflow.to_yaml())
# Save with documentation and diagram
workflow.save(".github/workflows/hello.yml", generate_readme=True, generate_diagram=True)
# Creates: hello.yml + hello_README.md + My_Workflow.png
Jenkins Pipeline Usage
from workflowforge import jenkins_platform
# Create Jenkins pipeline using snake_case
pipeline = jenkins_platform.pipeline()
pipeline.set_agent(jenkins_platform.agent_docker("maven:3.9.3-eclipse-temurin-17"))
# Add stages
build_stage = jenkins_platform.stage("Build")
build_stage.add_step("mvn clean compile")
pipeline.add_stage(build_stage)
# Generate Jenkinsfile with diagram
pipeline.save("Jenkinsfile", generate_diagram=True)
# Creates: Jenkinsfile + jenkins_pipeline.png
AWS CodeBuild BuildSpec Usage
from workflowforge import aws_codebuild
# Create BuildSpec using snake_case
spec = aws_codebuild.buildspec()
# Add environment
env = aws_codebuild.environment()
env.add_variable("JAVA_HOME", "/usr/lib/jvm/java-17-openjdk")
spec.set_env(env)
# Add build phase
build_phase = aws_codebuild.phase()
build_phase.add_command("mvn clean package")
spec.set_build_phase(build_phase)
# Set artifacts
artifacts_obj = aws_codebuild.artifacts(["target/*.jar"])
spec.set_artifacts(artifacts_obj)
# Generate buildspec.yml with AI documentation and diagram
spec.save("buildspec.yml", generate_readme=True, use_ai=True, generate_diagram=True)
# Creates: buildspec.yml + buildspec_README.md + codebuild_spec.png
AI Documentation Examples
# GitHub Actions with AI README
workflow = Workflow(name="CI Pipeline", on=on_push())
job = Job(runs_on="ubuntu-latest")
job.add_step(action("actions/checkout@v4"))
workflow.add_job("test", job)
# Save with AI documentation and diagram
workflow.save("ci.yml", generate_readme=True, use_ai=True, generate_diagram=True)
# Creates: ci.yml + ci_README.md + Test_Workflow.png
# Jenkins with AI README and diagram
pipeline = pipeline()
stage_build = stage("Build")
stage_build.add_step("mvn clean package")
pipeline.add_stage(stage_build)
# Save with AI documentation and diagram
pipeline.save("Jenkinsfile", generate_readme=True, use_ai=True, generate_diagram=True)
# Creates: Jenkinsfile + Jenkinsfile_README.md + jenkins_pipeline.png
# Check AI availability
from workflowforge import OllamaClient
client = OllamaClient()
if client.is_available():
print("AI documentation available!")
else:
print("Using template documentation (Ollama not running)")
🆕 New Modular Import Structure
WorkflowForge now supports platform-specific imports with snake_case naming following Python conventions:
Platform Modules
# Import specific platforms
from workflowforge import github_actions, jenkins_platform, aws_codebuild
# Or use short aliases
from workflowforge import github_actions as gh
from workflowforge import jenkins_platform as jenkins
from workflowforge import aws_codebuild as cb
Benefits
✅ Platform separation - Clear namespace for each platform ✅ Snake case naming - Follows Python PEP 8 conventions ✅ IDE autocompletion - Better IntelliSense support
✅ Shorter code - gh.action() vs github_actions.action()
🔧 Advanced Examples
Build Matrix Workflow
from workflowforge import github_actions as gh
job = gh.job(
runs_on="ubuntu-latest",
strategy=gh.strategy(
matrix=gh.matrix(
python_version=["3.11", "3.12", "3.13"],
os=["ubuntu-latest", "windows-latest"]
)
)
)
Multiple Triggers
from workflowforge import github_actions as gh
workflow = gh.workflow(
name="CI/CD",
on=[
gh.on_push(branches=["main"]),
gh.on_pull_request(branches=["main"]),
gh.on_schedule("0 2 * * *") # Daily at 2 AM
]
)
Jobs with Dependencies
from workflowforge import github_actions as gh
test_job = gh.job(runs_on="ubuntu-latest")
deploy_job = gh.job(runs_on="ubuntu-latest")
deploy_job.needs = "test"
workflow = gh.workflow(name="CI/CD")
workflow.add_job("test", test_job)
workflow.add_job("deploy", deploy_job)
📚 Complete Documentation
Platform Support
GitHub Actions:
on_push(),on_pull_request(),on_schedule(),on_workflow_dispatch()action(),run()stepssecret(),variable(),github_context()for credentials- Build matrices, strategies, environments
Jenkins:
pipeline(),stage(),agent_docker(),agent_any()jenkins_credential(),jenkins_env(),jenkins_param()- Shared libraries, parameters, post actions
AWS CodeBuild:
buildspec(),phase(),environment(),artifacts()codebuild_secret(),codebuild_parameter(),codebuild_env()- Runtime versions, caching, reports
AI Documentation
- Ollama Integration: Local AI models (llama3.2, codellama, qwen2.5-coder)
- Automatic README: Explains workflow purpose, triggers, jobs, setup
- Fallback Support: Template-based documentation if AI unavailable
- All Platforms: Works with GitHub Actions, Jenkins, CodeBuild
Pipeline Visualization
- Graphviz Integration: Native diagram generation using DOT language
- Multiple Formats: PNG, SVG, PDF, DOT files
- Platform Styling: Color-coded diagrams (GitHub: blue, Jenkins: orange, CodeBuild: purple)
- Smart Fallback: DOT files if Graphviz not installed, images if available
- Comprehensive View: Shows triggers, jobs, dependencies, step counts, execution flow
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests
- Submit a pull request
👨💻 Author & Maintainer
Brainy Nimbus, LLC - We love opensource! 💖
Website: brainynimbus.io Email: info@brainynimbus.io GitHub: @brainynimbus
📄 License
MIT License - see LICENSE for details.
🔗 Links
GitHub Actions:
Jenkins:
AWS CodeBuild:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file workflowforge-1.0b7.tar.gz.
File metadata
- Download URL: workflowforge-1.0b7.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db6adba00930c806cabbec78981e0e419223c21bc3e1256db70a6a379e0ebd9f
|
|
| MD5 |
036ae32cce8c13d1a3a3133af75fdfcc
|
|
| BLAKE2b-256 |
f0f7828cac476827ff1bd9f787c5159ae697e3a90314a8ede97803dcba3186cf
|
Provenance
The following attestation bundles were made for workflowforge-1.0b7.tar.gz:
Publisher:
publish.yml on brainynimbus/workflowforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
workflowforge-1.0b7.tar.gz -
Subject digest:
db6adba00930c806cabbec78981e0e419223c21bc3e1256db70a6a379e0ebd9f - Sigstore transparency entry: 447100036
- Sigstore integration time:
-
Permalink:
brainynimbus/workflowforge@994048d1e4afe11aab9ba9c8eca8140889a7f88b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/brainynimbus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@994048d1e4afe11aab9ba9c8eca8140889a7f88b -
Trigger Event:
release
-
Statement type:
File details
Details for the file workflowforge-1.0b7-py3-none-any.whl.
File metadata
- Download URL: workflowforge-1.0b7-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c491e0658d564e2cc2ca4e0a3fc9fd71119ade5cd3d03917997b088c17b57a3b
|
|
| MD5 |
ef0c397385bffe245806b7cf3722ae3e
|
|
| BLAKE2b-256 |
8da351952adee3f540185e56bd200d6c38c9c6fca69afade20d3865d4342471e
|
Provenance
The following attestation bundles were made for workflowforge-1.0b7-py3-none-any.whl:
Publisher:
publish.yml on brainynimbus/workflowforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
workflowforge-1.0b7-py3-none-any.whl -
Subject digest:
c491e0658d564e2cc2ca4e0a3fc9fd71119ade5cd3d03917997b088c17b57a3b - Sigstore transparency entry: 447100058
- Sigstore integration time:
-
Permalink:
brainynimbus/workflowforge@994048d1e4afe11aab9ba9c8eca8140889a7f88b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/brainynimbus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@994048d1e4afe11aab9ba9c8eca8140889a7f88b -
Trigger Event:
release
-
Statement type: