Skip to content

Add JOSS paper draft #7

Add JOSS paper draft

Add JOSS paper draft #7

name: Tests and Coverage Reports
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]"
- name: Patch metaclass-registry (temporary fix for import issues)
run: |
# Fix metaclass-registry __init__.py to avoid import errors
REGISTRY_INIT=$(python -c "import metaclass_registry, os; print(os.path.dirname(metaclass_registry.__file__))")/__init__.py
cat > "$REGISTRY_INIT" << 'EOF'
"""metaclass-registry: Zero-boilerplate metaclass-driven plugin registry system."""
__version__ = "0.1.0"
from .core import AutoRegisterMeta, RegistryConfig, PRIMARY_KEY
from .exceptions import RegistryError
__all__ = ["AutoRegisterMeta", "RegistryConfig", "PRIMARY_KEY", "RegistryError"]
EOF
- name: Verify installation
run: |
python -c "import polystore; print(f'polystore {polystore.__version__} installed successfully')"
- name: Run tests with coverage
run: |
mkdir -p site
python -m pytest --cov=polystore \
--cov-report=xml \
--cov-report=html:site/coverage \
-v
- 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'
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=./coverage/">
<title>Redirecting to coverage report...</title>
</head>
<body>
<p>Redirecting to coverage report... <a href="./coverage/">Click here if not redirected</a></p>
</body>
</html>
EOF
# Create README.md in the site directory
cat > site/README.md << 'EOF'
# Polystore Code Coverage Reports
This site contains the code coverage reports for the [Polystore](https://github.com/trissim/polystore) 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/polystore/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