Skip to content

Commit

Permalink
Fix report generation with missing results
Browse files Browse the repository at this point in the history
  • Loading branch information
dflook committed Sep 27, 2023
1 parent 2b85ff1 commit b9a961d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_corpus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
VERSION=0.0.0
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" python-minifier/setup.py
if ! pip${{ matrix.python }} install python-minifier/ 2> >(tee -a stderr.log >&2) then;
if grep -q "requires a different Python" stderr.log; then
if ! pip${{ matrix.python }} install python-minifier/ 2> >(tee -a stderr.log >&2); then
if grep -q "require a different python version" stderr.log; then
echo "${{ matrix.ref }} doesn't support Python ${{ matrix.python }}. Skipping."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
Expand Down
11 changes: 9 additions & 2 deletions corpus_test/generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ def report_larger_than_base(results_dir: str, python_versions: str, minifier_sha
except FileNotFoundError:
continue

base_summary = result_summary(results_dir, python_version, base_sha)
try:
base_summary = result_summary(results_dir, python_version, base_sha)
except FileNotFoundError:
continue

larger_than_original = sorted(summary.compare_size_increase(base_summary), key=lambda result: result.original_size)[:10]

for entry in larger_than_original:
Expand All @@ -275,7 +279,10 @@ def report_slowest(results_dir: str, python_versions: str, minifier_sha: str) ->
|--------------|--------------:|--------------:|-----:|'''

for python_version in python_versions:
summary = result_summary(results_dir, python_version, minifier_sha)
try:
summary = result_summary(results_dir, python_version, minifier_sha)
except FileNotFoundError:
continue

for entry in sorted(summary.entries.values(), key=lambda entry: entry.time, reverse=True)[:10]:
yield f'| {entry.corpus_entry} | {entry.original_size} | {entry.minified_size} | {entry.time:.3f} |'
Expand Down

0 comments on commit b9a961d

Please sign in to comment.