-
Notifications
You must be signed in to change notification settings - Fork 27
82 lines (71 loc) · 2.56 KB
/
python_unittests.yml
File metadata and controls
82 lines (71 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Python Unit Tests
on:
push:
branches:
- master
pull_request:
jobs:
unittests:
strategy:
fail-fast: false
matrix:
# Python 3.12 cannot be exercised while pandas is pinned <2.1 (the
# abagen groupby/pkg_resources workaround), because pandas 2.0.x
# ships no wheels for 3.12 and cannot be built from source there.
# Re-add 3.12 once abagen is patched and the pin is lifted.
python-version: ['3.10', '3.11']
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"