workflowforge 1.0b7__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. {workflowforge-1.0b7 → workflowforge-1.1.0}/.github/workflows/publish.yml +30 -4
  2. {workflowforge-1.0b7 → workflowforge-1.1.0}/.gitignore +1 -1
  3. {workflowforge-1.0b7 → workflowforge-1.1.0}/CHANGELOG.md +26 -0
  4. {workflowforge-1.0b7 → workflowforge-1.1.0}/PKG-INFO +2 -2
  5. workflowforge-1.1.0/RELEASE_NOTES_v1.0.0.md +35 -0
  6. workflowforge-1.1.0/RELEASE_NOTES_v1.1.0.md +25 -0
  7. workflowforge-1.1.0/examples/azure_devops/hello_world.py +23 -0
  8. workflowforge-1.1.0/examples/azure_devops/hello_world.yml +13 -0
  9. workflowforge-1.1.0/examples/azure_devops/python_ci.py +21 -0
  10. workflowforge-1.1.0/examples/azure_devops/python_ci.yml +66 -0
  11. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/github_actions/python_matrix.py +1 -1
  12. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/github_actions/python_matrix.yml +1 -1
  13. {workflowforge-1.0b7 → workflowforge-1.1.0}/pyproject.toml +2 -2
  14. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/__init__.py +3 -1
  15. workflowforge-1.1.0/src/workflowforge/azure_devops.py +289 -0
  16. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/templates.py +4 -4
  17. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge.egg-info/PKG-INFO +2 -2
  18. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge.egg-info/SOURCES.txt +7 -0
  19. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/test_templates.py +14 -0
  20. {workflowforge-1.0b7 → workflowforge-1.1.0}/.flake8 +0 -0
  21. {workflowforge-1.0b7 → workflowforge-1.1.0}/.github/pull_request_template.md +0 -0
  22. {workflowforge-1.0b7 → workflowforge-1.1.0}/.pre-commit-config.yaml +0 -0
  23. {workflowforge-1.0b7 → workflowforge-1.1.0}/AUTHORS.md +0 -0
  24. {workflowforge-1.0b7 → workflowforge-1.1.0}/LICENSE +0 -0
  25. {workflowforge-1.0b7 → workflowforge-1.1.0}/MANIFEST.in +0 -0
  26. {workflowforge-1.0b7 → workflowforge-1.1.0}/README.md +0 -0
  27. {workflowforge-1.0b7 → workflowforge-1.1.0}/README_PRECOMMIT.md +0 -0
  28. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/README.md +0 -0
  29. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/codebuild/buildspec.yml +0 -0
  30. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/codebuild/node_app.py +0 -0
  31. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/github_actions/basic_ci.py +0 -0
  32. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/github_actions/basic_ci.yml +0 -0
  33. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/jenkins/Jenkinsfile +0 -0
  34. {workflowforge-1.0b7 → workflowforge-1.1.0}/examples/jenkins/maven_build.py +0 -0
  35. {workflowforge-1.0b7 → workflowforge-1.1.0}/setup.cfg +0 -0
  36. {workflowforge-1.0b7 → workflowforge-1.1.0}/setup.py +0 -0
  37. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/ai_documentation.py +0 -0
  38. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/codebuild.py +0 -0
  39. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/environment.py +0 -0
  40. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/github_actions_module.py +0 -0
  41. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/jenkins.py +0 -0
  42. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/jenkins_plugins.py +0 -0
  43. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/job.py +0 -0
  44. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/schema_validation.py +0 -0
  45. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/secrets.py +0 -0
  46. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/step.py +0 -0
  47. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/strategy.py +0 -0
  48. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/triggers.py +0 -0
  49. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/validation.py +0 -0
  50. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/visualization.py +0 -0
  51. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge/workflow.py +0 -0
  52. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge.egg-info/dependency_links.txt +0 -0
  53. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge.egg-info/requires.txt +0 -0
  54. {workflowforge-1.0b7 → workflowforge-1.1.0}/src/workflowforge.egg-info/top_level.txt +0 -0
  55. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/__init__.py +0 -0
  56. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/test_ai_documentation.py +0 -0
  57. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/test_codebuild.py +0 -0
  58. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/test_jenkins.py +0 -0
  59. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/test_secrets.py +0 -0
  60. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/test_validation.py +0 -0
  61. {workflowforge-1.0b7 → workflowforge-1.1.0}/tests/test_workflow.py +0 -0
@@ -10,15 +10,25 @@ on:
10
10
  release:
11
11
  types:
12
12
  - published
