Skip to content

Fix chromosome level stats #79

Fix chromosome level stats

Fix chromosome level stats #79

Workflow file for this run

name: CI
# Trigger the workflow on push and pull request events to the main branch
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# Job 1: Run Tests
test:
name: Run Tests on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
# Define a matrix of Python versions to test against
strategy:
matrix:
python-version: [3.11, 3.12, 3.13]
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Set up the specified Python version
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Step 3: Install dependencies using Hatch
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
hatch env create
hatch run install
# Step 4: Run the test suite
- name: Run Tests
run: hatch run test
# Job 2: Build and Deploy Documentation
build_and_deploy_docs:
name: Build and Deploy Documentation
runs-on: ubuntu-latest
needs: test # Ensure tests pass before building docs
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Set up Python (using a specific version for consistency)
- name: Set Up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
# Step 3: Install dependencies for building docs
- name: Install Documentation Dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
hatch env create docs
hatch run docs-build
# Step 4: Deploy the generated docs to the gh-pages branch
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/site
publish_branch: gh-pages
release:
if: contains(github.event.head_commit.message, 'make-a-release')
runs-on: ubuntu-latest
name: Release ${{ github.event.head_commit.id }}
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch twine
- name: Extract Version from __init__.py
id: extract_version
run: |
VERSION=$(python -c "import re; \
import pathlib; \
init_file = pathlib.Path('src/snipe/__init__.py'); \
content = init_file.read_text(); \
match = re.search(r'__version__\s*=\s*[\'\"]([^\'\"]+)[\'\"]', content); \
print(match.group(1) if match else '0.0.0')")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build package
run: |
hatch build
- name: Upload to PyPI Test Server
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
python -m pip install twine
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: Create Git Tag
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: "v${{ env.VERSION }}"
name: "v${{ env.VERSION }}"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}