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
21 changes: 19 additions & 2 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class FileGroupForCi(Enum):
ALL_AIRFLOW_PYTHON_FILES = "all_airflow_python_files"
ALL_AIRFLOW_CTL_PYTHON_FILES = "all_airflow_ctl_python_files"
ALL_PROVIDERS_PYTHON_FILES = "all_provider_python_files"
ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES = "all_provider_distribution_config_files"
ALL_DEV_PYTHON_FILES = "all_dev_python_files"
ALL_DEVEL_COMMON_PYTHON_FILES = "all_devel_common_python_files"
ALL_PROVIDER_YAML_FILES = "all_provider_yaml_files"
Expand Down Expand Up @@ -231,6 +232,10 @@ def __hash__(self):
FileGroupForCi.ALL_PROVIDERS_PYTHON_FILES: [
r"^providers/.*\.py$",
],
FileGroupForCi.ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES: [
r"^providers/.*/pyproject\.toml$",
r"^providers/.*/provider\.yaml$",
],
FileGroupForCi.ALL_DEV_PYTHON_FILES: [
r"^dev/.*\.py$",
],
Expand Down Expand Up @@ -705,6 +710,9 @@ def mypy_checks(self) -> list[str]:
checks_to_run.append("mypy-airflow-core")
if (
self._matching_files(FileGroupForCi.ALL_PROVIDERS_PYTHON_FILES, CI_FILE_GROUP_MATCHES)
or self._matching_files(
FileGroupForCi.ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES, CI_FILE_GROUP_MATCHES
)
or self._are_all_providers_affected()
) and self._default_branch == "main":
checks_to_run.append("mypy-providers")
Expand Down Expand Up @@ -862,12 +870,16 @@ def _get_core_test_types_to_run(self) -> list[str]:
all_providers_source_files = self._matching_files(
FileGroupForCi.ALL_PROVIDERS_PYTHON_FILES, CI_FILE_GROUP_MATCHES
)
all_providers_distribution_config_files = self._matching_files(
FileGroupForCi.ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES, CI_FILE_GROUP_MATCHES
)
test_always_files = self._matching_files(FileGroupForCi.ALWAYS_TESTS_FILES, CI_FILE_GROUP_MATCHES)
test_ui_files = self._matching_files(FileGroupForCi.UI_FILES, CI_FILE_GROUP_MATCHES)

