Light, fluffy, and always free - The AWS Local Emulator alternative
ci: surface per-class timings from the compatibility test legs (#2507)
Hector Ventura47034394d118
diff --git a/.github/ci/compat-timing-report.py b/.github/ci/compat-timing-report.pynew file mode 100755index 0000000000..068fa8a762--- /dev/null+++ b/.github/ci/compat-timing-report.py@@ -0,0 +1,44 @@+#!/usr/bin/env python3+"""Print per-class timings from junit XMLs, slowest first.++Usage: compat-timing-report.py <results-dir>+Also appends the table to GITHUB_STEP_SUMMARY when set. Never fails the job:+bad or absent XMLs produce an empty report, not an error.+"""+import glob+import os+import sys+import xml.etree.ElementTree as ET++def main():+ d = sys.argv[1] if len(sys.argv) > 1 else 'test-results'+ rows = []+ for f in glob.glob(os.path.join(d, '*.xml')):+ try:+ root = ET.parse(f).getroot()+ except (ET.ParseError, OSError) as exc:+ print(f'warning: skipping unreadable JUnit XML {f}: {exc}', file=sys.stderr)+ continue+ suites = root.iter('testsuite') if root.tag != 'testsuite' else [root]+ for ts in suites:+ try:+ rows.append((float(ts.get('time') or 0), int(ts.get('tests') or 0),+ ts.get('name') or os.path.basename(f)))+ except ValueError as exc:+ print(f'warning: skipping suite with non-numeric attributes in {f}: {exc}',+ file=sys.stderr)+ rows.sort(reverse=True)+ total_t = sum(r[0] for r in rows)+ total_n = sum(r[1] for r in rows)+ lines = [f'== {len(rows)} suites, {total_n} tests, {total_t / 60:.1f} min total test time',+ '== slowest 25 classes:']+ lines += [f'{t:8.1f}s {n:5d} tests {name}' for t, n, name in rows[:25]]+ report = '\n'.join(lines)+ print(report)+ summary = os.environ.get('GITHUB_STEP_SUMMARY')+ if summary:+ with open(summary, 'a') as fh:+ fh.write('```\n' + report + '\n```\n')++if __name__ == '__main__':+ main()diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.ymlindex f6941934ee..f07a8e7417 100644--- a/.github/workflows/compatibility.yml+++ b/.github/workflows/compatibility.yml@@ -10,6 +10,7 @@ on:- 'docker/entrypoint.sh'- 'docker/localstack-parity.sh'- 'compatibility-tests/**'+ - '.github/ci/compat-timing-report.py'- '.github/workflows/compatibility.yml'permissions:@@ -179,7 +180,9 @@ jobs:- name: Checkout repositoryuses: actions/[email protected]with:- sparse-checkout: compatibility-tests+ sparse-checkout: |+ compatibility-tests+ .github/ci- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0@@ -230,6 +233,25 @@ jobs:with:paths: test-results/*.xml+ # The test body inside the container runs its build tool quietly, so the+ # job log carries no per-class timings and the slow legs (sdk-test-java,+ # ~10 min) are a black box. Surface the timings from the junit XMLs the+ # suites already export, and upload the raw XMLs so the numbers are+ # machine-readable across runs.+ - name: Report slowest test classes+ if: always() && steps.tests.outcome != 'skipped'+ # Measurement-only: a reporting bug must never fail an otherwise-green leg.+ continue-on-error: true+ run: python3 .github/ci/compat-timing-report.py test-results++ - name: Upload test results+ if: always() && steps.tests.outcome != 'skipped'+ uses: actions/upload-artifact@v7+ with:+ name: compat-results-${{ matrix.test }}+ path: test-results/+ if-no-files-found: warn+- name: Dump floci logsif: failure()run: docker logs floci