From b42238147c8825ca88090a102261f77554f67693 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:42:54 +0000 Subject: [PATCH 1/4] Initial plan From 440889fe348d33ddafcb19be502a9346cb090d77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:51:48 +0000 Subject: [PATCH 2/4] Add ReadTheDocs and Code Coverage badges to README Co-authored-by: trissim <56880052+trissim@users.noreply.github.com> --- .github/badges/coverage.svg | 20 +++++ .github/workflows/coverage-pages.yml | 117 +++++++++++++++++++++++++++ README.md | 2 + 3 files changed, 139 insertions(+) create mode 100644 .github/badges/coverage.svg create mode 100644 .github/workflows/coverage-pages.yml diff --git a/.github/badges/coverage.svg b/.github/badges/coverage.svg new file mode 100644 index 0000000..d844535 --- /dev/null +++ b/.github/badges/coverage.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + coverage + coverage + 0% + 0% + + diff --git a/.github/workflows/coverage-pages.yml b/.github/workflows/coverage-pages.yml new file mode 100644 index 0000000..7cab8d8 --- /dev/null +++ b/.github/workflows/coverage-pages.yml @@ -0,0 +1,117 @@ +name: Tests, Coverage and GitHub Pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: write # Needed for badge commit + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + test-and-deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + pip install pytest==7.4.0 pytest-cov==4.1.0 coverage==7.3.2 genbadge[coverage] + + - name: Install PyTorch (CPU-only) for tests + run: | + pip install torch --index-url https://download.pytorch.org/whl/cpu + + - name: Run tests with coverage + continue-on-error: true # Continue workflow even if tests fail + run: | + mkdir -p site + python -m pytest --cov=arraybridge \ + --cov-report=xml \ + --cov-report=html:site/coverage \ + tests/ || echo "Some tests failed, but continuing with coverage report generation" + + - name: Generate coverage badge + run: | + mkdir -p .github/badges + genbadge coverage -i coverage.xml -o .github/badges/coverage.svg -n "coverage report" + + - name: Create index.html and README + run: | + # Create index.html for redirection + cat > site/index.html << 'EOF' + + + + + Redirecting to coverage report... + + +

Redirecting to coverage report... Click here if not redirected

