diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 846c1fa8af..99b2a3b592 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,6 +174,7 @@ jobs: --tb=no \ --capture=no \ --verbose \ + --github-ci-sections \ -m integration \ --distribution ${{ matrix.distro }} \ --tools-tree-distribution ${{ matrix.tools }} \ diff --git a/tests/conftest.py b/tests/conftest.py index 641dfedf6d..057e253c4b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,6 +38,11 @@ def pytest_addoption(parser: Any) -> None: help="Pass --debug-shell when running mkosi", action="store_true", ) + parser.addoption( + "--github-ci-sections", + help="Print GitHub Workflow section markers before and after each test", + action="store_true", + ) @pytest.fixture(scope="session") @@ -50,3 +55,13 @@ def config(request: Any) -> Image.Config: tools_tree_distribution=cast(Distribution, request.config.getoption("--tools-tree-distribution")), debug_shell=request.config.getoption("--debug-shell"), ) + + +@pytest.fixture(autouse=True) +def github_ci_sections(request: Any) -> Any: + if request.config.getoption("--github-ci-sections"): + print(f"::group::{request.node.name}") + yield + print("::endgroup::") + else: + yield