13
+ workflow_dispatch:
14
+ inputs:
15
+ target:
16
+ description: Publish target (testpypi|pypi)
17
+ required: true
18
+ default: testpypi
19
+ type: choice
20
+ options:
21
+ - testpypi
22
+ - pypi
13
23
  jobs:
14
24
  test:
15
25
  steps:
16
26
  - uses: actions/checkout@v4
17
27
  name: Checkout code
18
28
  - uses: actions/setup-python@v5
19
- name: Set up Python ${{ matrix.python-version }}
29
+ name: Set up Python ${{ matrix.python_version }}
20
30
  with:
21
- python-version: ${{ matrix.python-version }}
31
+ python-version: ${{ matrix.python_version }}
22
32
  - run: python -m pip install --upgrade pip
23
33
  name: Install pip
24
34
  - run: pip install -e .[dev]
@@ -67,6 +77,13 @@ jobs:
67
77
  name: Install build tools
68
78
  - run: python -m build
69
79
  name: Build package
80
+ - run: "echo \"Verifying tag matches pyproject version for release runs...\"\nPYPROJECT_VERSION=$(python - <<'PY'\n\
81
+ import tomllib\nwith open('pyproject.toml', 'rb') as f:\n data = tomllib.load(f)\nprint(data['project']['version'])\n\
82
+ PY\n)\nTAG_NAME=${GITHUB_REF_NAME#v}\necho \"pyproject version: ${PYPROJECT_VERSION}\"\necho \"tag version :
83
+ ${TAG_NAME}\"\nif [ \"${{ github.event_name }}\" = \"release\" ] && [ \"$PYPROJECT_VERSION\" != \"$TAG_NAME\" ];
84
+ then\n echo \"ERROR: Version mismatch (pyproject=$PYPROJECT_VERSION tag=$TAG_NAME). Aborting.\" >&2\n exit 1\n\
85
+ fi\n"
86
+ name: Verify tag and project version match
70
87
  - run: twine check dist/*
71
88
  name: Verify package metadata
72
89
  - uses: actions/upload-artifact@v4
@@ -89,13 +106,17 @@ jobs:
89
106
  name: Publish to TestPyPI
90
107
  with:
91
108
  repository-url: https://test.pypi.org/legacy/
109
+ skip-existing: 'true'
110
+ verify-metadata: 'true'
111
+ print-hash: 'true'
92
112
  needs: build
93
113
  environment:
94
114
  name: testpypi
95
115
  url: https://test.pypi.org/p/workflowforge
96
116
  permissions:
97
117
  id-token: write
98
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
118
+ if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' &&
119
+ github.event.inputs.target == 'testpypi')
99
120
  runs-on: ubuntu-latest
100
121
  publish-pypi:
101
122
  steps:
@@ -106,11 +127,16 @@ jobs:
106
127
  path: dist/
107
128
  - uses: pypa/gh-action-pypi-publish@release/v1
108
129
  name: Publish to PyPI
130
+ with:
131
+ skip-existing: 'true'
132
+ verify-metadata: 'true'
133
+ print-hash: 'true'
109
134
  needs: build
110
135
  environment:
111
136
  name: pypi
112
137
  url: https://pypi.org/p/workflowforge
113
138
  permissions:
114
139
  id-token: write
115
- if: github.event_name == 'release'
140
+ if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target ==
141
+ 'pypi')
116
142
  runs-on: ubuntu-latest
@@ -199,4 +199,4 @@ create_*pipeline*.py
199
199
  *_README.md
200
200
  *workflow*.png
201
201
  *pipeline*.png
202
- *buildspec*.png
202
+ *codebuild*.png
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0] - 2025-08-29
4
+
5
+ ### Added
6
+ - Azure DevOps YAML support (`workflowforge.azure_devops`): pipeline/job/steps/task modeling and YAML emitter
7
+ - Python CI template for Azure Pipelines with multi-OS matrix (Ubuntu/Windows/macOS) and pip caching via Cache@2
8
+ - Minimal Azure DevOps hello-world template and examples under `examples/azure_devops/`
9
+
10
+ ### Changed
11
+ - Exported `azure_devops` from public API for `from workflowforge import azure_devops`
12
+ - Consistent YAML indentation for Azure Pipelines emitter to improve readability
13
+
14
+ ### Security
15
+ - CI/CD remains on GitHub Actions with tag/version guard and idempotent PyPI/TestPyPI publishing (`skip-existing`)
16
+
3
17
  All notable changes to WorkflowForge will be documented in this file.
4
18
 
5
19
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -7,6 +21,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
21
 
8
22
 
9
23
 
24
+ ## [1.0.0] - 2025-08-29
25
+
26
+ ### Changed
27
+ - Promote project to stable release (1.0.0)
28
+ - Update classifiers to Production/Stable
29
+
30
+ ### Fixed
31
+ - Correct GitHub Actions matrix variable references:
32
+ - Use `matrix.python_version` instead of `matrix.python-version`
33
+ - Use `matrix.node_version` instead of `matrix.node-version`
34
+ - Align examples and CI workflow with corrected matrix variable names
35
+
10
36
  ## [1.0b7] - 2025-08-27
11
37
 
12
38
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workflowforge
3
- Version: 1.0b7
3
+ Version: 1.1.0
4
4
  Summary: A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python
5
5
  Author-email: "Brainy Nimbus, LLC" <info@brainynimbus.io>
6
6
  License: MIT
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/brainynimbus/workflowforge
9
9
  Project-URL: Documentation, https://workflowforge.brainynimbus.io
10
10
  Project-URL: Issues, https://github.com/brainynimbus/workflowforge/issues
11
11
  Keywords: github-actions,jenkins,codebuild,aws,workflow,ci-cd,automation,yaml,devops,pipeline,buildspec
12
- Classifier: Development Status :: 4 - Beta
12
+ Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.11
@@ -0,0 +1,35 @@
1
+ # v1.0.0 — Stable Release
2
+
3
+ ## Summary
4
+ Stable 1.0.0 release of WorkflowForge. This promotes the library from beta to production-ready, fixes a release‑blocking CI matrix variable bug, and confirms clean tests across Python 3.11–3.13.
5
+
6
+ ## Highlights
7
+ - Type safety: Strict typing with mypy and Pydantic across modules
8
+ - Multi‑platform: Generate GitHub Actions, Jenkins, and AWS CodeBuild specs
9
+ - Quality gates: Black/Isort/Flake8/Mypy/pytest with coverage in CI
10
+ - Security: Bandit + Safety scans in CI; no embedded secrets detected
11
+ - Docs & visuals: Optional AI README with Ollama; automatic pipeline diagrams
12
+
13
+ ## Fixes
14
+ - Matrix variables: Use `matrix.python_version`/`matrix.node_version` (previously hyphenated). Aligned templates, examples, and CI
15
+ - Tests: Added assertions to enforce correct matrix variable references
16
+
17
+ ## Compatibility
18
+ - Python: 3.11, 3.12, 3.13
19
+ - Breaking changes: None since latest beta. Note older betas removed legacy top‑level imports in favor of platform‑specific modules
20
+
21
+ ## Upgrade Notes
22
+ - If you referenced old hyphenated matrix vars in custom workflows, update to `matrix.python_version` and `matrix.node_version`
23
+ - Regenerate example workflows to reflect v1.0.0 behavior
24
+
25
+ ## CI/CD & Publishing
26
+ - OIDC‑based publishing to PyPI on GitHub “release published” events
27
+ - TestPyPI publishes on `main` push
28
+
29
+ ## Security
30
+ - CI runs Bandit and Safety. Keep dependencies current to maintain posture
31
+
32
+ ## Links
33
+ - Changelog: CHANGELOG.md:10
34
+ - CI workflow: .github/workflows/publish.yml:19
35
+ - Version bump: pyproject.toml:7, src/workflowforge/__init__.py:13
@@ -0,0 +1,25 @@
1
+ # v1.1.0 — Azure DevOps CI Support
2
+
3
+ ## Summary
4
+ Adds first-class Azure DevOps Pipelines support for CI while keeping releases on GitHub Actions. Includes a Python matrix CI template with multi‑OS and caching, plus a minimal hello‑world pipeline.
5
+
6
+ ## What's New
7
+ - New module: `workflowforge.azure_devops`
8
+ - `pipeline`, `job`, `strategy(matrix)`, `task`, `script`
9
+ - YAML emitter with readable indentation
10
+ - Templates:
11
+ - `python_ci_template_azure(...)` — matrix over Python (3.11/3.12/3.13) and OS (Ubuntu/Windows/macOS) with pip caching via Cache@2
12
+ - `hello_world_template_azure(...)` — single job printing a message
13
+ - Examples:
14
+ - `examples/azure_devops/python_ci.yml` and generator `python_ci.py`
15
+ - `examples/azure_devops/hello_world.yml` and generator `hello_world.py`
16
+
17
+ ## CI/CD Strategy
18
+ - CI on Azure DevOps (build/lint/type/test)
19
+ - Release remains on GitHub Actions with:
20
+ - Tag/version guard (tag `vX.Y.Z` must match `pyproject.toml`)
21
+ - Idempotent publishing to PyPI/TestPyPI (`skip-existing: true`)
22
+
23
+ ## Upgrade Notes
24
+ - Import as: `from workflowforge import azure_devops as ado`
25
+ - Generate ADO CI: `ado.python_ci_template_azure().save("azure-pipelines.yml")`
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Generate a minimal Azure DevOps pipeline that prints a hello message.
4
+ """
5
+
6
+ from workflowforge import azure_devops as ado
7
+
8
+
9
+ def main() -> None:
10
+ pipeline = ado.hello_world_template_azure(
11
+ name="Hello ADO",
12
+ message="Hello Azure DevOps from WorkflowForge!",
13
+ vm_image="ubuntu-latest",
14
+ branches=["main"],
15
+ )
16
+ pipeline.save("examples/azure_devops/hello_world.yml")
17
+ print(
18
+ "✅ Azure DevOps hello pipeline created: examples/azure_devops/hello_world.yml"
19
+ )
20
+
21
+
22
+ if __name__ == "__main__":
23
+ main()
@@ -0,0 +1,13 @@
1
+ # Do not modify - Generated with WorkflowForge
2
+ name: Hello ADO
3
+ trigger:
4
+ - main
5
+ pr:
6
+ - main
7
+ jobs:
8
+ - job: hello
9
+ pool:
10
+ vmImage: ubuntu-latest
11
+ steps:
12
+ - script: echo Hello Azure DevOps from WorkflowForge!
13
+ displayName: Say hello
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Generate an Azure DevOps Python CI matrix pipeline using WorkflowForge.
4
+ """
5
+
6
+ from workflowforge import azure_devops as ado
7
+
8
+
9
+ def main() -> None:
10
+ pipeline = ado.python_ci_template_azure(
11
+ python_versions=["3.11", "3.12", "3.13"],
12
+ branches=["main"],
13
+ os_list=["ubuntu-latest", "windows-latest", "macOS-latest"],
14
+ use_cache=True,
15
+ )
16
+ pipeline.save("examples/azure_devops/python_ci.yml")
17
+ print("✅ Azure DevOps pipeline created: examples/azure_devops/python_ci.yml")
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()
@@ -0,0 +1,66 @@
1
+ # Do not modify - Generated with WorkflowForge
2
+ name: Python CI
3
+ trigger:
4
+ - main
5
+ pr:
6
+ - main
7
+ jobs:
8
+ - job: Test
9
+ pool:
10
+ vmImage: $(vmImage)
11
+ steps:
12
+ - task: UsePythonVersion@0
13
+ inputs:
14
+ versionSpec: $(python.version)
15
+ displayName: Use Python
16
+ - task: Cache@2
17
+ inputs:
18
+ key: pip | $(Agent.OS) | $(python.version) | pyproject.toml
19
+ restoreKeys: pip | $(Agent.OS) | $(python.version)
20
+ path: $(PIP_CACHE_DIR)
21
+ displayName: Cache pip
22
+ - script: python -m pip install --upgrade pip
23
+ displayName: Upgrade pip
24
+ - script: pip install -e .[dev]
25
+ displayName: Install deps
26
+ - script: black --check src/ tests/
27
+ displayName: Black
28
+ - script: isort --check-only src/ tests/
29
+ displayName: Isort
30
+ - script: flake8 src/ tests/ examples/
31
+ displayName: Flake8
32
+ - script: mypy --install-types --non-interactive src/
33
+ displayName: Mypy
34
+ - script: pytest -q
35
+ displayName: Pytest
36
+ variables:
37
+ PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
38
+ strategy:
39
+ matrix:
40
+ Py311_ubuntulatest:
41
+ python.version: '3.11'
42
+ vmImage: ubuntu-latest
43
+ Py311_windowslatest:
44
+ python.version: '3.11'
45
+ vmImage: windows-latest
46
+ Py311_macOSlatest:
47
+ python.version: '3.11'
48
+ vmImage: macOS-latest
49
+ Py312_ubuntulatest:
50
+ python.version: '3.12'
51
+ vmImage: ubuntu-latest
52
+ Py312_windowslatest:
53
+ python.version: '3.12'
54
+ vmImage: windows-latest
55
+ Py312_macOSlatest:
56
+ python.version: '3.12'
57
+ vmImage: macOS-latest
58
+ Py313_ubuntulatest:
59
+ python.version: '3.13'
60
+ vmImage: ubuntu-latest
61
+ Py313_windowslatest:
62
+ python.version: '3.13'
63
+ vmImage: windows-latest
64
+ Py313_macOSlatest:
65
+ python.version: '3.13'
66
+ vmImage: macOS-latest
@@ -32,7 +32,7 @@ def main():
32
32
  job.add_step(
33
33
  github_actions.action(
34
34
  "actions/setup-python@v5",
35
- with_={"python-version": "${{ matrix.python-version }}"},
35
+ with_={"python-version": "${{ matrix.python_version }}"},
36
36
  )
37
37
  )
38
38
  job.add_step(github_actions.run("pip install pytest"))
@@ -13,7 +13,7 @@ jobs:
13
13
  - uses: actions/checkout@v4
14
14
  - uses: actions/setup-python@v5
15
15
  with:
16
- python-version: ${{ matrix.python-version }}
16
+ python-version: ${{ matrix.python_version }}
17
17
  - run: pip install pytest
18
18
  - run: pytest tests/
19
19
  strategy:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "workflowforge"
7
- version = "1.0b7"
7
+ version = "1.1.0"
8
8
  description = "A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python"
9
9
  authors = [{name = "Brainy Nimbus, LLC", email = "info@brainynimbus.io"}]
10
10
  license = {text = "MIT"}
@@ -14,7 +14,7 @@ readme = "README.md"
14
14
  requires-python = ">=3.11"
15
15
  keywords = ["github-actions", "jenkins", "codebuild", "aws", "workflow", "ci-cd", "automation", "yaml", "devops", "pipeline", "buildspec"]
16
16
  classifiers = [
17
- "Development Status :: 4 - Beta",
17
+ "Development Status :: 5 - Production/Stable",
18
18
  "Intended Audience :: Developers",
19
19
 
20
20
  "Programming Language :: Python :: 3",
@@ -6,13 +6,15 @@ and AWS CodeBuild BuildSpecs programmatically with type validation and autocompl
6
6
  """
7
7
 
8
8
  # Platform-specific modules
9
+ from . import azure_devops as azure_devops
9
10
  from . import codebuild as aws_codebuild
10
11
  from . import github_actions_module as github_actions
11
12
  from . import jenkins as jenkins_platform
12
13
 
13
- __version__ = "1.0b7"
14
+ __version__ = "1.1.0"
14
15
  __all__ = [
15
16
  "github_actions",
16
17
  "jenkins_platform",
17
18
  "aws_codebuild",
19
+ "azure_devops",
18
20
  ]
@@ -0,0 +1,289 @@
1
+ """Azure DevOps Pipelines support for WorkflowForge.
2
+
3
+ Minimal, type-safe models to generate Azure Pipelines YAML for
4
+ Python CI matrices and common steps.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Any
10
+
11
+ from pydantic import BaseModel, Field
12
+ from ruamel.yaml import YAML
13
+
14
+ # ------------------------- Steps -------------------------
15
+
16
+
17
+ class ADOStep(BaseModel):
18
+ """Abstract base for Azure Pipelines steps."""
19
+
20
+ def to_dict(self) -> dict[str, Any]: # pragma: no cover - implemented by subclasses
21
+ raise NotImplementedError
22
+
23
+
24
+ class ADOTaskStep(ADOStep):
25
+ """Represents a `- task:` step.
26
+
27
+ Example:
28
+ - task: UsePythonVersion@0
29
+ inputs:
30
+ versionSpec: '3.11'
31
+ displayName: Use Python 3.11
32
+ """
33
+
34
+ task: str = Field(..., description="Task spec, e.g., UsePythonVersion@0")
35
+ inputs: dict[str, Any] | None = Field(
36
+ default=None, description="Task inputs under 'inputs' key"
37
+ )
38
+ displayName: str | None = Field(default=None, description="Friendly step name")
39
+
40
+ def to_dict(self) -> dict[str, Any]:
41
+ result: dict[str, Any] = {"task": self.task}
42
+ if self.inputs:
43
+ result["inputs"] = self.inputs
44
+ if self.displayName:
45
+ result["displayName"] = self.displayName
46
+ return result
47
+
48
+
49
+ class ADOScriptStep(ADOStep):
50
+ """Represents a `- script:` step."""
51
+
52
+ script: str = Field(..., description="Inline script to execute")
53
+ displayName: str | None = Field(default=None, description="Friendly step name")
54
+
55
+ def to_dict(self) -> dict[str, Any]:
56
+ result: dict[str, Any] = {"script": self.script}
57
+ if self.displayName:
58
+ result["displayName"] = self.displayName
59
+ return result
60
+
61
+
62
+ def task(
63
+ task_spec: str, inputs: dict[str, Any] | None = None, name: str | None = None
64
+ ) -> ADOTaskStep:
65
+ """Factory to create a task step."""
66
+ return ADOTaskStep(task=task_spec, inputs=inputs, displayName=name)
67
+
68
+
69
+ def script(cmd: str, name: str | None = None) -> ADOScriptStep:
70
+ """Factory to create a script step."""
71
+ return ADOScriptStep(script=cmd, displayName=name)
72
+
73
+
74
+ # ------------------------- Job & Strategy -------------------------
75
+
76
+
77
+ class ADOStrategy(BaseModel):
78
+ """Strategy with matrix support."""
79
+
80
+ matrix: dict[str, dict[str, Any]] | None = Field(
81
+ default=None, description="Matrix entries (name -> variables map)"
82
+ )
83
+
84
+ def to_dict(self) -> dict[str, Any]:
85
+ return {"matrix": self.matrix} if self.matrix else {}
86
+
87
+
88
+ def strategy(matrix: dict[str, dict[str, Any]] | None = None) -> ADOStrategy:
89
+ return ADOStrategy(matrix=matrix)
90
+
91
+
92
+ class ADOJob(BaseModel):
93
+ """Represents a job entry with steps and optional matrix strategy."""
94
+
95
+ name: str = Field(..., description="Job name identifier")
96
+ vm_image: str = Field("ubuntu-latest", description="Microsoft-hosted image")
97
+ strategy: ADOStrategy | None = Field(None, description="Job strategy")
98
+ variables: dict[str, Any] | None = Field(
99
+ default=None, description="Job-level variables"
100
+ )
101
+ steps: list[ADOStep] = Field(default_factory=list, description="Job steps")
102
+
103
+ def add_step(self, step: ADOStep) -> ADOJob:
104
+ self.steps.append(step)
105
+ return self
106
+
107
+ def to_dict(self) -> dict[str, Any]:
108
+ data: dict[str, Any] = {
109
+ "job": self.name,
110
+ "pool": {"vmImage": self.vm_image},
111
+ "steps": [s.to_dict() for s in self.steps],
112
+ }
113
+ if self.variables:
114
+ data["variables"] = self.variables
115
+ if self.strategy:
116
+ strat = self.strategy.to_dict()
117
+ if strat:
118
+ data["strategy"] = strat
119
+ return data
120
+
121
+
122
+ def job(
123
+ name: str,
124
+ vm_image: str = "ubuntu-latest",
125
+ strategy: ADOStrategy | None = None,
126
+ variables: dict[str, Any] | None = None,
127
+ ) -> ADOJob:
128
+ return ADOJob(name=name, vm_image=vm_image, strategy=strategy, variables=variables)
129
+
130
+
131
+ # ------------------------- Pipeline -------------------------
132
+
133
+
134
+ class ADOPipeline(BaseModel):
135
+ """Top-level Azure Pipelines YAML structure (minimal)."""
136
+
137
+ name: str | None = Field(None, description="Pipeline name")
138
+ trigger: list[str] | None = Field(
139
+ default=None, description="CI trigger branches (shorthand list)"
140
+ )
141
+ pr: list[str] | None = Field(
142
+ default=None, description="PR trigger branches (shorthand list)"
143
+ )
144
+ variables: dict[str, Any] | None = Field(
145
+ default=None, description="Root variables map"
146
+ )
147
+ jobs: list[ADOJob] = Field(default_factory=list, description="Pipeline jobs")
148
+
149
+ def add_job(self, j: ADOJob) -> ADOPipeline:
150
+ self.jobs.append(j)
151
+ return self
152
+
153
+ def to_yaml(self) -> str:
154
+ data: dict[str, Any] = {}
155
+ if self.name:
156
+ data["name"] = self.name
157
+ if self.trigger is not None:
158
+ data["trigger"] = self.trigger
159
+ if self.pr is not None:
160
+ data["pr"] = self.pr
161
+ if self.variables:
162
+ data["variables"] = self.variables
163
+ data["jobs"] = [j.to_dict() for j in self.jobs]
164
+
165
+ yaml = YAML()
166
+ yaml.default_flow_style = False
167
+ yaml.indent(mapping=2, sequence=4, offset=2)
168
+ yaml.width = 120
169
+ yaml.preserve_quotes = True
170
+
171
+ from io import StringIO
172
+
173
+ stream = StringIO()
174
+ yaml.dump(data, stream)
175
+ content = stream.getvalue()
176
+ return f"# Do not modify - Generated with WorkflowForge\n{content}"
177
+
178
+ def save(self, filepath: str = "azure-pipelines.yml") -> None:
179
+ with open(filepath, "w", encoding="utf-8") as f:
180
+ f.write(self.to_yaml())
181
+
182
+
183
+ def pipeline(
184
+ name: str | None = None,
185
+ trigger: list[str] | None = None,
186
+ pr: list[str] | None = None,
187
+ variables: dict[str, Any] | None = None,
188
+ ) -> ADOPipeline:
189
+ return ADOPipeline(name=name, trigger=trigger, pr=pr, variables=variables)
190
+
191
+
192
+ # ------------------------- Templates -------------------------
193
+
194
+
195
+ def python_ci_template_azure(
196
+ python_versions: list[str] | None = None,
197
+ branches: list[str] | None = None,
198
+ os_list: list[str] | None = None,
199
+ use_cache: bool = True,
200
+ ) -> ADOPipeline:
201
+ """Create a Python CI matrix pipeline for Azure Pipelines.
202
+
203
+ - Uses UsePythonVersion@0 for each matrix entry
204
+ - Installs dev dependencies and runs lint/type/tests similar to GitHub Actions
205
+ """
206
+
207
+ if python_versions is None:
208
+ python_versions = ["3.11", "3.12", "3.13"]
209
+ if branches is None:
210
+ branches = ["main"]
211
+ if os_list is None:
212
+ os_list = ["ubuntu-latest", "windows-latest", "macOS-latest"]
213
+
214
+ # Build matrix mapping: combine python + OS
215
+ matrix_map: dict[str, dict[str, str]] = {}
216
+ for v in python_versions:
217
+ for os_name in os_list:
218
+ key = f"Py{v.replace('.', '')}_{os_name.replace('-', '').replace('.', '')}"
219
+ matrix_map[key] = {"python.version": v, "vmImage": os_name}
220
+
221
+ pl = pipeline(name="Python CI", trigger=branches, pr=branches)
222
+
223
+ test_job = job(
224
+ name="Test",
225
+ vm_image="$(vmImage)",
226
+ strategy=strategy(matrix=matrix_map),
227
+ variables=(
228
+ {"PIP_CACHE_DIR": "$(Pipeline.Workspace)/.pip"} if use_cache else None
229
+ ),
230
+ )
231
+ test_job.add_step(
232
+ task(
233
+ "UsePythonVersion@0",
234
+ inputs={"versionSpec": "$(python.version)"},
235
+ name="Use Python",
236
+ )
237
+ )
238
+ if use_cache:
239
+ test_job.add_step(
240
+ task(
241
+ "Cache@2",
242
+ inputs={
243
+ "key": "pip | $(Agent.OS) | $(python.version) | pyproject.toml",
244
+ "restoreKeys": "pip | $(Agent.OS) | $(python.version)",
245
+ "path": "$(PIP_CACHE_DIR)",
246
+ },
247
+ name="Cache pip",
248
+ )
249
+ )
250
+ test_job.add_step(script("python -m pip install --upgrade pip", name="Upgrade pip"))
251
+ test_job.add_step(script("pip install -e .[dev]", name="Install deps"))
252
+ test_job.add_step(script("black --check src/ tests/", name="Black"))
253
+ test_job.add_step(script("isort --check-only src/ tests/", name="Isort"))
254
+ test_job.add_step(script("flake8 src/ tests/ examples/", name="Flake8"))
255
+ test_job.add_step(
256
+ script("mypy --install-types --non-interactive src/", name="Mypy")
257
+ )
258
+ test_job.add_step(script("pytest -q", name="Pytest"))
259
+
260
+ pl.add_job(test_job)
261
+ return pl
262
+
263
+
264
+ # Public aliases to match library style
265
+ azure_pipeline = pipeline
266
+
267
+
268
+ def hello_world_template_azure(
269
+ name: str = "Hello ADO",
270
+ message: str = "Hello from WorkflowForge!",
271
+ vm_image: str = "ubuntu-latest",
272
+ branches: list[str] | None = None,
273
+ ) -> ADOPipeline:
274
+ """Create a minimal Azure Pipelines pipeline that prints a message.
275
+
276
+ Args:
277
+ name: Pipeline display name.
278
+ message: Text to echo during the job.
279
+ vm_image: Hosted image for the job.
280
+ branches: CI trigger branches (default: ['main']).
281
+ """
282
+ if branches is None:
283
+ branches = ["main"]
284
+
285
+ pl = pipeline(name=name, trigger=branches, pr=branches)
286
+ j = job(name="hello", vm_image=vm_image)
287
+ j.add_step(script(f"echo {message}", name="Say hello"))
288
+ pl.add_job(j)
289
+ return pl
@@ -28,8 +28,8 @@ def python_ci_template(
28
28
  test_job.add_step(
29
29
  action(
30
30
  "actions/setup-python@v5",
31
- name="Set up Python ${{ matrix.python-version }}",
32
- with_={"python-version": "${{ matrix.python-version }}"},
31
+ name="Set up Python ${{ matrix.python_version }}",
32
+ with_={"python-version": "${{ matrix.python_version }}"},
33
33
  )
34
34
  )
35
35
  test_job.add_step(run("pip install -e .[dev]", name="Install dependencies"))
@@ -96,9 +96,9 @@ def node_ci_template(
96
96
  test_job.add_step(
97
97
  action(
98
98
  "actions/setup-node@v4",
99
- name="Setup Node.js ${{ matrix.node-version }}",
99
+ name="Setup Node.js ${{ matrix.node_version }}",
100
100
  with_={
101
- "node-version": "${{ matrix.node-version }}",
101
+ "node-version": "${{ matrix.node_version }}",
102
102
  "cache": package_manager,
103
103
  },
104
104
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workflowforge
3
- Version: 1.0b7
3
+ Version: 1.1.0
4
4
  Summary: A robust and flexible library for creating GitHub Actions workflows, Jenkins pipelines, and AWS CodeBuild BuildSpecs programmatically in Python
5
5
  Author-email: "Brainy Nimbus, LLC" <info@brainynimbus.io>
6
6
  License: MIT
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/brainynimbus/workflowforge
9
9
  Project-URL: Documentation, https://workflowforge.brainynimbus.io
10
10
  Project-URL: Issues, https://github.com/brainynimbus/workflowforge/issues
11
11
  Keywords: github-actions,jenkins,codebuild,aws,workflow,ci-cd,automation,yaml,devops,pipeline,buildspec
12
- Classifier: Development Status :: 4 - Beta
12
+ Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.11
@@ -7,11 +7,17 @@ LICENSE
7
7
  MANIFEST.in
8
8
  README.md
9
9
  README_PRECOMMIT.md
10
+ RELEASE_NOTES_v1.0.0.md
11
+ RELEASE_NOTES_v1.1.0.md
10
12
  pyproject.toml
11
13
  setup.py
12
14
  .github/pull_request_template.md
13
15
  .github/workflows/publish.yml
14
16
  examples/README.md
17
+ examples/azure_devops/hello_world.py
18
+ examples/azure_devops/hello_world.yml
19
+ examples/azure_devops/python_ci.py
20
+ examples/azure_devops/python_ci.yml
15
21
  examples/codebuild/buildspec.yml
16
22
  examples/codebuild/node_app.py
17
23
  examples/github_actions/basic_ci.py
@@ -22,6 +28,7 @@ examples/jenkins/Jenkinsfile
22
28
  examples/jenkins/maven_build.py
23
29
  src/workflowforge/__init__.py
24
30
  src/workflowforge/ai_documentation.py
31
+ src/workflowforge/azure_devops.py
25
32
  src/workflowforge/codebuild.py
26
33
  src/workflowforge/environment.py
27
34
  src/workflowforge/github_actions_module.py
@@ -18,6 +18,13 @@ def test_python_ci_template():
18
18
  assert parsed["name"] == "Python CI"
19
19
  assert "test" in parsed["jobs"]
20
20
  assert "strategy" in parsed["jobs"]["test"]
21
+ # Ensure matrix variable name matches the matrix key (python_version)
22
+ steps = parsed["jobs"]["test"]["steps"]
23
+ setup_steps = [s for s in steps if s.get("uses") == "actions/setup-python@v5"]
24
+ assert setup_steps, "Missing actions/setup-python@v5 step"
25
+ assert (
26
+ setup_steps[0]["with"]["python-version"] == "${{ matrix.python_version }}"
27
+ ), "setup-python should reference matrix.python_version"
21
28
 
22
29
 
23
30
  def test_docker_build_template():
@@ -38,3 +45,10 @@ def test_node_ci_template():
38
45
  parsed = yaml.safe_load(yaml_output)
39
46
  assert parsed["name"] == "Node.js CI"
40
47
  assert "test" in parsed["jobs"]
48
+ # Ensure matrix variable name matches the matrix key (node_version)
49
+ steps = parsed["jobs"]["test"]["steps"]
50
+ setup_steps = [s for s in steps if s.get("uses") == "actions/setup-node@v4"]
51
+ assert setup_steps, "Missing actions/setup-node@v4 step"
52
+ assert (
53
+ setup_steps[0]["with"]["node-version"] == "${{ matrix.node_version }}"
54
+ ), "setup-node should reference matrix.node_version"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes