Skip to content

Merge pull request #81 from peterjc/patch-1 #152

Merge pull request #81 from peterjc/patch-1

Merge pull request #81 from peterjc/patch-1 #152

Workflow file for this run

name: Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch: # Allows manual triggering
# Limit concurrent runs of this workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
version-consistency:
name: Version consistency check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check pyproject.toml, CITATION.cff, and pixi.lock agree on version
run: |
set -euo pipefail
PYPROJECT_VERSION=$(grep -E '^[[:space:]]*version[[:space:]]*=' pyproject.toml \
| head -1 \
| sed -E 's/.*version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/')
if [ -z "$PYPROJECT_VERSION" ]; then
echo "::error file=pyproject.toml::Could not extract version"
exit 1
fi
CFF_VERSION=$(grep -E '^version: ' CITATION.cff | head -1 | sed -E 's/^version: //')
LOCK_VERSION=$(awk '
/^ name: funannotate2$/ { found = 1; next }
found && /^ version:/ { print $2; exit }
' pixi.lock)
printf 'pyproject.toml: %s\nCITATION.cff: %s\npixi.lock: %s\n' \
"$PYPROJECT_VERSION" "$CFF_VERSION" "$LOCK_VERSION"
status=0
if [ "$PYPROJECT_VERSION" != "$CFF_VERSION" ]; then
echo "::error file=CITATION.cff::CITATION.cff version ($CFF_VERSION) does not match pyproject.toml ($PYPROJECT_VERSION). Update CITATION.cff (the .githooks/pre-commit hook will do this automatically when pyproject.toml changes)."
status=1
fi
if [ "$PYPROJECT_VERSION" != "$LOCK_VERSION" ]; then
echo "::error file=pixi.lock::pixi.lock pins funannotate2 ($LOCK_VERSION) but pyproject.toml is $PYPROJECT_VERSION. Run 'pixi install' locally and commit the refreshed pixi.lock; otherwise the Docker build will fail on 'pixi install --locked'."
status=1
fi
exit $status
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # Temporarily disable macOS due to mappy build issues
python-version: ['3.10', '3.11', '3.12', '3.13']
include:
# Add one macOS test with conda-based installation
- os: macos-latest
python-version: '3.11'
use_conda: true
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install system dependencies
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt-get update
sudo apt-get install -y build-essential cmake zlib1g-dev
fi
- name: Setup conda (macOS only)
if: matrix.use_conda == true
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Install dependencies
env:
# Force pytantan to build from sdist so all Python versions get the
# same AVX2-off baseline. The published cp3x wheels have caused
# import-time failures on 3.10/3.11 in this matrix.
PIP_NO_BINARY: pytantan
run: |
if [[ "${{ matrix.use_conda }}" == "true" ]]; then
# Use conda for macOS to avoid mappy build issues
conda install -c conda-forge -c bioconda mappy numpy pytest pytest-cov cmake -y
# Install funannotate2 in editable mode - this will install all dependencies from pyproject.toml
pip install -e .
else
# Linux - use pip as normal
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install -e .
fi
shell: bash -l {0}
- name: Run unit tests
run: |
pytest tests/unit/ -v --cov=funannotate2 --cov-report=xml
shell: bash -l {0}
- name: Run integration tests without external dependencies
run: |
pytest tests/integration/test_funannotate_cli.py -v
shell: bash -l {0}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: nextgenusfs/funannotate2