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
22 changes: 12 additions & 10 deletions .github/scripts/comment_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<details>\n<summary>📊 View Benchmark Details</summary>\n\n{report_content}\n\n</details>"

status_emoji = "🚀" if failures == 0 else "❌"

Expand All @@ -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:
Expand Down
74 changes: 15 additions & 59 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
2 changes: 1 addition & 1 deletion src/pyoctaveband/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Use non-interactive backend for plots
matplotlib.use("Agg")

__version__ = "1.1.0"
__version__ = "1.1.2"

# Public methods
__all__ = [
Expand Down