Do not trigger provider tests on core changes (#40776)

Provider tests have been triggered when core airflow changed. This
has been done in order to avoid some core changes that would break
providers, however running provider tests - especially including
compatibility tests takes a long time now and especially after we
switched the committer PRs to run using public runners - adding
compatibility tests to be run whenever provider tests ar run also
does not help with speed.
Instead we should defer to the "canary" build to catch such changes
and rather than actively check all providers in PRs, the "canary"
builds should be enough to catch any of such changes.
This commit is contained in:
Jarek Potiuk authored and GitHub committed 2024-07-14 08:22:46 +02:00
1 parent f399c4acec
commit ee97d7b6f5
3 files changed
+32 -21

No files matched your search

@@ -161,6 +161,11 @@ def all_selective_test_types() -> tuple[str, ...]:
return tuple(sorted(e.value for e in SelectiveUnitTestTypes))
@lru_cache(maxsize=None)
def all_selective_test_types_except_providers() -> tuple[str, ...]:
return tuple(sorted(e.value for e in SelectiveUnitTestTypes if e != SelectiveUnitTestTypes.PROVIDERS))
class SelectiveUnitTestTypes(Enum):
ALWAYS = "Always"
API = "API"
@@ -50,6 +50,7 @@ from airflow_breeze.global_constants import (
SelectiveUnitTestTypes,
all_helm_test_packages,
all_selective_test_types,
all_selective_test_types_except_providers,
)
from airflow_breeze.utils.console import get_console
from airflow_breeze.utils.exclude_from_matrix import excluded_combos
@@ -85,6 +86,10 @@ ALL_CI_SELECTIVE_TEST_TYPES = (
"PythonVenv Serialization WWW"
)
ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS = (
"API Always BranchExternalPython BranchPythonVenv CLI Core "
"ExternalPython Operators Other PlainAsserts PythonVenv Serialization WWW"
)
ALL_PROVIDERS_SELECTIVE_TEST_TYPES = "Providers[-amazon,google] Providers[amazon] Providers[google]"
@@ -744,11 +749,12 @@ class SelectiveChecks:
break
if count_remaining_files > 0:
get_console().print(
f"[warning]We should run all tests. There are {count_remaining_files} changed "
"files that seems to fall into Core/Other category[/]"
f"[warning]We should run all core tests except providers."
f"There are {count_remaining_files} changed files that seems to fall "
f"into Core/Other category[/]"
)
get_console().print(remaining_files)
candidate_test_types.update(all_selective_test_types())
candidate_test_types.update(all_selective_test_types_except_providers())
else:
if "Providers" in candidate_test_types or "API" in candidate_test_types:
affected_providers = self._find_all_providers_affected(
+18 -18
View File
@@ -33,6 +33,7 @@ from airflow_breeze.global_constants import (
from airflow_breeze.utils.packages import get_available_packages
from airflow_breeze.utils.selective_checks import (
ALL_CI_SELECTIVE_TEST_TYPES,
ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS,
ALL_PROVIDERS_SELECTIVE_TEST_TYPES,
SelectiveChecks,
)
@@ -1279,7 +1280,6 @@ def test_expected_output_pull_request_v2_7(
pytest.param(
("airflow/models/test.py",),
{
"affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED,
"all-python-versions": "['3.8']",
"all-python-versions-list-as-string": "3.8",
"ci-image-build": "true",
@@ -1287,21 +1287,20 @@ def test_expected_output_pull_request_v2_7(
"needs-helm-tests": "false",
"run-tests": "true",
"docs-build": "true",
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
"docs-list-as-string": "apache-airflow",
"skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-airflow,mypy-dev,mypy-docs,mypy-providers,ts-compile-format-lint-www",
"run-kubernetes-tests": "false",
"upgrade-to-newer-dependencies": "false",
"skip-provider-tests": "false",
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES,
"skip-provider-tests": "true",
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS,
"needs-mypy": "true",
"mypy-folders": "['airflow', 'providers']",
"mypy-folders": "['airflow']",
},
id="Tests for all providers should run if model file changed",
id="Tests for all airflow core types except providers should run if model file changed",
),
pytest.param(
("airflow/file.py",),
{
"affected-providers-list-as-string": ALL_PROVIDERS_AFFECTED,
"all-python-versions": "['3.8']",
"all-python-versions-list-as-string": "3.8",
"ci-image-build": "true",
@@ -1309,16 +1308,17 @@ def test_expected_output_pull_request_v2_7(
"needs-helm-tests": "false",
"run-tests": "true",
"docs-build": "true",
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
"docs-list-as-string": "apache-airflow",
"skip-pre-commits": "check-provider-yaml-valid,identity,lint-helm-chart,mypy-airflow,mypy-dev,mypy-docs,mypy-providers,ts-compile-format-lint-www",
"run-kubernetes-tests": "false",
"upgrade-to-newer-dependencies": "false",
"skip-provider-tests": "false",
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES,
"skip-provider-tests": "true",
"parallel-test-types-list-as-string": ALL_CI_SELECTIVE_TEST_TYPES_WITHOUT_PROVIDERS,
"needs-mypy": "true",
"mypy-folders": "['airflow', 'providers']",
"mypy-folders": "['airflow']",
},
id="Tests for all providers should run if any other than API/WWW/CLI/Operators file changed.",
id="Tests for all airflow core types except providers should run if "
"any other than API/WWW/CLI/Operators file changed.",
),
],
)
@@ -1601,9 +1601,9 @@ def test_upgrade_to_newer_dependencies(
pytest.param(
("airflow/test.py",),
{
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
"docs-list-as-string": "apache-airflow",
},
id="Core files changed. All provider docs should also be built",
id="Core files changed. Apache-Airflow docs should also be built",
),
pytest.param(
("docs/docker-stack/test.rst",),
@@ -1613,9 +1613,9 @@ def test_upgrade_to_newer_dependencies(
pytest.param(
("airflow/test.py", "chart/airflow/values.yaml"),
{
"docs-list-as-string": ALL_DOCS_SELECTED_FOR_BUILD,
"docs-list-as-string": "apache-airflow helm-chart",
},
id="Core files and helm chart files changed. All provider docs should be built",
id="Core files and helm chart files changed. Apache Airflow and helm chart docs to build",
),
pytest.param(
("chart/airflow/values.yaml",),
@@ -2033,11 +2033,11 @@ def test_provider_compatibility_checks(labels: tuple[str, ...], expected_outputs
("airflow/models/file.py",),
{
"needs-mypy": "true",
"mypy-folders": "['airflow', 'providers']",
"mypy-folders": "['airflow']",
},
"main",
(),
id="Airflow mypy checks on airflow files that can trigger provider tests",
id="Airflow mypy checks on airflow files with model changes.",
),
pytest.param(
("airflow/providers/a_file.py",),