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: 11 additions & 10 deletions .github/workflows/test_and_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
uses: eclipse-score/more-disk-space@v1.1
with:
level: 4
- name: Checkout repository (pull_request_target via workflow_call)
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- name: Checkout repository
Comment thread
PiotrKorkus marked this conversation as resolved.
Dismissed
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.18.0
with:
Expand All @@ -63,15 +72,6 @@
with:
packages: graphviz
cache: false
- name: Checkout repository (pull_request_target via workflow_call)
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- name: Checkout repository
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Build documentation - preflight # If we have doc errors, we dont wait of them 1h +...
run: |
bazel run \
Expand All @@ -82,7 +82,8 @@
rm -rf _build/
- name: Execute Unit Tests with Coverage Analysis
run: |
python ./scripts/quality_runners.py
python ./scripts/quality_runners.py \
${{ github.event_name != 'push' && github.event_name != 'release' && '--trust-cache' || '' }}
- name: Execute Feature Integration Tests
run: |
bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit
Expand Down
15 changes: 12 additions & 3 deletions scripts/quality_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def configure_aslr_for_sanitizers() -> None:
print(f"QR: Could not lower vm.mmap_rnd_bits (continuing anyway): {result.stderr.strip()}")


def run_unit_test_with_coverage(module: Module) -> dict[str, str | int]:
def run_unit_test_with_coverage(module: Module, trust_cache: bool = False) -> dict[str, str | int]:
print_centered("QR: Running unit tests")

call = (
Expand All @@ -72,7 +72,9 @@ def run_unit_test_with_coverage(module: Module) -> dict[str, str | int]:
"--config=ferrocene-coverage",
"--test_summary=testcase",
"--test_output=errors",
"--nocache_test_results",
]
+ ([] if trust_cache else ["--nocache_test_results"])
+ [
f"--instrumentation_filter=@{module.name}",
f"@{module.name}{module.metadata.code_root_path}",
]
Expand Down Expand Up @@ -302,6 +304,13 @@ def parse_arguments() -> argparse.Namespace:
default=[],
help="List of modules to test",
)
parser.add_argument(
"--trust-cache",
action="store_true",
help="Allow Bazel to reuse cached test/coverage results for unchanged modules instead of always "
"re-executing them (--nocache_test_results). Intended for fast PR-iteration checks; authoritative "
"runs (e.g. on push to main) should NOT set this, so coverage numbers are always freshly measured.",
)
return parser.parse_args()


Expand All @@ -325,7 +334,7 @@ def main() -> bool:
continue

print_centered(f"QR: Testing module: {module.name}")
unit_tests_summary[module.name] = run_unit_test_with_coverage(module=module)
unit_tests_summary[module.name] = run_unit_test_with_coverage(module=module, trust_cache=args.trust_cache)

if "cpp" in module.metadata.langs:
coverage_summary[f"{module.name}_cpp"] = run_cpp_coverage_extraction(
Expand Down
Loading