Skip to content

Preserve nominal array payloads during dtype conversion #37

Preserve nominal array payloads during dtype conversion

Preserve nominal array payloads during dtype conversion #37

name: Tests, Coverage and GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
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 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
run: |
mkdir -p site
python -m pytest --cov=arraybridge \
--cov-report=xml \
--cov-report=html:site/coverage \
tests/
- name: Generate coverage badge
run: |
genbadge coverage -i coverage.xml -o site/coverage-badge.svg -n "coverage"
- 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
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/OpenHCSDev/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: Check GitHub Pages status
run: |
echo "⚠️ IMPORTANT: Make sure GitHub Pages is enabled in your repository settings!"
echo "Go to https://github.com/OpenHCSDev/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