+ + + EOF + + # Create README.md in the site directory + cat > site/README.md << 'EOF' + # arraybridge Code Coverage Reports + + This site contains the code coverage reports for the [arraybridge](https://github.com/trissim/arraybridge) project. + + ## Navigation + + - [Coverage Report](./coverage/): View the HTML coverage report + + ## About + + These reports are automatically generated by GitHub Actions whenever changes are pushed to the main branch. + They show the percentage of code that is covered by automated tests. + + Last updated: $(date) + EOF + + - name: Commit and push if coverage badge changed + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add .github/badges/coverage.svg -f + git commit -m "chore: update coverage badge" || exit 0 + git push + + - name: Check GitHub Pages status + run: | + echo "⚠️ IMPORTANT: Make sure GitHub Pages is enabled in your repository settings!" + echo "Go to https://github.com/trissim/arraybridge/settings/pages" + echo "Set 'Source' to 'GitHub Actions' to enable GitHub Pages deployment." + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'site' + retention-days: 1 + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + timeout-minutes: 10 diff --git a/README.md b/README.md index efef8d7..33ce153 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,10 @@ **Unified API for NumPy, CuPy, PyTorch, TensorFlow, JAX, and pyclesperanto** [![PyPI version](https://badge.fury.io/py/arraybridge.svg)](https://badge.fury.io/py/arraybridge) +[![Documentation Status](https://readthedocs.org/projects/arraybridge/badge/?version=latest)](https://arraybridge.readthedocs.io/en/latest/?badge=latest) [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Coverage](https://raw.githubusercontent.com/trissim/arraybridge/main/.github/badges/coverage.svg)](https://trissim.github.io/arraybridge/coverage/) ## Features From f53bdea3b456e36b08dbe5457e13e08e340f1691 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:52:41 +0000 Subject: [PATCH 3/4] Add setup instructions for badges and documentation Co-authored-by: trissim <56880052+trissim@users.noreply.github.com> --- SETUP_INSTRUCTIONS.md | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 SETUP_INSTRUCTIONS.md diff --git a/SETUP_INSTRUCTIONS.md b/SETUP_INSTRUCTIONS.md new file mode 100644 index 0000000..2d320a9 --- /dev/null +++ b/SETUP_INSTRUCTIONS.md @@ -0,0 +1,64 @@ +# Setup Instructions for Badges and Documentation + +This document contains the manual steps needed to complete the badge and documentation setup for arraybridge. + +## 1. Enable GitHub Pages + +To display the coverage reports hosted on GitHub Pages: + +1. Go to: https://github.com/trissim/arraybridge/settings/pages +2. Under "Build and deployment" > "Source", select **"GitHub Actions"** +3. Save the changes + +Once enabled, the coverage-pages.yml workflow will deploy coverage reports to https://trissim.github.io/arraybridge/coverage/ + +## 2. Update Repository Description + +To add the ReadTheDocs link to the repository description: + +1. Go to: https://github.com/trissim/arraybridge +2. Click the gear icon (⚙️) next to "About" on the right side +3. In the "Website" field, enter: `https://arraybridge.readthedocs.io` +4. Optionally add topics/tags to improve discoverability +5. Click "Save changes" + +## 3. Verify ReadTheDocs Integration + +Ensure ReadTheDocs is properly configured: + +1. Go to: https://readthedocs.org/projects/arraybridge/ +2. Verify that the project is active and building successfully +3. Check that the webhook is configured (Settings > Integrations) +4. The `.readthedocs.yml` file is already configured in the repository + +## 4. Verify Codecov Integration + +The existing CI workflow (`.github/workflows/ci.yml`) already uploads coverage to Codecov: + +- Coverage is uploaded after tests run on ubuntu-latest with Python 3.12 and torch framework +- The coverage data is sent to Codecov using the `codecov/codecov-action@v3` +- No additional Codecov configuration is needed + +## 5. Test the New Workflow + +After merging this PR to main: + +1. The `coverage-pages.yml` workflow will run automatically +2. It will: + - Run tests with coverage + - Generate a coverage badge and commit it to `.github/badges/coverage.svg` + - Deploy the HTML coverage report to GitHub Pages +3. The badges in README.md will then display live data + +## Badge URLs + +The following badges have been added to README.md: + +- **ReadTheDocs**: `[![Documentation Status](https://readthedocs.org/projects/arraybridge/badge/?version=latest)](https://arraybridge.readthedocs.io/en/latest/?badge=latest)` +- **Coverage**: `[![Coverage](https://raw.githubusercontent.com/trissim/arraybridge/main/.github/badges/coverage.svg)](https://trissim.github.io/arraybridge/coverage/)` + +## Notes + +- The coverage badge will show 0% until the first successful run of the coverage-pages.yml workflow on the main branch +- The ReadTheDocs badge will show the build status (passing/failing) based on the latest documentation build +- Both workflows are set up similarly to the ezstitcher repository for consistency From 5573bd92ba59af5cf2825d0a5808192f39b3a45a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:54:41 +0000 Subject: [PATCH 4/4] Address code review feedback for coverage workflow Co-authored-by: trissim <56880052+trissim@users.noreply.github.com> --- .github/workflows/coverage-pages.yml | 36 +++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/coverage-pages.yml b/.github/workflows/coverage-pages.yml index 7cab8d8..0e74041 100644 --- a/.github/workflows/coverage-pages.yml +++ b/.github/workflows/coverage-pages.yml @@ -33,7 +33,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -e ".[dev]" - pip install pytest==7.4.0 pytest-cov==4.1.0 coverage==7.3.2 genbadge[coverage] + pip install genbadge[coverage] - name: Install PyTorch (CPU-only) for tests run: | @@ -46,12 +46,12 @@ jobs: python -m pytest --cov=arraybridge \ --cov-report=xml \ --cov-report=html:site/coverage \ - tests/ || echo "Some tests failed, but continuing with coverage report generation" + tests/ - name: Generate coverage badge run: | mkdir -p .github/badges - genbadge coverage -i coverage.xml -o .github/badges/coverage.svg -n "coverage report" + genbadge coverage -i coverage.xml -o .github/badges/coverage.svg -n "coverage" - name: Create index.html and README run: | @@ -70,22 +70,20 @@ jobs: EOF # Create README.md in the site directory - cat > site/README.md << 'EOF' - # arraybridge Code Coverage Reports - - This site contains the code coverage reports for the [arraybridge](https://github.com/trissim/arraybridge) project. - - ## Navigation - - - [Coverage Report](./coverage/): View the HTML coverage report - - ## About - - These reports are automatically generated by GitHub Actions whenever changes are pushed to the main branch. - They show the percentage of code that is covered by automated tests. - - Last updated: $(date) - EOF + echo "# arraybridge Code Coverage Reports" > site/README.md + echo "" >> site/README.md + echo "This site contains the code coverage reports for the [arraybridge](https://github.com/trissim/arraybridge) project." >> site/README.md + echo "" >> site/README.md + echo "## Navigation" >> site/README.md + echo "" >> site/README.md + echo "- [Coverage Report](./coverage/): View the HTML coverage report" >> site/README.md + echo "" >> site/README.md + echo "## About" >> site/README.md + echo "" >> site/README.md + echo "These reports are automatically generated by GitHub Actions whenever changes are pushed to the main branch." >> site/README.md + echo "They show the percentage of code that is covered by automated tests." >> site/README.md + echo "" >> site/README.md + echo "Last updated: $(date)" >> site/README.md - name: Commit and push if coverage badge changed if: github.event_name == 'push' && github.ref == 'refs/heads/main'