Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ddev/changelog.d/23573.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Include .yaml workflow files in update-python-config so all workflow Python pins are updated.
6 changes: 4 additions & 2 deletions ddev/src/ddev/cli/meta/scripts/update_py_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def integrations(app):


def update_ci_files(app: Application, new_version: str, old_version: str, tracker: ValidationTracker):
workflows_dir = app.repo.path / ".github" / "workflows"
files_to_update = [
*(app.repo.path / ".github" / "workflows").glob("*.yml"),
*(app.repo.path / ".github" / "workflows" / "scripts").glob("*.sh"),
*workflows_dir.glob("*.yml"),
*workflows_dir.glob("*.yaml"),
*(workflows_dir / "scripts").glob("*.sh"),
]

# Patterns to match:
Expand Down
13 changes: 13 additions & 0 deletions ddev/tests/cli/meta/scripts/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ def fake_repo(tmp_path_factory, config_file, local_repo, ddev, mocker):
""",
)

write_file(
repo_path / '.github' / 'workflows',
'claim-pypi-name.yaml',
f"""name: claim pypi name
jobs:
claim:
steps:
- uses: actions/setup-python@v6
with:
python-version: "{OLD_PYTHON_VERSION}"
""",
)

write_file(
repo_path / 'ddev',
'pyproject.toml',
Expand Down
7 changes: 6 additions & 1 deletion ddev/tests/cli/meta/scripts/test_update_py_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_update_py_config(fake_repo, ddev):
result = ddev('meta', 'scripts', 'update-python-config', NEW_PYTHON_VERSION)

assert result.exit_code == 0, result.output
assert result.output.endswith('Python upgrades\n\nPassed: 9\n')
assert result.output.endswith('Python upgrades\n\nPassed: 10\n')

contents = constant_file.read_text()
assert f'PYTHON_VERSION = {OLD_PYTHON_VERSION!r}' not in contents
Expand All @@ -25,6 +25,11 @@ def test_update_py_config(fake_repo, ddev):
assert f'PYTHON_VERSION: "{OLD_PYTHON_VERSION}"' not in contents
assert f'PYTHON_VERSION: "{NEW_PYTHON_VERSION}"' in contents

yaml_workflow = fake_repo.path / '.github' / 'workflows' / 'claim-pypi-name.yaml'
contents = yaml_workflow.read_text()
assert f'python-version: "{OLD_PYTHON_VERSION}"' not in contents
assert f'python-version: "{NEW_PYTHON_VERSION}"' in contents

hatch_file = fake_repo.path / 'dummy' / 'hatch.toml'
contents = hatch_file.read_text()
assert f'python = ["{OLD_PYTHON_VERSION}"]' not in contents
Expand Down
Loading