Skip to content

Commit

Permalink
ci: print group section lines for GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
behrmann committed Mar 12, 2024
1 parent 2ac852c commit 9851885
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ jobs:
--tb=no \
--capture=no \
--verbose \
--github-ci-sections \
-m integration \
--distribution ${{ matrix.distro }} \
--tools-tree-distribution ${{ matrix.tools }} \
Expand Down
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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

0 comments on commit 9851885

Please sign in to comment.