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
7 changes: 5 additions & 2 deletions dev/breeze/doc/ci/04_selective_checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,11 @@ when some files are not changed. Those are the rules implemented:
skipped (it regenerates and diffs the generated ts-sdk file; a change to the supervisor
wire schema alone deliberately does not trigger it - regenerating the ts-sdk types is
the ts-sdk follow-up PR's job, not the schema author's)
* if no `All Providers Python files` and no `All Providers Yaml files` are changed -
`check-provider-yaml-valid` check is skipped
* `check-provider-yaml-valid` is skipped unless at least one of these changed:
`All Providers Python files`, `All Providers Distribution Config files`
(which includes `provider.yaml`, `pyproject.toml`, and `providers/.pre-commit-config.yaml`),
or `Prek files` (`scripts/ci/prek/`). The last condition ensures the check runs
when the check script itself is modified.

## Suspended providers

Expand Down
8 changes: 6 additions & 2 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ def __hash__(self):
FileGroupForCi.ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES: [
r"^providers/.*/pyproject\.toml$",
r"^providers/.*/provider\.yaml$",
r"^providers/\.pre-commit-config\.yaml$",
],
FileGroupForCi.ALL_DEV_PYTHON_FILES: [
r"^dev/.*\.py$",
Expand Down Expand Up @@ -1696,9 +1697,12 @@ def skip_prek_hooks(self) -> str:
FileGroupForCi.ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES, CI_FILE_GROUP_MATCHES
)
or self._matching_files(FileGroupForCi.ALL_PROVIDERS_PYTHON_FILES, CI_FILE_GROUP_MATCHES)
or self._matching_files(FileGroupForCi.PREK_FILES, CI_FILE_GROUP_MATCHES)
):
# only skip provider validation if none of the provider.yaml and provider
# python files changed because validation also walks through all the provider python files
# Skip provider validation only when none of these changed:
# - provider.yaml / pyproject.toml / providers/.pre-commit-config.yaml
# - provider Python files (validation walks all provider Python files)
# - prek scripts (the check script itself may have changed)
prek_hooks_to_skip.add("check-provider-yaml-valid")
# Non-provider mypy checks run as prek hooks in static checks.
# Skip them when their relevant files haven't changed, unless devel-common
Expand Down
31 changes: 31 additions & 0 deletions dev/breeze/tests/test_selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,37 @@ def test_full_test_needed_when_scripts_changes(files: tuple[str, ...], expected_
assert_outputs_are_printed(expected_outputs, str(stderr))


@pytest.mark.parametrize(
"files",
[
pytest.param(
("scripts/ci/prek/check_provider_yaml_files.py",),
id="provider yaml check script changed",
),
pytest.param(
("providers/.pre-commit-config.yaml",),
id="providers prek config changed",
Comment thread
dabla marked this conversation as resolved.
),
pytest.param(
(
"scripts/ci/prek/check_provider_yaml_files.py",
"providers/.pre-commit-config.yaml",
),
id="provider yaml check script and providers prek config changed together",
),
],
Comment thread
dabla marked this conversation as resolved.
)
def test_provider_yaml_check_not_skipped_when_check_scripts_change(files: tuple[str, ...]):
stderr = SelectiveChecks(
files=files,
github_event=GithubEvents.PULL_REQUEST,
commit_ref=NEUTRAL_COMMIT,
default_branch="main",
)
skip_prek_hooks = str(stderr).split("skip-prek-hooks=")[1].split("\n")[0]
assert "check-provider-yaml-valid" not in skip_prek_hooks.split(",")


@pytest.mark.parametrize(
("files", "expected_outputs"),
[
Expand Down
Loading