Skip to content

ci(quality_runners): route module test and coverage logs to artifacts (#140) - #376

Open
srinivasugithub wants to merge 10 commits into
eclipse-score:mainfrom
bgsw-contrib:feature/issue-140-quality-runners-logs
Open

srinivasugithub wants to merge 10 commits into
eclipse-score:mainfrom
bgsw-contrib:feature/issue-140-quality-runners-logs

Conversation

@srinivasugithub

Copy link
Copy Markdown
Contributor

Resolves #140

Currently, run_command() in scripts/quality_runners.py streams all raw compiler, Bazel execution, and test analysis output directly to stdout/stderr. During CI runs, this produces tens of thousands of lines of output, making job logs difficult to read and hitting CI log limits.

Changes

  1. Subprocess Stream Redirection (scripts/quality_runners.py):
    • Extended run_command() with log_file, verbose, and tail_on_failure parameters.
    • Raw compiler and test output is redirected in real time into per-module artifact files (artifacts/logs/<module_name>.log), keeping stdout clean and concise.
    • Added --log-output-dir (default: artifacts/logs/) and --verbose flags.
  2. Failure Diagnostic Tailing:
    • If a test or coverage command fails (exit_code != 0), up to tail_on_failure (default 30) lines of both stderr and stdout are independently printed to the console so failures can be diagnosed immediately in CI without downloading log files.
  3. CI Artifact Upload (.github/workflows/test_and_docs.yml):
    • Added an upload step (actions/upload-artifact@v4) right after unit test execution with if: always() and if-no-files-found: warn to preserve module log files across successful and failing runs.
  4. Hermetic Bazel Build & Testing:
    • Packaged scripts/quality_runners.py as //scripts:quality_runners in scripts/BUILD.
    • Wired //scripts:quality_runners into //scripts/known_good:known_good_tests.
    • Added 10 unit tests in scripts/known_good/tests/test_quality_runners_logging.py covering stream capture, directory creation, failure tailing, argument parsing, and runner routing.

Verification

  • PYTHONPATH=. pytest scripts/known_good/tests -v: 132/132 passed.
  • bazel test //scripts/tooling:tooling_tests //scripts/known_good:known_good_tests: both passed.
  • ruff check scripts/ & ruff format --check scripts/: all checks passed.
  • bazel run //:format.check_Starlark_with_buildifier: passed.
  • pre-commit run copyright --all-files: passed.
  • Local execution with python3 ./scripts/quality_runners.py --modules-to-test score_kyron --trust-cache: verified clean console prints and full log capture in artifacts/logs/score_kyron.log.

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

Comment thread scripts/known_good/BUILD Outdated
Comment on lines +35 to +38
deps = [
":known_good",
"//scripts:quality_runners",
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a total mixup now. You added tests to quality runners but placed them in known_good and referenced everything.
IMO test_quality_runners_logging should be placed next to quality runners and get its own test target

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Moved test_quality_runners_logging.py to scripts/tests/, defined a dedicated //scripts:quality_runners_tests target in scripts/BUILD, and added it to .github/workflows/internal_tests.yml. Reverted
scripts/known_good/BUILD so known_good_tests no longer depends on quality_runners

Comment thread scripts/quality_runners.py Outdated
Comment on lines +22 to +27
try:
from known_good.models.known_good import load_known_good
from known_good.models.module import Module
except ModuleNotFoundError:
from scripts.known_good.models.known_good import load_known_good
from scripts.known_good.models.module import Module

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think cleaning up test targets will allow to get rid of that 2 way imports

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. With the dedicated test target and imports = ["."] configured on //scripts:quality_runners, the try...except ModuleNotFoundError fallback was removed in favor of standard imports from known_good.models.

kandukurisrinivasu and others added 2 commits October 5, 2026 17:09
…mports

- Relocate test_quality_runners_logging.py to scripts/tests/
- Define dedicated //scripts:quality_runners_tests Bazel test target
- Wire //scripts:quality_runners_tests into internal_tests CI workflow
- Remove //scripts:quality_runners dependency from known_good_tests
- Remove try/except ModuleNotFoundError import fallback in quality_runners.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Integration-test output is unintentionally suppressed without being saved to an artifact.

1 open finding
What changed in this PR

Routes quality-runner output into per-module artifacts to reduce CI log volume while retaining failure diagnostics.

Changes:

  • Adds configurable log capture, verbosity, and failure tails.
  • Adds tests and Bazel targets for logging behavior.
  • Uploads logs as CI artifacts and runs the new tests internally.
File Description
scripts/​quality_runners.py Implements logging and CLI options.
scripts/​tests/​test_quality_runners_logging.py Tests logging and routing behavior.
scripts/​BUILD Defines library and test targets.
.github/​workflows/​test_and_docs.yml Uploads module logs.
.github/​workflows/​internal_tests.yml Runs the new Bazel test target.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

command: list[str],
log_file: Path | None = None,
*,
verbose: bool = False,

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ref_int - quality runners logs

4 participants