remaining_files = (
set(all_source_files)
- set(all_providers_source_files)
- set(all_providers_distribution_config_files)
- set(matched_files)
- set(kubernetes_files)
- set(system_test_files)
Expand Down Expand Up @@ -910,10 +922,13 @@ def _get_providers_test_types_to_run(self, split_to_individual_providers: bool =
all_providers_source_files = self._matching_files(
FileGroupForCi.ALL_PROVIDERS_PYTHON_FILES, CI_FILE_GROUP_MATCHES
)
all_providers_distribution_config_files = self._matching_files(
FileGroupForCi.ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES, CI_FILE_GROUP_MATCHES
)
assets_source_files = self._matching_files(FileGroupForCi.ASSET_FILES, CI_FILE_GROUP_MATCHES)

if (
len(all_providers_source_files) == 0
and len(all_providers_distribution_config_files) == 0
and len(assets_source_files) == 0
and not self.needs_api_tests
):
Expand Down Expand Up @@ -1221,7 +1236,9 @@ def skip_pre_commits(self) -> str:
):
pre_commits_to_skip.add("lint-helm-chart")
if not (
self._matching_files(FileGroupForCi.ALL_PROVIDER_YAML_FILES, CI_FILE_GROUP_MATCHES)
self._matching_files(
FileGroupForCi.ALL_PROVIDERS_DISTRIBUTION_CONFIG_FILES, CI_FILE_GROUP_MATCHES
)
or self._matching_files(FileGroupForCi.ALL_PROVIDERS_PYTHON_FILES, CI_FILE_GROUP_MATCHES)
):
# only skip provider validation if none of the provider.yaml and provider
Expand Down
78 changes: 78 additions & 0 deletions dev/breeze/tests/test_selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,84 @@ def assert_outputs_are_printed(expected_outputs: dict[str, str], stderr: str):
},
id="Providers tests run including amazon tests if amazon provider files changed",
),
pytest.param(
("providers/amazon/src/airflow/providers/amazon/pyproject.toml",),
{
"selected-providers-list-as-string": "amazon apache.hive cncf.kubernetes "
"common.compat common.messaging common.sql exasol ftp google http imap microsoft.azure "
"mongo mysql openlineage postgres salesforce ssh teradata",
"all-python-versions": f"['{DEFAULT_PYTHON_MAJOR_MINOR_VERSION}']",
"all-python-versions-list-as-string": DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
"python-versions": f"['{DEFAULT_PYTHON_MAJOR_MINOR_VERSION}']",
"python-versions-list-as-string": DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
"ci-image-build": "true",
"prod-image-build": "false",
"needs-helm-tests": "false",
"run-tests": "true",
"docs-build": "true",
# no python files changed so flynt should not run
"skip-pre-commits": "flynt," + ALL_SKIPPED_COMMITS_IF_NO_UI_AND_HELM_TESTS,
"run-kubernetes-tests": "false",
"upgrade-to-newer-dependencies": "false",
"run-amazon-tests": "true",
"core-test-types-list-as-strings-in-json": json.dumps(
[{"description": "Always", "test_types": "Always"}]
),
"providers-test-types-list-as-strings-in-json": json.dumps(
[
{
"description": "amazon...google",
"test_types": "Providers[amazon] Providers[apache.hive,cncf.kubernetes,"
"common.compat,common.messaging,common.sql,exasol,ftp,http,imap,"
"microsoft.azure,mongo,mysql,openlineage,postgres,salesforce,ssh,teradata] "
"Providers[google]",
}
]
),
"needs-mypy": "true",
"mypy-checks": "['mypy-providers']",
},
id="Providers tests run including amazon tests if only amazon pyproject.toml files changed",
),
pytest.param(
("providers/amazon/src/airflow/providers/amazon/provider.yaml",),
{
"selected-providers-list-as-string": "amazon apache.hive cncf.kubernetes "
"common.compat common.messaging common.sql exasol ftp google http imap microsoft.azure "
"mongo mysql openlineage postgres salesforce ssh teradata",
"all-python-versions": f"['{DEFAULT_PYTHON_MAJOR_MINOR_VERSION}']",
"all-python-versions-list-as-string": DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
"python-versions": f"['{DEFAULT_PYTHON_MAJOR_MINOR_VERSION}']",
"python-versions-list-as-string": DEFAULT_PYTHON_MAJOR_MINOR_VERSION,
"ci-image-build": "true",
"prod-image-build": "false",
"needs-helm-tests": "false",
"run-tests": "true",
"docs-build": "true",
# no python files changed so flynt should not run
"skip-pre-commits": "flynt," + ALL_SKIPPED_COMMITS_IF_NO_UI_AND_HELM_TESTS,
"run-kubernetes-tests": "false",
"upgrade-to-newer-dependencies": "false",
"run-amazon-tests": "true",
"core-test-types-list-as-strings-in-json": json.dumps(
[{"description": "Always", "test_types": "Always"}]
),
"providers-test-types-list-as-strings-in-json": json.dumps(
[
{
"description": "amazon...google",
"test_types": "Providers[amazon] Providers[apache.hive,cncf.kubernetes,"
"common.compat,common.messaging,common.sql,exasol,ftp,http,imap,"
"microsoft.azure,mongo,mysql,openlineage,postgres,salesforce,ssh,teradata] "
"Providers[google]",
}
]
),
"needs-mypy": "true",
"mypy-checks": "['mypy-providers']",
},
id="Providers tests run including amazon tests if only amazon provider.yaml files changed",
),
pytest.param(
("providers/airbyte/tests/airbyte/__init__.py",),
{
Expand Down