Skip to content

Fix CI (Python + MATLAB) and three small bugs in stats #798

Fix CI (Python + MATLAB) and three small bugs in stats

Fix CI (Python + MATLAB) and three small bugs in stats #798

name: Python Unit Tests
on:
push:
branches:
- master
pull_request:
jobs:
unittests:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
shell: bash
run: |
# setuptools 81+ no longer ships the legacy `pkg_resources` module on
# import, but transitive deps (e.g. abagen 0.1.3 in
# brainstat/context/genetics.py) still rely on it. Pin <81 so test
# collection succeeds; revisit when abagen drops the pkg_resources
# import.
python -m pip install --upgrade pip
python -m pip install 'setuptools<81' wheel
[[ -z $(git remote show origin | grep "Fetch URL:" | grep git@github.com:MICA-MNI/BrainStat.git) ]] && git config remote.upstream.fetch refs/heads/*:refs/remotes/upstream/* || git config remote.origin.fetch refs/heads/*:refs/origin/upstream/*
git fetch origin test-data-2.0
python -m pip install -e .[dev]
# Reinstall pinned setuptools in case the editable install pulled it
# back up to 81+.
python -m pip install --force-reinstall 'setuptools<81'
- name: Test with pytest
shell: bash
run: |
python3 -m pytest
# mypy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python 3.9
# uses: actions/setup-python@v2
# with:
# python-version: 3.9
# - name: Install Dependencies
# shell: bash
# run: |
# python -m pip install -e .[dev]
# python -m pip install numpy==1.21.5
# - name: Test with mypy
# shell: bash
# run: |
# python3 -m mypy $(find brainstat -path "*tests*" -prune -false -o -name "*.py")
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-python@v2
# with:
# python-version: 3.8
# - uses: psf/black@stable
# with:
# black_args: ". --check"