diff --git a/.github/scripts/comment_pr.py b/.github/scripts/comment_pr.py index 040e926..5a2dfbe 100644 --- a/.github/scripts/comment_pr.py +++ b/.github/scripts/comment_pr.py @@ -98,18 +98,22 @@ def main(): repo = os.environ.get("GITHUB_REPOSITORY") run_id = os.environ.get("GITHUB_RUN_ID") test_dir = "test-results" - image_dir = "generated-graphs" test_table, tests, failures = parse_test_results(test_dir) - image_gallery = generate_image_gallery(image_dir, repo, run_id) benchmark_report = "" - # Look for the benchmark report in the downloaded artifacts - for root, _, filenames in os.walk(test_dir): - if "filter_benchmark_report.md" in filenames: - with open(os.path.join(root, "filter_benchmark_report.md"), "r") as f: - benchmark_report = f.read() - break + # Read the benchmark report generated in the previous step of the workflow + if os.path.exists("filter_benchmark_report.md"): + with open("filter_benchmark_report.md", "r") as f: + report_content = f.read() + sha = os.environ.get("GITHUB_SHA") + if repo and sha: + # Make image paths absolute so they render in the PR comment + # Using raw.githubusercontent.com for reliable rendering + report_content = report_content.replace("](.github/images", f"](https://raw.githubusercontent.com/{repo}/{sha}/.github/images") + + # Wrap the report in a details block + benchmark_report = f"### Technical Benchmark Summary\n\n
\n📊 View Benchmark Details\n\n{report_content}\n\n
" status_emoji = "🚀" if failures == 0 else "❌" @@ -120,8 +124,6 @@ def main(): {benchmark_report} -{image_gallery} - [View Full Artifacts](https://github.com/{repo}/actions/runs/{run_id})""" with open("pr_comment_body.md", "w") as f: diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 915971a..c41425f 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -69,65 +69,6 @@ jobs: coverage.xml if: always() - assets: - needs: tests - runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.TOKEN_GH || github.token }} - - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: "3.13" - cache: 'pip' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -e . - - - name: Regenerate all assets - run: | - python generate_graphs.py - python scripts/benchmark_filters.py - - - name: Commit and Push changes - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - # Check for changes in assets - git add .github/images/ filter_benchmark_report.md - - if git diff --staged --quiet; then - echo "No changes in assets detected." - else - echo "Changes detected, pushing updates..." - - if [ "${{ github.event_name }}" == "pull_request" ]; then - # Standard commit for PRs (no amend to avoid rebase hell) - git commit -m "chore: update assets for PR [skip ci]" - git push origin HEAD:${{ github.head_ref }} - else - # Clean amend for main branch - # Append [skip ci] to the original message to prevent loops - orig_msg=$(git log -1 --pretty=%B) - if [[ "$orig_msg" != *"[skip ci]"* ]]; then - git commit --amend -m "$orig_msg [skip ci]" - else - git commit --amend --no-edit - fi - git push origin ${{ github.ref_name }} --force - fi - fi - sonar: needs: tests runs-on: ubuntu-latest @@ -156,6 +97,21 @@ jobs: issues: write steps: - uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -e . + + - name: Run technical benchmark + run: python scripts/benchmark_filters.py + - name: Download Test Results uses: actions/download-artifact@v4 with: diff --git a/pyproject.toml b/pyproject.toml index 517249c..efec6e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "PyOctaveBand" -version = "1.1.1" +version = "1.1.2" authors = [ { name="Jose Manuel Requena Plens", email="jmrplens@gmail.com" }, ] diff --git a/src/pyoctaveband/__init__.py b/src/pyoctaveband/__init__.py index 77860b8..184d9be 100644 --- a/src/pyoctaveband/__init__.py +++ b/src/pyoctaveband/__init__.py @@ -19,7 +19,7 @@ # Use non-interactive backend for plots matplotlib.use("Agg") -__version__ = "1.1.0" +__version__ = "1.1.2" # Public methods __all__ = [